Wohhh, i think it's working, after i finish I'll create a small guide to create json + rest + javascript client applications but i need a little help to complete this functionalities. I'd like to use Mapped formater (to parse in client with a single eval method) but i have this errror, Using Badgerfish all work fine but not using Mapped.
2007-10-02 15:25:34,647 [http-8080-1] ERROR org.apache.axis2.transport.http.CommonsHTTPTransportSender - Mapped formatted JSON with namespaces are not supported in Axis2. Make sure that your request doesn't include namespaces or use the Badgerfish convention org.apache.axis2.AxisFault: Mapped formatted JSON with namespaces are not supported in Axis2. Make sure that your request doesn't include namespaces or use the Badgerfish convention Could i remove header from request before send and response? how can i solve this issue? On 10/2/07, keith chapman <[EMAIL PROTECTED]> wrote: > Hi, > > Use this > > MessageContext msgContext = > org.apache.axis2.context.MessageContext.getCurrentMessageContext().getCurrentMessageContext().getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_OUT_VALUE > ); > > The reason is that > org.apache.axis2.context.MessageContext.getCurrentMessageContext().getCurrentMessageContext() > gives you the request messageContext but what you want is the response > messageContext. That should work. > > > Thanks, > Keith. > > > On 10/2/07, Lechuza lechuza <[EMAIL PROTECTED]> wrote: > > Keith, > > I'm a neebie using axis2, i dont have an context created i > > only create a pojo object and return a object. > > I've modified the message bulder and messageformater section > > but i want to force my POJO to return a json string. > > I've added this lines into my pojo service but did't work. > > > > MessageContext msgContext = > > > org.apache.axis2.context.MessageContext.getCurrentMessageContext(); > > > msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE > ,"application/json"); > > > > Where i need to add this set property configuration? > > > > > > > > regargs > > lechu > > > > > > > > > > On 10/2/07, keith chapman <[EMAIL PROTECTED] > wrote: > > > Hi, > > > > > > You can do so by setting the following property to application/json, > > > application/json/badgerfish or text/javascript > > > > > > > msgContext.setProperty(Constants.Configuration.MESSAGE_TYPE > , > > > ); > > > > > > also make sure you have the following in your axis2.xml > > > > > > <messageFormatter contentType="application/json" > > > > > > class=" org.apache.axis2.json.JSONMessageFormatter"/> > > > <messageFormatter > > > contentType="application/json/badgerfish" > > > > > > > class="org.apache.axis2.json.JSONBadgerfishMessageFormatter > "/> > > > <messageFormatter contentType="text/javascript" > > > > > > class="org.apache.axis2.json.JSONMessageFormatter"/> > > > > > > in the messageFoematters section and > > > > > > <messageBuilder contentType="application/json" > > > class=" > > > org.apache.axis2.json.JSONOMBuilder"/> > > > <messageBuilder > > > contentType="application/json/badgerfish" > > > > > > class="org.apache.axis2.json.JSONBadgerfishOMBuilder"/> > > > <messageBuilder contentType="text/javascript" > > > > > > class="org.apache.axis2.json.JSONOMBuilder "/> > > > > > > in the messageBuilders section. > > > > > > You might also wanna take a look at http://wso2.org/library/768 this > article > > > which describes JSON support in axis2 and explains the above > configurations. > > > Hope that you have a happy time trying JSON and Axis2... > > > > > > Thanks, > > > Keith. > > > > > > > > > On 10/2/07, Lechuza lechuza <[EMAIL PROTECTED] > wrote: > > > > > > > > Hi guys, > > > > > > > > I'd like to start using axis2 as a service engine. > > > > > > > > All clients in my structure are javacripts clients, and > > > > the best option could be use REST request and response using JSON > > > > objects? > > > > > > > > I'm using pojo objects in this way: > > > > > > > > public class User { > > > > private HashMap entries = new HashMap(); > > > > public User(){ > > > > } > > > > public void Add( User ){ > > > > this.entries.put (entry.getName(), entry); > > > > } > > > > public User Info(String name){ > > > > return (User) entries.get(name); > > > > } > > > > } > > > > > > > > > > > > > > > > public class User { > > > > private String name = null; > > > > public String getName() { > > > > return name; > > > > } > > > > > > > > public void setName(String name) { > > > > this. name = name; > > > > } > > > > } > > > > > > > > How can i force json response ? > > > > I have added the tags in axis2.xml file. > > > > > > > > regards > > > > Lechu > > > > > > > > > > > > --------------------------------------------------------------------- > > > > To unsubscribe, e-mail: > > > [EMAIL PROTECTED] > > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > -- > > > Keith Chapman > > > WSO2 Inc. > > > Oxygen for Web Services Developers. > > > http://wso2.org/ > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > -- > Keith Chapman > WSO2 Inc. > Oxygen for Web Services Developers. > http://wso2.org/ --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
