Hi, I've recently started looking at using the REST support in Axis2 to invoke my web service instead of the currently used SOAP calls and I have a number of issues I can't work out for myself. Any help with these would be great. I've been using Axis2 version 1.3 (and then also tried 1.4 in the hope my issues would be solved) and tcpmon to monitor the traffic between my test client and my service running locally on tomcat at http://localhost:8080/NicksGigs-war-Axis2/services/GigListingsService. The WSDL is created using java2wsdl and is attached.
I've read in another (old) post here that Axis2 is just a soap stack and any incoming rest style messages are converted into soap messages first so that they can then be processed. Is this still the case? Does this have a performance hit? Is there anything in the documentation about this? I'm using (unwrapped) ADB bindings generated by wsdl2java for my test client, to use the rest style web calls with the bindings is it simply a case of adding the line of code below into my client? options.setProperty(Constants.Configuration.ENABLE_REST, Constants.VALUE_TRUE); I want to clarify this since all the examples I have seen do not use bindings. Is it possible to use both POST and GET when my operation parameters are all simple types? To change between the two transports is it simply a case of options.setProperty(Constants.Configuration.HTTP_METHOD, HTTP_METHOD_GET); Or options.setProperty(Constants.Configuration.HTTP_METHOD, HTTP_METHOD_POST); ? I've found that I can use POST with operations that have parameters but not on those without parameters. For example, a call to getGigsIn("London") using HTTP_POST makes the following successful request: POST /NicksGigs-war-Axis2/services/GigListingsService HTTP/1.1 Content-Type: application/xml; charset=UTF-8 SOAPAction: urn:getGigsIn User-Agent: Axis2 Content-Length: 115 <ns2:getGigsIn xmlns:ns2="http://NicksGigs.nsteel.qis.qualcomm.com"><ns2:param0>London</ns2:param0></ns2:getGigsIn> But a call to getMostActiveArtist() makes the following unsuccessful request: POST /NicksGigs-war-Axis2/services/GigListingsService HTTP/1.1 Content-Type: application/xml; charset=UTF-8 SOAPAction: urn:getMostActiveArtist User-Agent: Axis2 Content-Length: 0 with received error: <faultstring>The endpoint reference (EPR) for the Operation not found is /NicksGigs-war-Axis2/services/GigListingsService and the WSA Action = null</faultstring> Why doesn't this work?? After setting the HTTP_METHOD to HTTP_GET I am unable to make any successful calls to my service. getGigsIn("London") gives: GET /NicksGigs-war-Axis2/services/GigListingsService?param0=London HTTP/1.1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8;action="urn:getGigsIn"; SOAPAction: urn:getGigsIn User-Agent: Axis2 <soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Text xml:lang="en-US">The endpoint reference (EPR) for the Operation not found is /NicksGigs-war-Axis2/services/GigListingsService and the WSA Action = null</soapenv:Text></soapenv:Reason> while getMostActiveArtist() gives: GET /NicksGigs-war-Axis2/services/GigListingsService HTTP/1.1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8;action="urn:getMostActiveArtist"; SOAPAction: urn:getMostActiveArtist User-Agent: Axis2 And the same error response. Shouldn't the bindings be appending the operation name onto the end of the endpoint for me? If I explicitly set the endpoint to http://localhost:8080/NicksGigs-war-Axis2/services/GigListingsService/getGigsIn it makes the following request: GET /NicksGigs-war-Axis2/services/GigListingsService/getGigsIn?param0=London HTTP/1.1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8;action="urn:getGigsIn"; SOAPAction: urn:getGigsIn User-Agent: Axis2 Which still gives an error, but this time: <soapenv:Reason xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Text xml:lang="en-US">Exception occurred while trying to invoke service method getGigsIn</soapenv:Text></soapenv:Reason> If I simply go to http://localhost:8080/NicksGigs-war-Axis2/services/GigListingsService/getGigsIn?city=London in my browser I get the correct response. For me, one of the advantages of the generated bindings is not having to worry about the contents of the WSDL; I shouldn’t have to know that the WSDL says I must specify the "city" parameter in my query string for the getGigsIn operation. Why are my ADB bindings setting "param0" instead? Finally, the documentation specifies that Axis2 determines if an incoming message is REST or SOAP by checking if "the content type is text/xml and if the SOAPAction Header is missing". If you examine the requests the following headers are present for each method. HTTP_GET: Both SOAPAction and "action" in Content-Type HTTP_POST: Just SOAPAction SOAP: Just "action" in Content-Type What is going on here, are these the correct headers? And what is the "SOAPAction Header", is it "SOAPAction" or is it "action" in Content-Type!? I also found that when using POST I can even remove the SOAPAction header but providing I ensure the Content-Type still contains “application/xml” I will still receive the correct (non-soap) response from the service. I’m aware I might be doing something fundamentally wrong on the client side (maybe you can’t use ADB bindings?) to get these results and I’d be very grateful for any responses to any of these questions. Thanks, Nick http://www.nabble.com/file/p19087933/example.wsdl example.wsdl -- View this message in context: http://www.nabble.com/Axis2-REST-client-and-server-questions-%28Data-bindings%2C-Headers%2C-Performance%29-tp19087933p19087933.html Sent from the Axis - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]