Hi Shameera

Thanks for you reply. So far I can follow you.
But what still bugs me is the stuff about prefixes in the code:

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?

And finally, is there a "fundamental" reason why: 
        ?Mapped? formatted JSON with namespaces are not supported in Axis2
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/

Reply via email to