How to include xsi attributes in the response using just wso2 dataservices - wso2

I am using only Wso2 DSS and building webservices from an oracle DB. I know we can specify the namespace in serviceNamespace attribute. We the want to include other XSI attributes in the XML response like xsi:schemaLocation="xxx.xsd". Any pointers how to go about it. We do not want to use XSLT transformation as the same response should support JSON as well.
Regards

AFAIK adding XSI attributes or attribute namespaces is not possible in current DSS versions.I have raised a Jira(https://wso2.org/jira/browse/DS-1248) to track this improvement and it will be added in future releases.
Thanks.

Related

WSO2: Configuring xml multiple in a single project

I am using WSO2 ESB 6.5.0.
In the WSO2HOME/conf/synapse.properties I set property
synapse.commons.json.output.xmloutMultiplePI=true
for set the XML output to an xml-multiple processing instruction in XML to JSON transformations. (As this says )
This works fine, but In my WSO2 EI I have many Carbon Applications (CARs) and I need to apply this configuration only for a specific car, not to all because I have projects that stop working properly.
I know that all the properties set in synapse.properties will apply globally.
Is there a way to configure xml-multiple in a single project/sequence?

WSO2 CEP 3.0.0 support of XPath 2.0 functions in the event builder

I am currently creating an Event Builder in WSO2 CEP 3.0.0. based on an XML mapping.
I would like to use soma XPath 2.0 functions like tokenize in the XPath expression.
It seems that that the Xpath parser used by CEP is jaxen that does only support XPath 1.0 (which is far more limited...).
Does anybody know if it is possible to use XPath 2.0 functions in the Event Builder?
Thanks,
Eric
CEP 3.0.0 uses AxiomXPath which is based on jaxen (Axiom 1.2.11). So it will not be possible to use XPath 2.0 functions as you have correctly inferred.
I agree that this is quite limitative. However, the main consideration here was that WSO2 ESB has first class support for XPath and if any complex XML processing needs to be done, it can be done by the ESB first and then a Thrift(WSO2Event) event can be sent to run CEP queries on that event.
However, it might be useful to add more support for XPath in event builder. You can raise a JIRA or mail thread at WSO2 dev mailing list to discuss this further.
HTH,
Lasantha

Is there any way to implement Localization Internalization in CXF using Spring ReloadableResourceBundleMessageSource

I have been searching for a Spring based configuration approach, to support Localization/Internationalization in my Rest based application developed in Apache CXF. I need to localize the Exception messages, responses of my APIs and other informational messages as per the Language user opts for. The Locale information will come in the Request Header "Accept-Language" parameter.
In Spring MVC, there is a predefined way which support Localization & is very useful in dynamically loading corresponding properties file from class-path based on a request parameter set for language.
Spring MVC uses
ReloadableResourceBundleMessageSource,
LocaleChangeInterceptor,
DefaultAnnotationHandlerMapping to configure Localization.
But I am not able to find a similar way that can be used in CXF Restful web services.
Can anyone please put some light in it.
Thanks
Rahul

Using jax-ws-catalog.xml for resolving imported xsd:s in wsdl

I would like to deploy a Web Service using JAX-WS 2.1 on Weblogic where the wsdl imports a schema but I would prefer to have it in another location than together with the wsdl, preferrably it should be loaded from the classpath.
I was hoping I could use jax-ws-catalog.xml to map this but I cannot seem to get Weblogic to pick it up when deploying the application which then fails when the xsd cannot be found.
Maybe what I want to do is not possible and the catalog mapping is only used for Web Service clients, I have not found any clear documentation regarding this.
The import in the wsdl looks like this:
<xs:import namespace="com.xyz.common/1.0"
schemaLocation="com.xyz.Common.1.0.xsd" />
The jax-ws-catalog.xml placed in the WEB-INF folder looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog"
prefer="system">
<system systemId="com.xyz.Common.1.0.xsd"
uri="classpath:com.xyz.Common.1.0.xsd" />
</catalog>
As I said, this usage may not even be supported. I would be grateful for any pointers.
Thanks.
I think the JAX-WS jax-ws-catalog.xml is supported if you publish your endpoint via sun-jaxws.xml (that means via com.sun.xml.ws.transport.http.servlet.WSServletContextListener et al). Looking at JAX-WS source code, I see that catalog is supported if one uses W3CEndpointReferenceBuilder / Provider.createW3CEndpointReference() (maybe this article will give you more information).
What I suggest you to do is to start Weblogic AS in debug mode and put breakpoints on two public static parse() methods of class com.sun.xml.ws.wsdl.parser.RuntimeWSDLParser.

Is there a web site that does XSLT transformations and provides a URL as a result?

I would like to use Foursquare API XML results and transform them using XSLT to a RSS feed. I was wondering if there's any web site that has that functionality and generates a URL that returns the final transformation.
Something like:
From URL: http://foursquare.com/myapicall + XSLT transformation
I get a new URL: http://transformer/url=http://server.com/myapiresult&xlst=XXX
that returns the resulting transformation
Any other ideas to achieve this are welcome!
Thanks a lot
The W3C hosts an XSLT 2.0 Online XSLT Servlet Service that can be used to transform files.
http://www.w3.org/2005/08/online_xslt
In addition to using the form, you can also invoke the XSLT servlet by formulating a URL with two querystring parameters: 1. xmlfile to specify the source XML and 2. xslfile the XSLT to apply:
The results of the transform are returned from the request to the URL.
For example:
http://www.w3.org/2005/08/online_xslt/xslt?xmlfile=http://rss.cnn.com/rss/cnn_topstories.rss&xslfile=http://interglacial.com/rss/smb_rss2html.xsl
Conditions for Use
This service is provided without
warranty.
This service is freely (show your
support) provided for interactive use
by individuals only and not to be
utilized as a regular service by sites
other than w3.org. We will consider
blocking high volume usage or any
usage that causes a strain on our Web
servers.
Abuses of this service will be
deterred, please report any incidents.
To deter this service being utilized
by spammers, SURBL is implemented.
You may also wish to install the
application locally rather than using
the W3C service. For your convenience
a compiled version of this servlet and
the org.w3c classes used are collected
into a jar.
Not sure what exactly you are looking for, but these sites offer online XSLT transformations, showing the results in the browser:
http://www.w3schools.com/xsl/tryxslt.asp?xmlfile=cdcatalog&xsltfile=cdcatalog
http://chris.photobooks.com/xml/default.htm
I was wondering if there's any web
site that has that functionality and
generates a URL that returns the final
transformation.
While there may be sites that offer such functionality, this is by definition limited to a certain XSLT processor and comes with limited functionality (for example it is likely that DTDs and functions as document() are not supported, as well as EXSLT and other useful libraries).
Also, do not expect such sites to be responsive, as it is extremely easy to suffocate any such site -- just commit an error that results in endless recursion.
Therefore, I recommend getting a good XSLT processor and performing the transformation on your own computer.
See my answer to this question for available free XSLT processors and environments.