You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Jian Zhen <zh...@gmail.com> on 2007/05/19 23:36:51 UTC

JSON w/ REST

Hi, I was wondering if anyone's got JSON and REST working together.

I would like to send in a REST request and have the response be sent  
in JSON.

I took the version sample and added the following two lines:

--- cut here ---
MessageContext mc = MessageContext.getCurrentMessageContext 
().getOperationContext().getMessageContext 
(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
mc.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/ 
json");
--- cut here ---

What I got back was the following error:

<soapenv:Reason>
<soapenv:Text xml:lang="en-US">
Mapped formatted JSON with namespaces are not supported in Axis2.  
Make sure that your request doesn't include namespaces or use the  
Badgerfish convention
</soapenv:Text>
</soapenv:Reason>

Any idea what might be the problem?

thx

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org


Re: JSON w/ REST

Posted by Thilina Gunarathne <cs...@gmail.com>.
> <soapenv:Reason>
> <soapenv:Text xml:lang="en-US">
> Mapped formatted JSON with namespaces are not supported in Axis2.
> Make sure that your request doesn't include namespaces or use the
> Badgerfish convention
> </soapenv:Text>
> </soapenv:Reason>
Badgerfish & Mapped are two JSON to XML conversion conventions..
Badgerfish supports namespaces while Mapped convention does not
support namespaces.

Please try changing your "application/json" message formatter
specified in the axis2.xml to
JSONBadgerfishMessageFormatter as given below...

        <messageFormatters>
                <messageFormatter contentType="application/json"

class="org.apache.axis2.json.JSONBadgerfishMessageFormatter"/>
                <!-- more message formatters -->
        </messageFormatters>

Thanks,
Thilina

PS: For more information refer to JSON Support for Apache Axis2
(http://wso2.org/library/768)
>
> thx
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>


-- 
Thilina Gunarathne  -  http://www.wso2.com - http://thilinag.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org