Re: JSON - Badgerfish
Keith, I used your information, I tried to change the WSDL from qualified to elementFormDefault="unqualified", but still having the same problems. Hence, I started digging on the problem. Note: I am on Axis2 1.4.1 Here is what I uncovered... and I think I found few things in the "JSONBadgerfishMessageFormatter". Basically, I interrogated the actual message, which should be post MessageFormatters. Problem #1: If my message uses the same NameSpace name for the operations and the complex type... the message looks like the following {"ns:converttemp_XML_Dan":{"@xmlns":{"ns":"http:\/\/converttemp.wsbeans.iseries \/xsd"},"ns:param0":{"$":"34"}}} and fails with the following exception: javax.xml.stream.XMLStreamException: Invalid prefix ns on element ns:param0 at org.codehaus.jettison.badgerfish.BadgerFishConvention.createQName (BadgerFishConvention.java:76) at org.codehaus.jettison.Node.(Node.java:50) at org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader.processKey (BadgerFishXMLStreamReader.java:100) at org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader.processElement (BadgerFishXMLStreamReader.java:87) at org.codehaus.jettison.badgerfish.BadgerFishXMLStreamReader.next (BadgerFishXMLStreamReader.java:67) at org.apache.axis2.json.JSONDataSource.serialize (JSONDataSource.java:104) at org.apache.axiom.om.impl.llom.OMSourcedElementImpl.toStringWithConsume (OMSourcedElementImpl.java:545) at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass (RPCUtil.java:124) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:102) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic (AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive (AbstractMessageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest (HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.HTTPWorker.service (HTTPWorker.java:278) at org.apache.axis2.transport.http.server.AxisHttpService.doService (AxisHttpService.java:281) at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest (AxisHttpService.java:187) at org.apache.axis2.transport.http.server.HttpServiceProcessor.run (HttpServiceProcessor.java:82) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor $Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:595) Workaround: Give the namespaces different names: {"ns:converttemp_XML_Dan":{"@xmlns":{"ns":"http:\/\/converttemp.wsbeans.iseries \/xsd"},"tns:param0":{"@xmlns":{"tns":"http:\/\/converttemp.wsbeans.iseries \/xsd"},"$":"34"}}} Problem #2 Occurs after the above workaround: BTW...the above work-around works with text/xml Identical Working Standard MessageType = text/xml - This is basic methodElement.toStringWithConsume() http://converttemp.wsbeans.iseries/xsd";> http://converttemp.wsbeans.iseries/xsd";>34 Identical Non-Working Badgerfish MessageType = application/json/badgerfish This is basic methodElement.toStringWithConsume() http://converttemp.wsbeans.iseries/xsd";> http://converttemp.wsbeans.iseries/xsd";>34 My XML heading in my XML documents: I notice the ' verses " and that is unique, so potentially a problem. Otherwise I believe the problem, might actually be just removeing the XML declaration entirely from the message. Thoughts?? I will can test further on Monday. Daniel Hiebert |> | From: | |> >--| |"keith chapman" | >--| |> | To:| |> >--| |axis-user@ws.apache.org | >-
Re: JSON - Badgerfish
This link [1] contains an example of where I've used the WSO2 Mashup Server [2] which runs on top of Axis2 to invoke a mashup using JSON. Something Notable here is that the service that I'm invoking has elementFormDefault="unqualified". Thanks, Keith. [1] http://www.keith-chapman.org/2008/09/invoking-mashups-using-json.html [2] http://wso2.org/projects/mashup On Wed, Dec 3, 2008 at 3:46 AM, Daniel Hiebert <[EMAIL PROTECTED]> wrote: > > History: > Historically we support SOAP messages which has the standard format for > exchange of Web services messages. I am attempting to support JSON > badgerfish messages with Axis2, since most all our messages have > namespaces. I downloaded the latest Axis2 1.4.1 and followed the > instructions to setup Axis2 1.4.1 with JSON, the best information I could > find was at http://wso2.org/library/768. I updated an axis2.xml for > client and and read in an updated axis2.xml with message formatter and > message builders supporting badgerfish applications. > > Problem Description: > I run the SOAP message and it appears to complete successfully. I switch > from SOAP to JSON Badgerfish and it appears the message is getting > formatted correctly on the HTTP Request, but I get a SOAP fault an > exception on the Server side. > > Message: > [ERROR] Exception occurred while trying to invoke service method > converttemp_XML_Dan > org.apache.axis2.AxisFault: namespace mismatch require > http://converttemp.wsbeans.iseries/xsd found > > I have tried every configuration, removing and adding namespaces, and > endpoints. So I even attempted on Axis2 1.4, 1.3 and get the same error, > so I am assuming I am missing something in either the configuration or in > the composition of my JSON badgerfish message. > > Any help would be greatly appreciated. If this is not enough information, > I can enable tracing and get all messages. > > > Soap Setting: > options.setProperty(Constants.Configuration.MESSAGE_TYPE, "text/xml"); > > TCPMON Soap Message Request (Working) > POST /axis2/services/ConvertTempJava.ConvertTempJavaHttpSoap11Endpoint/ > HTTP/1.1 > Content-Type: text/xml; charset=UTF-8 > SOAPAction: "urn:anonOutInOp" > User-Agent: Axis2 > Host: optimus:9099 > Transfer-Encoding: chunked > > 11e > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ > "> > xmlns:ns="http://converttemp.wsbeans.iseries/xsd > ">34 > 0 > > TCPMON Soap Message Response (Working): > HTTP/1.1 200 OK > Date: Tue, 02 Dec 2008 21:43:23 GMT > Server: Simple-Server/1.1 > Transfer-Encoding: chunked > Content-Type: text/xml; charset=UTF-8 > > 198 > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/ > "> xmlns:ns="http://converttemp.wsbeans.iseries/xsd";><?xml > version="1.0" encoding="UTF-8"?> > <CONVERTTEMP> > <TEMPOUT>7.7</TEMPOUT> > </CONVERTTEMP> > > > 0 > > JSON Badgerfish Setting: > options.setProperty(Constants.Configuration.MESSAGE_TYPE, > "application/json/badgerfish"); > > TCPMON JSON Message Request > POST /axis2/services/ConvertTempJava.ConvertTempJavaHttpSoap11Endpoint/ > HTTP/1.1 > Content-Type: application/json/badgerfish; charset=UTF-8 > User-Agent: Axis2 > Host: optimus:9099 > Transfer-Encoding: chunked > > 6f > > {"ns:converttemp_XML_Dan":{"@xmlns":{"ns":"http:\/\/converttemp.wsbeans.iseries > \/xsd"},"ns:param0":{"$":"34"}}} > 0 > > TCPMON JSON Message Response > HTTP/1.1 500 namespace mismatch require > http://converttemp.wsbeans.iseries/xsd found > Date: Tue, 02 Dec 2008 21:58:34 GMT > Server: Simple-Server/1.1 > Transfer-Encoding: chunked > Content-Type: application/json/badgerfish; charset=UTF-8 > > 10b > {"Fault":{"$":" \/soap\/envelope\/\">soapenv:Server< > \/faultcode>namespace mismatch require > http:\/\/converttemp.wsbeans.iseries\/xsd found <\/faultstring>< > \/soapenv:Fault>"}} > 0 > > Exception in Server log File: > [ERROR] Exception occurred while trying to invoke service method > converttemp_XML_Dan > org.apache.axis2.AxisFault: namespace mismatch require > http://converttemp.wsbeans.iseries/xsd found >at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass > (RPCUtil.java:177) >at > org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic > (RPCMessageReceiver.java:102) >at > org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic > (AbstractInOutMessageReceiver.java:40) >
JSON - Badgerfish
History: Historically we support SOAP messages which has the standard format for exchange of Web services messages. I am attempting to support JSON badgerfish messages with Axis2, since most all our messages have namespaces. I downloaded the latest Axis2 1.4.1 and followed the instructions to setup Axis2 1.4.1 with JSON, the best information I could find was at http://wso2.org/library/768. I updated an axis2.xml for client and and read in an updated axis2.xml with message formatter and message builders supporting badgerfish applications. Problem Description: I run the SOAP message and it appears to complete successfully. I switch from SOAP to JSON Badgerfish and it appears the message is getting formatted correctly on the HTTP Request, but I get a SOAP fault an exception on the Server side. Message: [ERROR] Exception occurred while trying to invoke service method converttemp_XML_Dan org.apache.axis2.AxisFault: namespace mismatch require http://converttemp.wsbeans.iseries/xsd found I have tried every configuration, removing and adding namespaces, and endpoints. So I even attempted on Axis2 1.4, 1.3 and get the same error, so I am assuming I am missing something in either the configuration or in the composition of my JSON badgerfish message. Any help would be greatly appreciated. If this is not enough information, I can enable tracing and get all messages. Soap Setting: options.setProperty(Constants.Configuration.MESSAGE_TYPE, "text/xml"); TCPMON Soap Message Request (Working) POST /axis2/services/ConvertTempJava.ConvertTempJavaHttpSoap11Endpoint/ HTTP/1.1 Content-Type: text/xml; charset=UTF-8 SOAPAction: "urn:anonOutInOp" User-Agent: Axis2 Host: optimus:9099 Transfer-Encoding: chunked 11e http://schemas.xmlsoap.org/soap/envelope/";>http://converttemp.wsbeans.iseries/xsd";>34 0 TCPMON Soap Message Response (Working): HTTP/1.1 200 OK Date: Tue, 02 Dec 2008 21:43:23 GMT Server: Simple-Server/1.1 Transfer-Encoding: chunked Content-Type: text/xml; charset=UTF-8 198 http://schemas.xmlsoap.org/soap/envelope/";>http://converttemp.wsbeans.iseries/xsd";><?xml version="1.0" encoding="UTF-8"?> <CONVERTTEMP> <TEMPOUT>7.7</TEMPOUT> </CONVERTTEMP> 0 JSON Badgerfish Setting: options.setProperty(Constants.Configuration.MESSAGE_TYPE, "application/json/badgerfish"); TCPMON JSON Message Request POST /axis2/services/ConvertTempJava.ConvertTempJavaHttpSoap11Endpoint/ HTTP/1.1 Content-Type: application/json/badgerfish; charset=UTF-8 User-Agent: Axis2 Host: optimus:9099 Transfer-Encoding: chunked 6f {"ns:converttemp_XML_Dan":{"@xmlns":{"ns":"http:\/\/converttemp.wsbeans.iseries \/xsd"},"ns:param0":{"$":"34"}}} 0 TCPMON JSON Message Response HTTP/1.1 500 namespace mismatch require http://converttemp.wsbeans.iseries/xsd found Date: Tue, 02 Dec 2008 21:58:34 GMT Server: Simple-Server/1.1 Transfer-Encoding: chunked Content-Type: application/json/badgerfish; charset=UTF-8 10b {"Fault":{"$":"soapenv:Server< \/faultcode>namespace mismatch require http:\/\/converttemp.wsbeans.iseries\/xsd found <\/faultstring>< \/soapenv:Fault>"}} 0 Exception in Server log File: [ERROR] Exception occurred while trying to invoke service method converttemp_XML_Dan org.apache.axis2.AxisFault: namespace mismatch require http://converttemp.wsbeans.iseries/xsd found at org.apache.axis2.rpc.receivers.RPCUtil.invokeServiceClass (RPCUtil.java:177) at org.apache.axis2.rpc.receivers.RPCMessageReceiver.invokeBusinessLogic (RPCMessageReceiver.java:102) at org.apache.axis2.receivers.AbstractInOutMessageReceiver.invokeBusinessLogic (AbstractInOutMessageReceiver.java:40) at org.apache.axis2.receivers.AbstractMessageReceiver.receive (AbstractMessageReceiver.java:100) at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:176) at org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest (HTTPTransportUtils.java:275) at org.apache.axis2.transport.http.HTTPWorker.service (HTTPWorker.java:278) at org.apache.axis2.transport.http.server.AxisHttpService.doService (AxisHttpService.java:281) at org.apache.axis2.transport.http.server.AxisHttpService.handleRequest (AxisHttpService.java:187) at org.apache.axis2.transport.http.server.HttpServiceProcessor.run (HttpServiceProcessor.java:82) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1061) at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor $Worker.run(ThreadPoolExecutor.java:575) at java.lang.Thread.run(Thread.java:595) [ERROR] namespace mismatch require http://converttemp.wsbeans.iseries/xsd found org.apache.axis2.AxisFault: namespace mismatch require http://converttemp.wsbea