On Tue, May 1, 2012 at 5:35 PM, Andreas Veithen <andreas.veit...@gmail.com> wrote: > On Mon, Apr 30, 2012 at 20:54, Shameera Rathnayaka > <shameerai...@gmail.com> wrote: >> Hi Matthias, >> >>> org.apache.axis2.json.AbstractJSONOMBuilder line 111 >>> /* >>> Now we have to read the localname and prefix from the input stream >>> if there is not prefix, message starts like {"foo": >>> if there is a prefix, message starts like {"prefix:foo": >>> */ >>> : >>> //if the part we read ends with ", there is no prefix, >>> otherwise it has a prefix >>> : >>> prefix = localName.substring(1, localName.length()) + >>> ":"; >>> >> >> >>> : >>> >>> >>> What are these prefixes used for (separated by colon) if they have nothing >>> to do with namespaces? >>> Are they part of some JSON format? >> >> >> Yes, This is for handle namespaces in badgerfish convention. where it >> separate prefix and localname by a ':' colon. >> >>> >>> >>> And finally, is there a "fundamental" reason why: >>> “Mapped” formatted JSON with namespaces are not supported in Axis2 >> >> >> Axis2 uses Axiom as XML info-set representation for SOAP messages. That >> means, to process the request it should have clear XML info-set with it. It >> is not possible to know the namespace mappings used on one side of the >> transport to the other side when we use mapped convention. > > Actually this may be much simpler to implement than we thought. I > modified the code so that it now uses the new feature introduced by > AXIOM-399. This means that the OMDataSource is expanded when the name > of the element is first requested. I would expect that this occurs in > the code that dispatches to the service operation. At that point the > service should already be set in the message context. If that is > correct, then this means that at the time the OMDataSource is > expanded, the service to which the request is dispatched is already > known. We could then get the namespace mappings from a service > parameter that the user must configure in services.xml.
I implemented that design and both Badgerfish and mapped JSON are now working (although there is still a potential performance issue to solve). See my last comment in AXIS2-5158 for more information about how to set up an Axis2 service to work with mapped JSON. >> Thanks >> Shameera. >> >>> >>> Or is it just a resource issue, and someone (may be I) could add some >>> stuff to support namespaces and maybe databinding. >>> >>> Thanks and regards >>> Matthias >>> >>> >>> >>> From: Shameera Rathnayaka <shameerai...@gmail.com> >>> To: java-user@axis.apache.org, >>> Date: 26-04-2012 19:40 >>> Subject: Re: Axis2 - JSON mapped - namespace (mismatch) >>> ________________________________ >>> >>> >>> >>> Hi Matthias, >>> >>> According to the documentation [1] it simply says that “Mapped” formatted >>> JSON with namespaces are not supported in Axis2, I think you already have >>> got this point. Let me explain how current implementation of axis2 expect >>> mapped Json strings. >>> >>> The best way to demonstrate this is a short example, >>> assume you need to send following xml , >>> >>> <price xmlns="http://acme.com">10.00</price> >>> >>> Using the mapped convention this can be turned into: >>> >>> { "acme.price" : { "10.00" } where http://acme.com --> acme >>> >>> as axis2 doesn't support namesapce mapping it expect this as >>> >>> { "price" : { "10.00" } >>> That is why it checks always ':' colon instaed of '.' to get the >>> localname. >>> >>> [1] http://wso2.org/library/768 >>> >>> Thanks, >>> Shameera. >>> >>> >>> On Thu, Apr 26, 2012 at 6:29 PM, <ger...@slf.ch> wrote: >>> Hi >>> >>> I'm trying to get my SOAP web service to run using mapped JSON instead of >>> XML. >>> Because it is not that obvious when moving to JSON, what works and what >>> does not, I had to do some drilling down in to the code. >>> I got a sample Service running based in an >>> org.apache.axis2.receivers.RawXMLINOutMessageReceiver. >>> But that's not the way to implement web services in these days. >>> Basically, as AXIS is designed, we should be able to use databinding, as >>> soon as we get the JSON stuff properly converted in to XML. >>> This seams not to be the case at the moment (namespace mismatch) >>> >>> So i though about writing a wrapper around my generated skeleton and >>> adding the correct namespaces myself, based on the prefixes used in the >>> mapped JSON. >>> >>> Now it is where i get confused. >>> In the documentation is mentioned to us a full stop "." to separate >>> namespace-pefix from element name. >>> http://axis.apache.org/axis2/java/core/docs/json_support.html >>> When i look at the code, I see, that there a colon ":" is expected to >>> separate the prefix from the element name. >>> See org.apache.axis2.json.AbstractJSONOMBuilder line 116 to 143 >>> >>> When I use a full stop "." I get an error, that the method is not found >>> (Axis is looking for the howl thing, prefix and element name) >>> When I use a colon ":" I get the an error in the data binding (this is ok, >>> because of the mismatching namespace issue and when i get the prefixed >>> matched to the correct namespaces this should be solved.) >>> >>> Before I try to work around the mismatching namespace issue I really would >>> like to know, >>> how this is supposed to work with prefix, how prefix and element-name are >>> separated, what prefixes are used for and what axis does with them. >>> >>> Thanks for your help and best regards >>> Matthias >>> >>> >>> >>> -- >>> Shameera Rathnayaka >>> Undergraduate >>> Department of Computer Science and Engineering >>> University of Moratuwa. >>> Sri Lanka. >>> >>> Blog : http://shameerarathnayaka.blogspot.com/ >>> >> >> >> >> -- >> Shameera Rathnayaka >> Undergraduate >> Department of Computer Science and Engineering >> University of Moratuwa. >> Sri Lanka. >> >> Blog : http://shameerarathnayaka.blogspot.com/ >> --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org