Re: Axis2 - REST service GET - input parameters qn.
On trying out the url as http://localhost:8080/axis2/services/ProductService/products/xyz/abc the service method is being invoked, but the input argument is null ; now i've 2 questions: 1. Assuming that xyz and abc are being interpreted correctly, why is the complextype object not getting created with the attribute values populated? 2. If accountType is an optional input parameter, how will the URL be? -- it looks like i need to invoke the URL that exactly matches the whttp:location pattern always, since the http://localhost:8080/axis2/services/ProductService/products/xyz gives StringINdexOutofBounds exception Expecting some responses for this to help me proceed.. strutsAwhile wrote: Hi, I need to create a REST service that will allow users to search a product repository giving the product parameters as input. Going by REST concepts, i defined a method with signature : String getProducts(SearchCriteria criteria) which takes in the criteria and returns the matching products as XML (ie String). SearchCriteria is a javabean that has the product parameters which are all String attributes. After java2wsdl (wv = 2) , it appears like: xs:complexType name=SearchCriteria xs:sequence xs:element minOccurs=0 name=accountType nillable=true type=xs:string/ xs:element minOccurs=0 name=productCode nillable=true type=xs:string/ !--other search criteria here..-- /xs:sequence /xs:complexType The HTTP binding is : wsdl2:binding name=ProductServiceHttpBinding interface=tns:ServiceInterface whttp:methodDefault=GET type=http://www.w3.org/ns/wsdl/http; wsdl2:operation ref=tns:getProducts whttp:location=products/{productCode}/{accountType}/ I expected to invoke the service using the URL http://localhost:8080/axis2/services/ProductService/products?productCode=XYZaccountType=1 but it gives an String index out of range error, When i try using http://localhost:8080/axis2/services/ProductService/products?criteria=1 , it responds but doesn't serve any purpose since i've to pass in the attributes of crtieria (like productCode) rather than criteria itself. Now, is it possible to do such an invocation using GET, and if so how? . I will be using Axis2 ServiceClient to invoke it (not generated stubs), and want to know how a complextype input can be sent ; the sample YahooSearchClient has only a String input. I've been stuck with this problem for almost a week, any inputs that'll help me proceed will be greatly appreciated. Thanks, Joseph -- View this message in context: http://www.nabble.com/Axis2---REST-service-GET---input-parameters-qn.-tp20424414p20472960.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]
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Hi again, I've had a little bit more of a look into my issue with the differing parameter names between my two WSDLs and realised what's happening. My services.xml looks like the following: service name=GigListingsService descriptionNicks Gig Service./description parameter name=ServiceObjectSupplierorg.apache.axis2.extensions.spring.receivers.SpringServletContextObjectSupplier/parameter parameter name=SpringBeanNamegigListingsService/parameter messageReceivers messageReceiver mep=http://www.w3.org/2004/08/wsdl/in-out; class=org.apache.axis2.rpc.receivers.RPCMessageReceiver/ /messageReceivers /service And the Spring context defines the gigListingsService bean as my GigListingsImpl concrete class. So when generating the runtime WSDL at http://service url?wsdl Axis uses the implementation class and is able to extract the correct parameter names for the WSDL. But when I generate the WSDL using Maven's java2wsdl plugin I am specifying the interface class: GigListings, and from what I have read elsewhere it is not possible to extract parameter names from a Java interface (or abstract class for that matter) - this is a Java issue/feature/thing. If I add the ServiceClass parameter to my services.xml and specify it as the GigListings interface then the runtime WSDL also has the incorrect parameter names. It makes a lot more sense to generate a WSDL from the interface rather than the implementation class, one reason being that there may be additional public methods in GigListingsImpl that should not be visible to web service users in the WSDL. This is not made clear in the Axis2 Integration with the Spring Framework documentation. The real problem for me then comes when I try to use REST with GET since the incorrect parameter names are used in the query string as the stub has no idea of the real ones. E.g. the request should be: service url/getGigsIn?city=London but it ends up being: service url/getGigsIn?param0=London which fails with the returned error: Exception occurred while trying to invoke service method getGigsIn When doing REST with POST, the request also uses param0 but this time without any problem. ns2:getGigsIn xmlns:ns2=http://NicksGigs.nsteel.qis.qualcomm.com;ns2:param0London/ns2:param0/ns2:getGigsIn You can in fact substitute param0 for anything you want and it still works. Why is this behaviour different between GET and POST? Is there a solution to my problem? Thanks, Nick Nick Steel wrote: As you can see from my previously attached wsdls (which are generated using Maven java2wsdl) the getGigsIn element has one parameter called param0 so it wouldn't be surprising to find the stub using this parameter name. However, the wsdl generated at runtime by visiting ...NicksGigs-war-Axis2/services/GigListingsService?wsdl ( http://www.nabble.com/file/p19288850/GigListingsService-generated_at_runtime.wsdl GigListingsService-generated_at_runtime.wsdl ) correctly describes the parameter as being called city. As far as I can tell debug is enabled by default when using Maven (http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html) but perhaps it is using a different source to wsdl generated at runtime? The source class being used is an interface, could this be a problem? Since my wsdl is generated by Maven, and then client stubs from that to do testing, during build the idea of having to manually modify the wsdl to change operations to GET/PUT whatever is a little awkward. Is it possible to annotate the Java service class interface used by java2wsdl so that it can automatically detect which http method is needed for an operation? I didn't have any experience with web services before I started using Axis2 a couple of months ago so maybe I am missing something here but it would be handy if in the stubs there was a way to easily change between GET, POST, PUT and DELETE. This would then set all the properties you needed for it to work. Would this be something possible in the future? Nick keith chapman wrote: Hi Nick, Looking through the WSDLs I don't see any reason for the input/output types in the stub to go missing when generated off a WSDL 1.1 doc. I may have to test this to make sure that this is the case though. On the subject of a particular operation not working when invoked via GET. In a previous mail you said that I have now generated the httpbindings using wsdl2java with a version 2.0 wsdl and the operation has been added to the EPR as desired and I can do POST getGigsIn(London), POST getMostActiveArtist() and GET getMostActiveArtist() without any problems which is great. How did you send a GET to getMostActiveArtist()? I assume that you set the httpmethod on the options object of the serviceClient to GET (cause the stub will send a POST by default according to the WSDL). Could you please explain a bit what you did to send that request. I just had a
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Keith, Please find both versions of my wsdl attached. Note that these are the files generated using Maven java2wsdl at buildtime that I then go on to use with Maven wsdl2java to get my client stubs. http://www.nabble.com/file/p19285397/NicksGigs.wsdl NicksGigs.wsdl http://www.nabble.com/file/p19285397/NicksGigsV2.wsdl NicksGigsV2.wsdl Ad you can see my wsdl doesn't contain any inputSerialization fields at all. And the method seems to be POST be default, is this the problem? Nick keith chapman wrote: Hi Nick, See My comments inline On Tue, Sep 2, 2008 at 11:10 PM, Nick Steel [EMAIL PROTECTED] wrote: I have now generated the httpbindings using wsdl2java with a version 2.0 wsdl and the operation has been added to the EPR as desired and I can do POST getGigsIn(London), POST getMostActiveArtist() and GET getMostActiveArtist() without any problems which is great. Cool, thats good news. The headers for both GET and POST are also now the same (see below) which makes a lot more sense to me. Content-Type: application/xml; charset=UTF-8 SOAPAction: I've already opened a JIRA against axis2 for the above. The client should not sent the SOAP action when it is a REST request. Will fix this soon However, when I try to do GET getGigsIn(London) I get the error faultstringunknown/faultstring. The request according to TCPmon is: GET /NicksGigs-war-Axis2/services/GigListingsService/NicksGigsServiceV2/getGigsIn HTTP/1.1 Content-Type: application/xml; charset=UTF-8 SOAPAction: User-Agent: Axis2 Host: 10.4.39.241:8089 Something is obviously wrong here. You cannot send a GET using application/xml. A get should always be application/x-www-form-urlencoded. Can yu check your WSDL2 section for this operation please. Does it say what its inputSerialization is? http://10.4.39.241:8089 The operation is there in the URL but the parameter London is not so it's obviously not going to work. I was expecting something more like GET /NicksGigs-war-Axis2/services/GigListingsService/NicksGigsServiceV2/getGigsIn?city=London HTTP/1.1 Whats going wrong here? Just answered above ;). Also, just to see what would happen, I tried to make some httpbindings using a version 1.1 wsdl but the generated stub had methods like void getGigsIn() and void getMostActiveArtist() which don't take or return any values so I couldn't work out how I could possibly use them. Is this normal or is this the reason you said to use a version 2.0 wsdl?httpBinding. WSDL 2.0 has a much richer That is the reason I recommended you to use that. But ?wsdl should have worked as well, we map the properties of ?wsdl to the ones of ?wsdl2 during code generation. Is it possible for you to share your wsdl and wsdl2 as well. Thanks, Keith. Cheers, Nick keith chapman wrote: On Tue, Sep 2, 2008 at 2:11 AM, Nick Steel [EMAIL PROTECTED] wrote: Keith, I had no idea ?wsdl2 even existed, Axis2 supports both WSDL 1.1 and WSDL 2.0. And the WSDL 2.0 HTTPBinding can describe a REST interface for your service in a nice manner. I've no idea how I managed to miss this but I will hunt for it tomorrow and give it a go. Thanks very much this reply, what you say aout the EPR has definitely cleared some things up for me and hopefully I can now go on to get this to work. Just to be clear though, you say I should generate the client stub for the httpbinding, how exactly do I do this? I thought the stub I already had could handle all the bindings in my wsdl and that setting the portal parameters was what controlled which binding was being used. Is this wrong? When codegeneration is used to generate the server side code its only the portType (or the interface if WSDL 2.0) that we care about when generating code. But when its generating code for the client side we generate it for a particular port and you can specify this by using the -pn option. If a port if not provided it faults to use the first SOAP 1.2 port it finds. You could generate code for all ports too this can be done by using the -ap options. This will generate stubs for all ports in the WSDL. So for example if I take the same RESTSample that I used yesterday this is how I would generate code for its HTTPBinding. wsdl2java.sh -uri http://mooshup.com/services/samples/RESTSample?wsdl2 -pn HTTPEndpoint -wv 2 I use -wv 2 to specify that this is indeed a WSDL 2.0 file. Thanks, Keith. Cheers, Nick keith chapman wrote: Hi Nick, If you want to invoke a service using REST then its better to generate the client stub for the httpBinding (and when doing so I recommend you to use ?wsdl2 instead of ?wsdl). This is what describes the REST interface of the service. This is where it will contain details of the URL the operation is available at hence if this binding is used to invoke the service it will
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Thanks for your speedy reply Keith. I have been using the following code to test today: String epr = http://localhost:8089/NicksGigs-war-Axis2/services/GigListingsService;; portal = new NicksGigsServiceV2Stub(epr); Options options = portal._getServiceClient().getOptions(); options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET); int countResults = getGigsIn(London).length; System.out.println(Found + countResults + results.); After having another look at the generated stub I can see that POST, application/XML and a load of other properties are hard coded in each method. I had originally assumed that axis would have changed the CONTENT_TYPE to the correct one for my chosen HTTP_METHOD further down the line before sending, but (I'm guessing) this doesn't happen in order to remain flexible. I just tried adding options.setProperty(Constants.Configuration.CONTENT_TYPE,application/x-www-form-urlencoded); to my code which now appends the parameter (great!) but I'm back to one of my original problems in that it's using param0 instead of city in the query string. The request is below. GET /NicksGigs-war-Axis2/services/GigListingsService/getGigsIn?param0=London HTTP/1.1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 SOAPAction: User-Agent: Axis2 Host: localhost:8089 As you can see from my previously attached wsdls (which are generated using Maven java2wsdl) the getGigsIn element has one parameter called param0 so it wouldn't be surprising to find the stub using this parameter name. However, the wsdl generated at runtime by visiting ...NicksGigs-war-Axis2/services/GigListingsService?wsdl ( http://www.nabble.com/file/p19288850/GigListingsService-generated_at_runtime.wsdl GigListingsService-generated_at_runtime.wsdl ) correctly describes the parameter as being called city. As far as I can tell debug is enabled by default when using Maven (http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html) but perhaps it is using a different source to wsdl generated at runtime? The source class being used is an interface, could this be a problem? Since my wsdl is generated by Maven, and then client stubs from that to do testing, during build the idea of having to manually modify the wsdl to change operations to GET/PUT whatever is a little awkward. Is it possible to annotate the Java service class interface used by java2wsdl so that it can automatically detect which http method is needed for an operation? I didn't have any experience with web services before I started using Axis2 a couple of months ago so maybe I am missing something here but it would be handy if in the stubs there was a way to easily change between GET, POST, PUT and DELETE. This would then set all the properties you needed for it to work. Would this be something possible in the future? Nick keith chapman wrote: Hi Nick, Looking through the WSDLs I don't see any reason for the input/output types in the stub to go missing when generated off a WSDL 1.1 doc. I may have to test this to make sure that this is the case though. On the subject of a particular operation not working when invoked via GET. In a previous mail you said that I have now generated the httpbindings using wsdl2java with a version 2.0 wsdl and the operation has been added to the EPR as desired and I can do POST getGigsIn(London), POST getMostActiveArtist() and GET getMostActiveArtist() without any problems which is great. How did you send a GET to getMostActiveArtist()? I assume that you set the httpmethod on the options object of the serviceClient to GET (cause the stub will send a POST by default according to the WSDL). Could you please explain a bit what you did to send that request. I just had a look at the code and when its a GET or a DELETE we use the application/x-www-form-urlencoded as the content-type. (BTW which version of axis2 did u use?) The default WSDL generated by axis2 will have all operations exposed over POST with the inputSerialization of application/XML. If you need to change this (expose some operations over GET) you may do so by hand editing the generated WSDL and using that. This may be better cause you choose which method you want to expose your operations under. Thanks, Keith. On Wed, Sep 3, 2008 at 2:28 PM, Nick Steel [EMAIL PROTECTED]wrote: Keith, Please find both versions of my wsdl attached. Note that these are the files generated using Maven java2wsdl at buildtime that I then go on to use with Maven wsdl2java to get my client stubs. http://www.nabble.com/file/p19285397/NicksGigs.wsdl NicksGigs.wsdl http://www.nabble.com/file/p19285397/NicksGigsV2.wsdl NicksGigsV2.wsdl Ad you can see my wsdl doesn't contain any inputSerialization fields at all. And the method seems to be POST be default, is this the problem? Nick keith chapman wrote: Hi Nick, See My comments inline On Tue, Sep 2, 2008 at
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Great OK that is all clear now. I'd just like to correct my code I posted before since I set the CONTENT_TYPE property instead of the MESSAGE_TYPE property and the former doesn't work as required (in fact I don't know what it actually does since they both set the Content-Type header but only MESSAGE-TYPE appends the parameters). My (very nearly completely) working REST code is String epr = http://localhost:8089/NicksGigs-war-Axis2/services/GigListingsService;; NicksGigsServiceV2Stub portal = new NicksGigsServiceV2Stub(epr); Options options = portal._getServiceClient().getOptions(); // GET options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET); options.setProperty(Constants.Configuration.MESSAGE_TYPE,application/x-www-form-urlencoded); portal.getMostActiveArtist(); portal.getGigsIn(London); // Only this operation now fails due to wrong param name in querystring // POST options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_POST); options.setProperty(Constants.Configuration.MESSAGE_TYPE,application/xml); portal.getMostActiveArtist(); portal.getGigsIn(London); I would not have worked any of this out for myself and it might be good to put something about using wsdl version 2.0 and httpbindings when using databindings in the documentation for other newbies to find. There is a bit more to using REST and changing between GET and POST than people might first expect. Many thanks, Nick keith chapman wrote: Hi Nick, See my comments inline On Wed, Sep 3, 2008 at 6:38 PM, Nick Steel [EMAIL PROTECTED]wrote: Thanks for your speedy reply Keith. I have been using the following code to test today: String epr = http://localhost:8089/NicksGigs-war-Axis2/services/GigListingsService;; portal = new NicksGigsServiceV2Stub(epr); Options options = portal._getServiceClient().getOptions(); options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET); int countResults = getGigsIn(London).length; System.out.println(Found + countResults + results.); After having another look at the generated stub I can see that POST, application/XML and a load of other properties are hard coded in each method. The stub is generated off the WSDL and the WSDL states which httpMethod and which content-type an operation is exposed under. Hence when the stub is generated these details are hard coded into the stub. I had originally assumed that axis would have changed the CONTENT_TYPE to the correct one for my chosen HTTP_METHOD further down the line before sending, but (I'm guessing) this doesn't happen in order to remain flexible. Yes, This is how the message formatting logic works. We check weather the MESSAGE_TYPE property is set and if it is set we use that as the content-type. If we fail to find the above property we use defaulting rules and the default for a GET is application/x-www-form-urlencoded. So if you wanna change the method you better change the MESSAGE_TYPE too. I just tried adding options.setProperty(Constants.Configuration.CONTENT_TYPE,application/x-www-form-urlencoded); to my code which now appends the parameter (great!) but I'm back to one of my original problems in that it's using param0 instead of city in the query string. The request is below. GET /NicksGigs-war-Axis2/services/GigListingsService/getGigsIn?param0=London HTTP/1.1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 SOAPAction: User-Agent: Axis2 Host: localhost:8089 As you can see from my previously attached wsdls (which are generated using Maven java2wsdl) the getGigsIn element has one parameter called param0 so it wouldn't be surprising to find the stub using this parameter name. However, the wsdl generated at runtime by visiting ...NicksGigs-war-Axis2/services/GigListingsService?wsdl ( http://www.nabble.com/file/p19288850/GigListingsService-generated_at_runtime.wsdl GigListingsService-generated_at_runtime.wsdlhttp://www.nabble.com/file/p19288850/GigListingsService-generated_at_runtime.wsdlGigListingsService-generated_at_runtime.wsdl) correctly describes the parameter as being called city. As far as I can tell debug is enabled by default when using Maven (http://maven.apache.org/plugins/maven-compiler-plugin/compile-mojo.html) but perhaps it is using a different source to wsdl generated at runtime? The source class being used is an interface, could this be a problem? Strange. I'll try to have a look into this issue tomorrow. Since my wsdl is generated by Maven, and then client stubs from that to do testing, during build the idea of having to manually modify the wsdl to change operations to GET/PUT whatever is a little awkward. Is it possible to annotate the Java service class interface used by java2wsdl so that it can automatically detect which http method is needed for an operation? This is on my todo
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
I have now generated the httpbindings using wsdl2java with a version 2.0 wsdl and the operation has been added to the EPR as desired and I can do POST getGigsIn(London), POST getMostActiveArtist() and GET getMostActiveArtist() without any problems which is great. The headers for both GET and POST are also now the same (see below) which makes a lot more sense to me. Content-Type: application/xml; charset=UTF-8 SOAPAction: However, when I try to do GET getGigsIn(London) I get the error faultstringunknown/faultstring. The request according to TCPmon is: GET /NicksGigs-war-Axis2/services/GigListingsService/NicksGigsServiceV2/getGigsIn HTTP/1.1 Content-Type: application/xml; charset=UTF-8 SOAPAction: User-Agent: Axis2 Host: 10.4.39.241:8089 The operation is there in the URL but the parameter London is not so it's obviously not going to work. I was expecting something more like GET /NicksGigs-war-Axis2/services/GigListingsService/NicksGigsServiceV2/getGigsIn?city=London HTTP/1.1 Whats going wrong here? Also, just to see what would happen, I tried to make some httpbindings using a version 1.1 wsdl but the generated stub had methods like void getGigsIn() and void getMostActiveArtist() which don't take or return any values so I couldn't work out how I could possibly use them. Is this normal or is this the reason you said to use a version 2.0 wsdl? Cheers, Nick keith chapman wrote: On Tue, Sep 2, 2008 at 2:11 AM, Nick Steel [EMAIL PROTECTED] wrote: Keith, I had no idea ?wsdl2 even existed, Axis2 supports both WSDL 1.1 and WSDL 2.0. And the WSDL 2.0 HTTPBinding can describe a REST interface for your service in a nice manner. I've no idea how I managed to miss this but I will hunt for it tomorrow and give it a go. Thanks very much this reply, what you say aout the EPR has definitely cleared some things up for me and hopefully I can now go on to get this to work. Just to be clear though, you say I should generate the client stub for the httpbinding, how exactly do I do this? I thought the stub I already had could handle all the bindings in my wsdl and that setting the portal parameters was what controlled which binding was being used. Is this wrong? When codegeneration is used to generate the server side code its only the portType (or the interface if WSDL 2.0) that we care about when generating code. But when its generating code for the client side we generate it for a particular port and you can specify this by using the -pn option. If a port if not provided it faults to use the first SOAP 1.2 port it finds. You could generate code for all ports too this can be done by using the -ap options. This will generate stubs for all ports in the WSDL. So for example if I take the same RESTSample that I used yesterday this is how I would generate code for its HTTPBinding. wsdl2java.sh -uri http://mooshup.com/services/samples/RESTSample?wsdl2 -pn HTTPEndpoint -wv 2 I use -wv 2 to specify that this is indeed a WSDL 2.0 file. Thanks, Keith. Cheers, Nick keith chapman wrote: Hi Nick, If you want to invoke a service using REST then its better to generate the client stub for the httpBinding (and when doing so I recommend you to use ?wsdl2 instead of ?wsdl). This is what describes the REST interface of the service. This is where it will contain details of the URL the operation is available at hence if this binding is used to invoke the service it will automatically add the operation name to the end of the EPR. This does not happen for the SOAP bindings though. This is the reason for the behavior you observed below. In the request you have sent below does not contain enough information to dispatch it to the correct operation of the service. If you had the operation name at the end of it it would have worked. And BTW when you are using service client directly it will not append the operation name to the EPR. Note that you have to configure the ServiceClient your self when using this. (This is not the case for stubs generated for the httpBinding though). On Mon, Sep 1, 2008 at 9:07 PM, Nick Steel [EMAIL PROTECTED] wrote: Thank you Jay and Keith for your replies. I've upgraded to version 1.4.1 but this had made no difference. Below is a really simple version of my code taking the options used by Jay in his working service but I can still only get the correct response using getGigsIn() with POST, every other combination else fails with: soapenv:Reason xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope; soapenv:Text xml:lang=en-USThe endpoint reference (EPR) for the Operation not found is /NicksGigs-war-Axis2/services/GigListingsService and the WSA Action = null/soapenv:Text/soapenv:Reason SimpleREST.java: String epr = http://localhost:8089/NicksGigs-war-Axis2/services/GigListingsService;; NicksGigsServiceStub portal = new NicksGigsServiceStub(epr); Options options = portal._getServiceClient().getOptions();
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Hi Nick, See My comments inline On Tue, Sep 2, 2008 at 11:10 PM, Nick Steel [EMAIL PROTECTED] wrote: I have now generated the httpbindings using wsdl2java with a version 2.0 wsdl and the operation has been added to the EPR as desired and I can do POST getGigsIn(London), POST getMostActiveArtist() and GET getMostActiveArtist() without any problems which is great. Cool, thats good news. The headers for both GET and POST are also now the same (see below) which makes a lot more sense to me. Content-Type: application/xml; charset=UTF-8 SOAPAction: I've already opened a JIRA against axis2 for the above. The client should not sent the SOAP action when it is a REST request. Will fix this soon However, when I try to do GET getGigsIn(London) I get the error faultstringunknown/faultstring. The request according to TCPmon is: GET /NicksGigs-war-Axis2/services/GigListingsService/NicksGigsServiceV2/getGigsIn HTTP/1.1 Content-Type: application/xml; charset=UTF-8 SOAPAction: User-Agent: Axis2 Host: 10.4.39.241:8089 Something is obviously wrong here. You cannot send a GET using application/xml. A get should always be application/x-www-form-urlencoded. Can yu check your WSDL2 section for this operation please. Does it say what its inputSerialization is? http://10.4.39.241:8089 The operation is there in the URL but the parameter London is not so it's obviously not going to work. I was expecting something more like GET /NicksGigs-war-Axis2/services/GigListingsService/NicksGigsServiceV2/getGigsIn?city=London HTTP/1.1 Whats going wrong here? Just answered above ;). Also, just to see what would happen, I tried to make some httpbindings using a version 1.1 wsdl but the generated stub had methods like void getGigsIn() and void getMostActiveArtist() which don't take or return any values so I couldn't work out how I could possibly use them. Is this normal or is this the reason you said to use a version 2.0 wsdl?httpBinding. WSDL 2.0 has a much richer That is the reason I recommended you to use that. But ?wsdl should have worked as well, we map the properties of ?wsdl to the ones of ?wsdl2 during code generation. Is it possible for you to share your wsdl and wsdl2 as well. Thanks, Keith. Cheers, Nick keith chapman wrote: On Tue, Sep 2, 2008 at 2:11 AM, Nick Steel [EMAIL PROTECTED] wrote: Keith, I had no idea ?wsdl2 even existed, Axis2 supports both WSDL 1.1 and WSDL 2.0. And the WSDL 2.0 HTTPBinding can describe a REST interface for your service in a nice manner. I've no idea how I managed to miss this but I will hunt for it tomorrow and give it a go. Thanks very much this reply, what you say aout the EPR has definitely cleared some things up for me and hopefully I can now go on to get this to work. Just to be clear though, you say I should generate the client stub for the httpbinding, how exactly do I do this? I thought the stub I already had could handle all the bindings in my wsdl and that setting the portal parameters was what controlled which binding was being used. Is this wrong? When codegeneration is used to generate the server side code its only the portType (or the interface if WSDL 2.0) that we care about when generating code. But when its generating code for the client side we generate it for a particular port and you can specify this by using the -pn option. If a port if not provided it faults to use the first SOAP 1.2 port it finds. You could generate code for all ports too this can be done by using the -ap options. This will generate stubs for all ports in the WSDL. So for example if I take the same RESTSample that I used yesterday this is how I would generate code for its HTTPBinding. wsdl2java.sh -uri http://mooshup.com/services/samples/RESTSample?wsdl2 -pn HTTPEndpoint -wv 2 I use -wv 2 to specify that this is indeed a WSDL 2.0 file. Thanks, Keith. Cheers, Nick keith chapman wrote: Hi Nick, If you want to invoke a service using REST then its better to generate the client stub for the httpBinding (and when doing so I recommend you to use ?wsdl2 instead of ?wsdl). This is what describes the REST interface of the service. This is where it will contain details of the URL the operation is available at hence if this binding is used to invoke the service it will automatically add the operation name to the end of the EPR. This does not happen for the SOAP bindings though. This is the reason for the behavior you observed below. In the request you have sent below does not contain enough information to dispatch it to the correct operation of the service. If you had the operation name at the end of it it would have worked. And BTW when you are using service client directly it will not append the operation name to the EPR. Note that you have to configure the ServiceClient your self when using this. (This is not the case
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Hi Nick, Sorry I couldn't get back to you sooner. Was held up with some travel last week. So here goes, see my comments inline. (As a summary could you try this with 1.4.1 as I did fix some REST bugs for this release) On Thu, Aug 21, 2008 at 6:12 PM, Nick Steel [EMAIL PROTECTED] wrote: 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? Yes. Axis2 is primarily a SOAP engine and hence once a message gets into axis2 it has a SOAP message. So when Axis2 receives a REST message we do create a SOAP message out of it. 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); ? Yes you could set the HTTP Method you need as explained above. Axis2 also supports PUT and DELETE. 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:param0London/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: faultstringThe 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-USThe 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-USException 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. The above should work for you correctly with codegenerated stubs. Can you try this with Axis2 -1.4.1 please. I fixed some bugs on REST invocation for this release
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Thank you Jay and Keith for your replies. I've upgraded to version 1.4.1 but this had made no difference. Below is a really simple version of my code taking the options used by Jay in his working service but I can still only get the correct response using getGigsIn() with POST, every other combination else fails with: soapenv:Reason xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope; soapenv:Text xml:lang=en-USThe endpoint reference (EPR) for the Operation not found is /NicksGigs-war-Axis2/services/GigListingsService and the WSA Action = null/soapenv:Text/soapenv:Reason SimpleREST.java: String epr = http://localhost:8089/NicksGigs-war-Axis2/services/GigListingsService;; NicksGigsServiceStub portal = new NicksGigsServiceStub(epr); Options options = portal._getServiceClient().getOptions(); options.setProperty(Constants.Configuration.ENABLE_REST, Boolean.TRUE); options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_POST); options.setProperty(Constants.Configuration.MESSAGE_TYPE, //org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM); //options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Constants.VALUE_TRUE); options.setCallTransportCleanup(true); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); portal._getServiceClient().setOptions(options); Gig[] results = portal.getGigsIn(London); for (int j = 0; j results.length; j++) System.out.println(results[j].getToString()); Note that I had to comment out the MESSAGE_TYPE property for this to work. I have also commented out the SOAP_ACTION property here since although it did remove the action(s) in the header it didn't make any difference to the end result. The thing which strikes me most about this is that whether using GET or POST the bindings do not append the method names to the endpoint like I would expect them to. I wrongly assumed that at some point the axis generated code would do something like endpoint+/+methodName but it doesn't seem to... Is this correct behaviour? I took a look at the blog entry and after a closer look at my WSDL it seems that the one generated at ...NicksGigs-war-Axis2/services/GigListingsService?wsdl has the correct parameter names, but the wsdl generated by the maven java2wsdl plugin and then subsequently used by wsdl2java to create my stub has the param0, param1 names. Maven automatically compiles with debug on and I've made no changes to this so I am a bit confused why I'm getting this. Even more so by the fact that if I create unwrapped bindings then the correct parameter names are used. Thanks Nick keith chapman wrote: Hi Nick, Sorry I couldn't get back to you sooner. Was held up with some travel last week. So here goes, see my comments inline. (As a summary could you try this with 1.4.1 as I did fix some REST bugs for this release) On Thu, Aug 21, 2008 at 6:12 PM, Nick Steel [EMAIL PROTECTED] wrote: 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? Yes. Axis2 is primarily a SOAP engine and hence once a message gets into axis2 it has a SOAP message. So when Axis2 receives a REST message we do create a SOAP message out of it. 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); ? Yes you could set the HTTP Method you need as explained above. Axis2 also supports PUT and DELETE. 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
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Hi Nick, If you want to invoke a service using REST then its better to generate the client stub for the httpBinding (and when doing so I recommend you to use ?wsdl2 instead of ?wsdl). This is what describes the REST interface of the service. This is where it will contain details of the URL the operation is available at hence if this binding is used to invoke the service it will automatically add the operation name to the end of the EPR. This does not happen for the SOAP bindings though. This is the reason for the behavior you observed below. In the request you have sent below does not contain enough information to dispatch it to the correct operation of the service. If you had the operation name at the end of it it would have worked. And BTW when you are using service client directly it will not append the operation name to the EPR. Note that you have to configure the ServiceClient your self when using this. (This is not the case for stubs generated for the httpBinding though). On Mon, Sep 1, 2008 at 9:07 PM, Nick Steel [EMAIL PROTECTED] wrote: Thank you Jay and Keith for your replies. I've upgraded to version 1.4.1 but this had made no difference. Below is a really simple version of my code taking the options used by Jay in his working service but I can still only get the correct response using getGigsIn() with POST, every other combination else fails with: soapenv:Reason xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope; soapenv:Text xml:lang=en-USThe endpoint reference (EPR) for the Operation not found is /NicksGigs-war-Axis2/services/GigListingsService and the WSA Action = null/soapenv:Text/soapenv:Reason SimpleREST.java: String epr = http://localhost:8089/NicksGigs-war-Axis2/services/GigListingsService;; NicksGigsServiceStub portal = new NicksGigsServiceStub(epr); Options options = portal._getServiceClient().getOptions(); options.setProperty(Constants.Configuration.ENABLE_REST, Boolean.TRUE); options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_POST); options.setProperty(Constants.Configuration.MESSAGE_TYPE, //org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM); //options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Constants.VALUE_TRUE); options.setCallTransportCleanup(true); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); portal._getServiceClient().setOptions(options); Gig[] results = portal.getGigsIn(London); for (int j = 0; j results.length; j++) System.out.println(results[j].getToString()); Note that I had to comment out the MESSAGE_TYPE property for this to work. I have also commented out the SOAP_ACTION property here since although it did remove the action(s) in the header it didn't make any difference to the end result. The thing which strikes me most about this is that whether using GET or POST the bindings do not append the method names to the endpoint like I would expect them to. I wrongly assumed that at some point the axis generated code would do something like endpoint+/+methodName but it doesn't seem to... Is this correct behaviour? I took a look at the blog entry and after a closer look at my WSDL it seems that the one generated at ...NicksGigs-war-Axis2/services/GigListingsService?wsdl has the correct parameter names, but the wsdl generated by the maven java2wsdl plugin and then subsequently used by wsdl2java to create my stub has the param0, param1 names. Maven automatically compiles with debug on and I've made no changes to this so I am a bit confused why I'm getting this. Even more so by the fact that if I create unwrapped bindings then the correct parameter names are used. This is strange. I haven't tried this out though (wsdl2java maven plugin). Would give it a try and let you know. Thanks, Keith. Thanks Nick keith chapman wrote: Hi Nick, Sorry I couldn't get back to you sooner. Was held up with some travel last week. So here goes, see my comments inline. (As a summary could you try this with 1.4.1 as I did fix some REST bugs for this release) On Thu, Aug 21, 2008 at 6:12 PM, Nick Steel [EMAIL PROTECTED] wrote: 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? Yes. Axis2 is primarily a
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Keith, I had no idea ?wsdl2 even existed, I've no idea how I managed to miss this but I will hunt for it tomorrow and give it a go. Thanks very much this reply, what you say aout the EPR has definitely cleared some things up for me and hopefully I can now go on to get this to work. Just to be clear though, you say I should generate the client stub for the httpbinding, how exactly do I do this? I thought the stub I already had could handle all the bindings in my wsdl and that setting the portal parameters was what controlled which binding was being used. Is this wrong? Cheers, Nick keith chapman wrote: Hi Nick, If you want to invoke a service using REST then its better to generate the client stub for the httpBinding (and when doing so I recommend you to use ?wsdl2 instead of ?wsdl). This is what describes the REST interface of the service. This is where it will contain details of the URL the operation is available at hence if this binding is used to invoke the service it will automatically add the operation name to the end of the EPR. This does not happen for the SOAP bindings though. This is the reason for the behavior you observed below. In the request you have sent below does not contain enough information to dispatch it to the correct operation of the service. If you had the operation name at the end of it it would have worked. And BTW when you are using service client directly it will not append the operation name to the EPR. Note that you have to configure the ServiceClient your self when using this. (This is not the case for stubs generated for the httpBinding though). On Mon, Sep 1, 2008 at 9:07 PM, Nick Steel [EMAIL PROTECTED] wrote: Thank you Jay and Keith for your replies. I've upgraded to version 1.4.1 but this had made no difference. Below is a really simple version of my code taking the options used by Jay in his working service but I can still only get the correct response using getGigsIn() with POST, every other combination else fails with: soapenv:Reason xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope; soapenv:Text xml:lang=en-USThe endpoint reference (EPR) for the Operation not found is /NicksGigs-war-Axis2/services/GigListingsService and the WSA Action = null/soapenv:Text/soapenv:Reason SimpleREST.java: String epr = http://localhost:8089/NicksGigs-war-Axis2/services/GigListingsService;; NicksGigsServiceStub portal = new NicksGigsServiceStub(epr); Options options = portal._getServiceClient().getOptions(); options.setProperty(Constants.Configuration.ENABLE_REST, Boolean.TRUE); options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_POST); options.setProperty(Constants.Configuration.MESSAGE_TYPE, //org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM); //options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Constants.VALUE_TRUE); options.setCallTransportCleanup(true); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); portal._getServiceClient().setOptions(options); Gig[] results = portal.getGigsIn(London); for (int j = 0; j results.length; j++) System.out.println(results[j].getToString()); Note that I had to comment out the MESSAGE_TYPE property for this to work. I have also commented out the SOAP_ACTION property here since although it did remove the action(s) in the header it didn't make any difference to the end result. The thing which strikes me most about this is that whether using GET or POST the bindings do not append the method names to the endpoint like I would expect them to. I wrongly assumed that at some point the axis generated code would do something like endpoint+/+methodName but it doesn't seem to... Is this correct behaviour? I took a look at the blog entry and after a closer look at my WSDL it seems that the one generated at ...NicksGigs-war-Axis2/services/GigListingsService?wsdl has the correct parameter names, but the wsdl generated by the maven java2wsdl plugin and then subsequently used by wsdl2java to create my stub has the param0, param1 names. Maven automatically compiles with debug on and I've made no changes to this so I am a bit confused why I'm getting this. Even more so by the fact that if I create unwrapped bindings then the correct parameter names are used. This is strange. I haven't tried this out though (wsdl2java maven plugin). Would give it a try and let you know. Thanks, Keith. Thanks Nick keith chapman wrote: Hi Nick, Sorry I couldn't get back to you sooner. Was held up with some travel last week. So here goes, see my comments inline. (As a summary could you try this with 1.4.1 as I did fix some REST bugs for this release) On Thu, Aug 21, 2008 at 6:12 PM, Nick Steel [EMAIL PROTECTED] wrote: 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
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
On Tue, Sep 2, 2008 at 2:11 AM, Nick Steel [EMAIL PROTECTED] wrote: Keith, I had no idea ?wsdl2 even existed, Axis2 supports both WSDL 1.1 and WSDL 2.0. And the WSDL 2.0 HTTPBinding can describe a REST interface for your service in a nice manner. I've no idea how I managed to miss this but I will hunt for it tomorrow and give it a go. Thanks very much this reply, what you say aout the EPR has definitely cleared some things up for me and hopefully I can now go on to get this to work. Just to be clear though, you say I should generate the client stub for the httpbinding, how exactly do I do this? I thought the stub I already had could handle all the bindings in my wsdl and that setting the portal parameters was what controlled which binding was being used. Is this wrong? When codegeneration is used to generate the server side code its only the portType (or the interface if WSDL 2.0) that we care about when generating code. But when its generating code for the client side we generate it for a particular port and you can specify this by using the -pn option. If a port if not provided it faults to use the first SOAP 1.2 port it finds. You could generate code for all ports too this can be done by using the -ap options. This will generate stubs for all ports in the WSDL. So for example if I take the same RESTSample that I used yesterday this is how I would generate code for its HTTPBinding. wsdl2java.sh -uri http://mooshup.com/services/samples/RESTSample?wsdl2 -pn HTTPEndpoint -wv 2 I use -wv 2 to specify that this is indeed a WSDL 2.0 file. Thanks, Keith. Cheers, Nick keith chapman wrote: Hi Nick, If you want to invoke a service using REST then its better to generate the client stub for the httpBinding (and when doing so I recommend you to use ?wsdl2 instead of ?wsdl). This is what describes the REST interface of the service. This is where it will contain details of the URL the operation is available at hence if this binding is used to invoke the service it will automatically add the operation name to the end of the EPR. This does not happen for the SOAP bindings though. This is the reason for the behavior you observed below. In the request you have sent below does not contain enough information to dispatch it to the correct operation of the service. If you had the operation name at the end of it it would have worked. And BTW when you are using service client directly it will not append the operation name to the EPR. Note that you have to configure the ServiceClient your self when using this. (This is not the case for stubs generated for the httpBinding though). On Mon, Sep 1, 2008 at 9:07 PM, Nick Steel [EMAIL PROTECTED] wrote: Thank you Jay and Keith for your replies. I've upgraded to version 1.4.1 but this had made no difference. Below is a really simple version of my code taking the options used by Jay in his working service but I can still only get the correct response using getGigsIn() with POST, every other combination else fails with: soapenv:Reason xmlns:soapenv=http://www.w3.org/2003/05/soap-envelope; soapenv:Text xml:lang=en-USThe endpoint reference (EPR) for the Operation not found is /NicksGigs-war-Axis2/services/GigListingsService and the WSA Action = null/soapenv:Text/soapenv:Reason SimpleREST.java: String epr = http://localhost:8089/NicksGigs-war-Axis2/services/GigListingsService;; NicksGigsServiceStub portal = new NicksGigsServiceStub(epr); Options options = portal._getServiceClient().getOptions(); options.setProperty(Constants.Configuration.ENABLE_REST, Boolean.TRUE); options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_POST); options.setProperty(Constants.Configuration.MESSAGE_TYPE, //org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM); //options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Constants.VALUE_TRUE); options.setCallTransportCleanup(true); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); portal._getServiceClient().setOptions(options); Gig[] results = portal.getGigsIn(London); for (int j = 0; j results.length; j++) System.out.println(results[j].getToString()); Note that I had to comment out the MESSAGE_TYPE property for this to work. I have also commented out the SOAP_ACTION property here since although it did remove the action(s) in the header it didn't make any difference to the end result. The thing which strikes me most about this is that whether using GET or POST the bindings do not append the method names to the endpoint like I would expect them to. I wrongly assumed that at some point the axis generated code would do something like endpoint+/+methodName but it doesn't seem to... Is this correct behaviour? I took a look at the blog entry and after a closer look at my WSDL it seems that the one generated at ...NicksGigs-war-Axis2/services/GigListingsService?wsdl has the correct
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
I havn't been able to progress any further with Axis2 and REST, doesn't anyone have any ideas about these issues? Nick -- View this message in context: http://www.nabble.com/Axis2-REST-client-and-server-questions-%28Data-bindings%2C-Headers%2C-Performance%29-tp19087933p19183617.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]
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Hi Nick, Sorry I missed this. I'll have a look at this and get back to you. Thanks, Keith. On Wed, Aug 27, 2008 at 9:06 PM, Nick Steel [EMAIL PROTECTED] wrote: I havn't been able to progress any further with Axis2 and REST, doesn't anyone have any ideas about these issues? Nick -- View this message in context: http://www.nabble.com/Axis2-REST-client-and-server-questions-%28Data-bindings%2C-Headers%2C-Performance%29-tp19087933p19183617.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] -- Keith Chapman Senior Software Engineer WSO2 Inc. Oxygenating the Web Service Platform. http://wso2.org/ blog: http://www.keith-chapman.org - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2 REST client and server questions (Data bindings, Headers, Performance)
Working with Axis2 and REST differs a little based on whether you are doing POSTs or GETs. I have been using Axis2 for REST as well as SOAP, but I don't use code generated stubs. I am using the ServiceClient to invoke my services. In that context, I set the following Options on the ServiceClient (these depend on GET or POST...GET being the full url with params and the POST being just the url with params sent in the body of the request): Options options = new Options(); options.setProperty(HTTPConstants.SO_TIMEOUT, new Integer(timeout)); options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, new Integer(timeout)); options.setProperty(Constants.Configuration.ENABLE_REST, Boolean.TRUE); options.setProperty(Constants.Configuration.HTTP_METHOD, Constants.Configuration.HTTP_METHOD_GET); options.setProperty(Constants.Configuration.MESSAGE_TYPE, org.apache.axis2.transport.http.HTTPConstants.MEDIA_TYPE_X_WWW_FORM); options.setProperty(Constants.Configuration.DISABLE_SOAP_ACTION, Constants.VALUE_TRUE); options.setCallTransportCleanup(true); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setTo(new EndpointReference(myCustomUrl...based on GET or POST); Then when I call sendReceive on the ServiceClient, my param depends on GET or POST. For GET, the EndpointReference has all the params so you can send a null to the sendReceive. For a POST, you need to send the XML message onto the sendReceive. //POST request parameters are in OMElement mReply=client.sendReceive(myRequest); //GET request parameters were already appended to endpoint URL // in RestServiceClientHandler (parent class) mReply=client.sendReceive(null); This may not answer your questions directly, but I have used this and successfully integrated Axis2 to call Google's Geocoding Service (GET only) and Yahoo's Search Service (GET or POST model). - jay Nick Steel wrote: I havn't been able to progress any further with Axis2 and REST, doesn't anyone have any ideas about these issues? Nick -- View this message in context: http://www.nabble.com/Axis2-REST-client-and-server-questions-%28Data-bindings%2C-Headers%2C-Performance%29-tp19087933p19186773.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]
Re: [Axis2] REST webservice that returns pdf/word document
Theoretically Axis2 MTOM implementation has support for POX+MTOM due to it's tight binding to the XML object model. But I have never tested it nor scene it used. If it works, the message will go inside a MIME package same as in SOAP+MTOM but without the SOAP envelope body elements. But I would recomend you to use full MTOM+SOAP if that is a possibility.. With file caching enabled, Axis2 can handle attachements of virtually any size (memory is not a limitation). thanks, Thilina On Mon, Aug 4, 2008 at 4:34 PM, Chris Richmond [EMAIL PROTECTED]wrote: If you are dealing with more binary than you'd like to load into memory at once, then I would return a url to a (temporary or otherwise depending on you security concerns) file on the server for standard http or ftp download and it is easy for a ws client implemented on any stack to get that. That's what I have done in the past. Sending files from within a ws without using attachments has always been a bit of a workaround from what I have found. If the files you are dealing with CAN be read into memory, then simply serialize to the bytes and send that in the proper field, you could send another response parameter within the complex type that indicates files types, names, etc if you wanted. Chris -- *From:* Pantvaidya, Vishwajit [mailto:[EMAIL PROTECTED] *Sent:* Monday, August 04, 2008 10:17 AM *To:* axis-user@ws.apache.org *Subject:* [Axis2] REST webservice that returns pdf/word document My Axis2 1.3 based webservice is working fine using MTOM attachments and everything else. The default REST (POX) support also works well for the existing webservices. Now I need to add a REST service that returns a pdf/word document. The Axis REST doc says that the GET based REST Web services support only simple types as arguments and it should adhere to the IRI stylehttp://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#_operation_iri_style, which means I cannot have xsd:base64Binary types in my wsdl. Is there anyway I can add this webservice to return the word/pdf doc? - Vish. -- Thilina Gunarathne - http://thilinag.blogspot.com
RE: [Axis2] REST webservice that returns pdf/word document
If you are dealing with more binary than you'd like to load into memory at once, then I would return a url to a (temporary or otherwise depending on you security concerns) file on the server for standard http or ftp download and it is easy for a ws client implemented on any stack to get that. That's what I have done in the past. Sending files from within a ws without using attachments has always been a bit of a workaround from what I have found. If the files you are dealing with CAN be read into memory, then simply serialize to the bytes and send that in the proper field, you could send another response parameter within the complex type that indicates files types, names, etc if you wanted. Chris _ From: Pantvaidya, Vishwajit [mailto:[EMAIL PROTECTED] Sent: Monday, August 04, 2008 10:17 AM To: axis-user@ws.apache.org Subject: [Axis2] REST webservice that returns pdf/word document My Axis2 1.3 based webservice is working fine using MTOM attachments and everything else. The default REST (POX) support also works well for the existing webservices. Now I need to add a REST service that returns a pdf/word document. The Axis REST doc says that the GET based REST Web services support only simple types as arguments and it should adhere to the IRI http://www.w3.org/TR/2006/CR-wsdl20-adjuncts-20060327/#_operation_iri_style style, which means I cannot have xsd:base64Binary types in my wsdl. Is there anyway I can add this webservice to return the word/pdf doc? - Vish.
Re: [axis2] rest question
This is not the case now. text/xml contentType is used for SOAP 1.1 request, the way we figure out whether a request is REST is based on the contentType. Obviously If the HTTPMethod is PUT, GET or DELETE then this is treated as REST automatically. From 1.2 onwards we hace the notion of messageBuilders and Message Formatters who are called upon to build request messages and to format response messages (This mapping is in the axis2 xml). So if the contentType is text/xml then the SOAP builder will take control. If the content Type is application/xml then the ApplicationXMLBuilder (RESP POST style) will take over. The GET is processed by XFormURLEncodedBuilder and so on. These mappings can be changed in your axis2.xml. Thanks, Keith. On 8/11/07, Mark Thompson [EMAIL PROTECTED] wrote: The axis2/1_2/rest.ws.html documentation indicates that if the content type is text/xml and the SOAPAction Header is missing that the message is treated as a restful message. If that is the case should the AxisServlet code be changed to check if the request.getHeader(HTTPConstants.HEADER_SOAP_ACTION) value is not empty in addition to checking if !isRESTRequest(contentTYpe) near the top of the doPost(...) method? - 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/
Re: Axis2 REST invocation problem
can u post the schema for the operation getString please. Thanks, Keith. On 7/11/07, Philipp Leitner [EMAIL PROTECTED] wrote: Hi all, I have a service deployed with Axis2 with a couple of operations in it. As it is default the service has 3 bindings, SOAP1.1, SOAP1.2 and HTTP (REST). Now I am trying to invoke this service using WSDL2java generated stubs. I use java -cp $CP org.apache.axis2.wsdl.WSDL2Java -d xmlbeans -uri http://localhost:8080/axis2/services/DADocTestService?wsdl , i.e. I am using pretty much the default values for WSDL2java, but switched to XMLBeans databinding. When I am invoking the service using the the SOAP1.1 connector everything seems to be working smoothly, but as soon as I try to use the HTTP binding I get the following error: Exception in thread main java.lang.RuntimeException: Data binding error at at.ac.tuwien.infosys.dacoss.eval.doc.DADocTestServiceDADocTestServiceHttpport1Stub.fromOM (DADocTestServiceDADocTestServiceHttpport1Stub.java:4089) at at.ac.tuwien.infosys.dacoss.eval.doc.DADocTestServiceDADocTestServiceHttpport1Stub.getString (DADocTestServiceDADocTestServiceHttpport1Stub.java:2672) at at.ac.tuwien.infosys.dsg.dacoss.eval.v2.Axis2Runner.doRESTStringInvocation (Axis2Runner.java:161) at at.ac.tuwien.infosys.dsg.dacoss.eval.v2.Axis2Runner.main(Axis2Runner.java :50) Looking at the HTTP communications with tcpmon this is not surprising: Request: POST /axis2/rest/DADocTestService/getString HTTP/1.1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 SOAPAction: User-Agent: Axis2 Host: localhost:8081 Transfer-Encoding: chunked f param0=TestTest 0 Response: HTTP/1.1 500 Internal Server Error Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=UTF-8 Transfer-Encoding: chunked Date: Wed, 11 Jul 2007 09:13:44 GMT Connection: close 288 ?xml version='1.0' encoding='UTF-8'?soapenv:Envelope xmlns:wsa=http://www.w3.org/2005/08/addressing; xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/ soapenv:Headerwsa:ReplyTowsa:Address http://www.w3.org/2005/08/addressing/none /wsa:Address/wsa:ReplyTowsa:MessageIDurn:uuid:906A7FD5BF3FB35F451184145224596/wsa:MessageIDwsa:Action http://www.w3.org/2005/08/addressing/soap/fault /wsa:Action/soapenv:Headersoapenv:Bodysoapenv:Faultfaultcode/faultcodefaultstringRequired element null defined in the schema can not be found in the request/faultstringdetail //soapenv:Fault/soapenv:Body/soapenv:Envelope 0 I am using the 1.2 release of Axis2 on client side, and Axis2 1.1.1 on server side. Updating the server to 1.2 is no option currently. Is REST generally not working with a 1.2 client and a 1.1.1 server, or am I doing something wrong here? /philipp - 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/
Re: Axis2 REST invocation problem
Relevant parts of the WSDL attached. Note that the problem is not specific to this operation, but occurs whenever I try to invoke /any/ operation using REST. ... xs:schema attributeFormDefault=qualified elementFormDefault=qualified targetNamespace=http://infosys.tuwien.ac.at/dacoss/eval/doc/; xs:element name=getString xs:complexType xs:sequence xs:element name=param0 nillable=true type=xs:string/ /xs:sequence /xs:complexType /xs:element xs:element name=getStringResponse xs:complexType xs:sequence xs:element name=return nillable=true type=xs:string/ /xs:sequence /xs:complexType /xs:element /xs:schema ... wsdl:message name=getStringMessage wsdl:part name=part1 element=ns0:getString/ /wsdl:message wsdl:message name=getStringResponse wsdl:part name=part1 element=ns0:getStringResponse/ /wsdl:message ... wsdl:operation name=getString soap:operation soapAction=urn:getString style=document/ wsdl:input soap:body use=literal/ /wsdl:input wsdl:output soap:body use=literal/ /wsdl:output /wsdl:operation ... thank you, philipp keith chapman schrieb: can u post the schema for the operation getString please. Thanks, Keith. On 7/11/07, *Philipp Leitner* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: Hi all, I have a service deployed with Axis2 with a couple of operations in it. As it is default the service has 3 bindings, SOAP1.1, SOAP1.2 and HTTP (REST). Now I am trying to invoke this service using WSDL2java generated stubs. I use java -cp $CP org.apache.axis2.wsdl.WSDL2Java -d xmlbeans -uri http://localhost:8080/axis2/services/DADocTestService?wsdl , i.e. I am using pretty much the default values for WSDL2java, but switched to XMLBeans databinding. When I am invoking the service using the the SOAP1.1 connector everything seems to be working smoothly, but as soon as I try to use the HTTP binding I get the following error: Exception in thread main java.lang.RuntimeException: Data binding error at at.ac.tuwien.infosys.dacoss.eval.doc.DADocTestServiceDADocTestServiceHttpport1Stub.fromOM(DADocTestServiceDADocTestServiceHttpport1Stub.java :4089) at at.ac.tuwien.infosys.dacoss.eval.doc.DADocTestServiceDADocTestServiceHttpport1Stub.getString(DADocTestServiceDADocTestServiceHttpport1Stub.java:2672) at at.ac.tuwien.infosys.dsg.dacoss.eval.v2.Axis2Runner.doRESTStringInvocation (Axis2Runner.java:161) at at.ac.tuwien.infosys.dsg.dacoss.eval.v2.Axis2Runner.main(Axis2Runner.java:50) Looking at the HTTP communications with tcpmon this is not surprising: Request: POST /axis2/rest/DADocTestService/getString HTTP/1.1 Content-Type: application/x-www-form-urlencoded; charset=UTF-8 SOAPAction: User-Agent: Axis2 Host: localhost:8081 Transfer-Encoding: chunked f param0=TestTest 0 Response: HTTP/1.1 500 Internal Server Error Server: Apache-Coyote/1.1 Content-Type: text/xml;charset=UTF-8 Transfer-Encoding: chunked Date: Wed, 11 Jul 2007 09:13:44 GMT Connection: close 288 ?xml version=' 1.0' encoding='UTF-8'?soapenv:Envelope xmlns:wsa=http://www.w3.org/2005/08/addressing; xmlns:soapenv= http://schemas.xmlsoap.org/soap/envelope/;soapenv:Headerwsa:ReplyTowsa:Addresshttp://www.w3.org/2005/08/addressing/none/wsa:Address/wsa:ReplyTowsa:MessageIDurn:uuid:906A7FD5BF3FB35F451184145224596/wsa:MessageIDwsa:Action http://www.w3.org/2005/08/addressing/soap/fault/wsa:Action/soapenv:Headersoapenv:Bodysoapenv:Faultfaultcode/faultcodefaultstringRequired element null defined in the schema can not be found in the request/faultstringdetail //soapenv:Fault/soapenv:Body/soapenv:Envelope 0 I am using the 1.2 release of Axis2 on client side, and Axis2 1.1.1 on server side. Updating the server to 1.2 is no option currently. Is REST generally not working with a 1.2 client and a 1.1.1 server, or am I doing something wrong here? /philipp - To unsubscribe, e-mail: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] mailto:[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]
RE: Axis2 rest
If you want to use POX(plain old xml) over HTTP using the POST mechanism then you could dispatch the complex data types. But that is not the pure form of REST. try to design your schema in such a way that you can invoke the requests using simple GET mechanism. From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Tue 7/3/2007 6:03 PM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Perhaps one of the developers can answer this? I'd be more inclined to use straight HTTP than Axis2, though. Anne On 7/3/07, Raghu Upadhyayula [EMAIL PROTECTED] wrote: Thanks Anne. How do you submit a request having complex types with a POST? Can you show me for the login method sample with User object containing username password? Thanks Raghu From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 2:41 PM To: axis-user@ws.apache.org Subject: Re: Axis2 rest You can submit a resource representation (containing complex types) using PUT or POST. But Jeff is correct that you cannot submit a complex query parameter via URL encoding. Also note that encoding a password as a query parameter in a URL (per Raghu's example) violates just about every security best practice imaginable. And this time I'll bite my tongue and not rant about the inappropriateness of turning a method into a resource. Anne On 7/3/07, Walker, Jeff [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] wrote: You don't pass complex types in REST web services. Period. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. REST services is all about manipulating resources, not passing complex types. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. -jeff -Original Message- From: Raghu Upadhyayula [mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Tuesday, July 03, 2007 3:45 PM To: axis-user@ws.apache.org Subject: RE: Axis2 rest Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com http://nabble.com/ . - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2 rest
You should use GET only if your intention is to get a representation of a resource -- i.e., a safe operation that does not effect any change of state to the server. If your intention is to make some type of change to the resource, you should use one of the following non-safe methods: POST, PUT, or DELETE. As Vibhor says, if you want to follow REST constraints, then you should design your resources in such a way that every *thing* that you might want to get from the service has a unique URI. You should never need to pass a complex type as input to identify the thing you are trying to get. Your login request is not a safe method. In a RESTful system, it would create a resource that represents your session. Therefore you should use POST rather than GET. But why are you doing a login in the application payload? You should use the infrastructure for authentication -- HTTP authentication, SSL authentication, or WS-Security authentication. Anne On 7/4/07, Vibhor_Sharma [EMAIL PROTECTED] wrote: If you want to use POX(plain old xml) over HTTP using the POST mechanism then you could dispatch the complex data types. But that is not the pure form of REST. try to design your schema in such a way that you can invoke the requests using simple GET mechanism. From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Tue 7/3/2007 6:03 PM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Perhaps one of the developers can answer this? I'd be more inclined to use straight HTTP than Axis2, though. Anne On 7/3/07, Raghu Upadhyayula [EMAIL PROTECTED] wrote: Thanks Anne. How do you submit a request having complex types with a POST? Can you show me for the login method sample with User object containing username password? Thanks Raghu From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 2:41 PM To: axis-user@ws.apache.org Subject: Re: Axis2 rest You can submit a resource representation (containing complex types) using PUT or POST. But Jeff is correct that you cannot submit a complex query parameter via URL encoding. Also note that encoding a password as a query parameter in a URL (per Raghu's example) violates just about every security best practice imaginable. And this time I'll bite my tongue and not rant about the inappropriateness of turning a method into a resource. Anne On 7/3/07, Walker, Jeff [EMAIL PROTECTED] wrote: You don't pass complex types in REST web services. Period. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. REST services is all about manipulating resources, not passing complex types. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. -jeff -Original Message- From: Raghu Upadhyayula [mailto: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 3:45 PM To: axis-user@ws.apache.org Subject: RE: Axis2 rest Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Axis2 rest
Hi Anne, I'm not using REST for my web services, I just gave the login sample as an example for zakaria's email about passing parameters to in a REST way. Thanks Raghu From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Wed 7/4/2007 3:23 PM To: axis-user@ws.apache.org Subject: Re: Axis2 rest You should use GET only if your intention is to get a representation of a resource -- i.e., a safe operation that does not effect any change of state to the server. If your intention is to make some type of change to the resource, you should use one of the following non-safe methods: POST, PUT, or DELETE. As Vibhor says, if you want to follow REST constraints, then you should design your resources in such a way that every *thing* that you might want to get from the service has a unique URI. You should never need to pass a complex type as input to identify the thing you are trying to get. Your login request is not a safe method. In a RESTful system, it would create a resource that represents your session. Therefore you should use POST rather than GET. But why are you doing a login in the application payload? You should use the infrastructure for authentication -- HTTP authentication, SSL authentication, or WS-Security authentication. Anne On 7/4/07, Vibhor_Sharma [EMAIL PROTECTED] wrote: If you want to use POX(plain old xml) over HTTP using the POST mechanism then you could dispatch the complex data types. But that is not the pure form of REST. try to design your schema in such a way that you can invoke the requests using simple GET mechanism. From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Tue 7/3/2007 6:03 PM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Perhaps one of the developers can answer this? I'd be more inclined to use straight HTTP than Axis2, though. Anne On 7/3/07, Raghu Upadhyayula [EMAIL PROTECTED] wrote: Thanks Anne. How do you submit a request having complex types with a POST? Can you show me for the login method sample with User object containing username password? Thanks Raghu From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 2:41 PM To: axis-user@ws.apache.org Subject: Re: Axis2 rest You can submit a resource representation (containing complex types) using PUT or POST. But Jeff is correct that you cannot submit a complex query parameter via URL encoding. Also note that encoding a password as a query parameter in a URL (per Raghu's example) violates just about every security best practice imaginable. And this time I'll bite my tongue and not rant about the inappropriateness of turning a method into a resource. Anne On 7/3/07, Walker, Jeff [EMAIL PROTECTED] wrote: You don't pass complex types in REST web services. Period. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. REST services is all about manipulating resources, not passing complex types. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. -jeff -Original Message- From: Raghu Upadhyayula [mailto: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 3:45 PM To: axis-user@ws.apache.org Subject: RE: Axis2 rest Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED
Re: Axis2 rest
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Walker, Jeff wrote: You don't pass complex types in REST web services. Period. Completely disagree. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. Remember one realization of REST is to use HTTP and HTTP has methods other than GET. As Anne also has mentioned you are only talking about GET method here. If you use POST method to pass parameters to your resource, then you can send complex xmls. BTW, WSDL 2.0 HTTP Binding which is what we used to implement RESTish (if you do not agree POX style) inside Axis2. The HTTP binding spec says, if you want to send something using HTTP get then your xml schema should adhere to IRI style. IRI style simply says you can not send complex xmls. REST services is all about manipulating resources, not passing complex types. Well, half true and half false. REST is about manipulating resources but it has no restriction on the XML that is being passed. Those restrictions comes from the realizations like HTTP. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. Well, I am wondering why SOAP/WSDL is regarded as big here :) just joking. Thanks, Chinthaka -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.3 (GNU/Linux) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFGjF3kjON2uBzUhh8RAikMAJ4p5Ojo07FD6OyqFGlL8+xtAyukAwCePH7n Q65T2Ezp1FjjPILOE9vJF+s= =HOMI -END PGP SIGNATURE- - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2 rest
Unless you turn off REST explicitly from your axis2.xml you should be able to use REST with axis2. The default url pattern that axis2 uses is axis2/services/{service name}/{Operation name} e.g axis2/services/version/getVersion Although this is the default its possible to do more complex stuff using WSDL 2.0 http://www.w3.org/2002/ws/desc/. Please let us know if u need more details. Thanks, Keith. On 7/3/07, zakaria ghandour [EMAIL PROTECTED] wrote: hi, how can i activate rest handling for my webservices ? what's the format of the url to invoque webservice rest ? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11413203 Sent from the Axis - User mailing list archive at Nabble.com. - 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/
Re: Axis2 rest
i didn't turn off REST explicitly i use axis2 in Intalio BPM , intalio use geronimo and axis2 i think that axis2 disable rest by default. how to activate rest in axis2.xml ? parameter name=enableRESTInAxis2MainServlet locked=truetrue/parameter parameter name=disableREST locked=truefalse/parameter parameter name=disableSeparateEndpointForREST locked=truefalse/parameter can i have details ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414531 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2 rest
Which version of Axis2 r u using? Thanks, Keith. On 7/3/07, zakaria ghandour [EMAIL PROTECTED] wrote: i didn't turn off REST explicitly i use axis2 in Intalio BPM , intalio use geronimo and axis2 i think that axis2 disable rest by default. how to activate rest in axis2.xml ? parameter name=enableRESTInAxis2MainServlet locked=truetrue/parameter parameter name=disableREST locked=truefalse/parameter parameter name=disableSeparateEndpointForREST locked=truefalse/parameter can i have details ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414531 Sent from the Axis - User mailing list archive at Nabble.com. - 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/
Re: Axis2 rest
i don't know whitch one , because it's included in Intalio server -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414757 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2 rest
Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Axis2 rest
Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Axis2 rest
You don't pass complex types in REST web services. Period. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. REST services is all about manipulating resources, not passing complex types. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. -jeff -Original Message- From: Raghu Upadhyayula [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 3:45 PM To: axis-user@ws.apache.org Subject: RE: Axis2 rest Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2 rest
You can submit a resource representation (containing complex types) using PUT or POST. But Jeff is correct that you cannot submit a complex query parameter via URL encoding. Also note that encoding a password as a query parameter in a URL (per Raghu's example) violates just about every security best practice imaginable. And this time I'll bite my tongue and not rant about the inappropriateness of turning a method into a resource. Anne On 7/3/07, Walker, Jeff [EMAIL PROTECTED] wrote: You don't pass complex types in REST web services. Period. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. REST services is all about manipulating resources, not passing complex types. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. -jeff -Original Message- From: Raghu Upadhyayula [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 3:45 PM To: axis-user@ws.apache.org Subject: RE: Axis2 rest Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Axis2 rest
Thanks Anne. How do you submit a request having complex types with a POST? Can you show me for the login method sample with User object containing username password? Thanks Raghu From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 2:41 PM To: axis-user@ws.apache.org Subject: Re: Axis2 rest You can submit a resource representation (containing complex types) using PUT or POST. But Jeff is correct that you cannot submit a complex query parameter via URL encoding. Also note that encoding a password as a query parameter in a URL (per Raghu's example) violates just about every security best practice imaginable. And this time I'll bite my tongue and not rant about the inappropriateness of turning a method into a resource. Anne On 7/3/07, Walker, Jeff [EMAIL PROTECTED] wrote: You don't pass complex types in REST web services. Period. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. REST services is all about manipulating resources, not passing complex types. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. -jeff -Original Message- From: Raghu Upadhyayula [mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Tuesday, July 03, 2007 3:45 PM To: axis-user@ws.apache.org Subject: RE: Axis2 rest Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto: [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] ] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2 rest
Perhaps one of the developers can answer this? I'd be more inclined to use straight HTTP than Axis2, though. Anne On 7/3/07, Raghu Upadhyayula [EMAIL PROTECTED] wrote: Thanks Anne. How do you submit a request having complex types with a POST? Can you show me for the login method sample with User object containing username password? Thanks Raghu -- *From:* Anne Thomas Manes [mailto:[EMAIL PROTECTED] *Sent:* Tuesday, July 03, 2007 2:41 PM *To:* axis-user@ws.apache.org *Subject:* Re: Axis2 rest You can submit a resource representation (containing complex types) using PUT or POST. But Jeff is correct that you cannot submit a complex query parameter via URL encoding. Also note that encoding a password as a query parameter in a URL (per Raghu's example) violates just about every security best practice imaginable. And this time I'll bite my tongue and not rant about the inappropriateness of turning a method into a resource. Anne On 7/3/07, *Walker**, Jeff *[EMAIL PROTECTED] wrote: You don't pass complex types in REST web services. Period. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. REST services is all about manipulating resources, not passing complex types. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. -jeff -Original Message- From: Raghu Upadhyayula [mailto: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 3:45 PM To: axis-user@ws.apache.org Subject: RE: Axis2 rest Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2 rest
Here is an example assuming following is the schema. xs:element name=EchoName type=xsmt:EchoStructType/ xs:complexType name=EchoStructType xs:sequence xs:element name=FirstName type=xs:string/ xs:element name=MiddleName type=xs:string/ xs:element name=LastName type=xs:string/ /xs:sequence /xs:complexType The following is how the request (the payload) will be, ns1:EchoName xmlns:ns1=http://example.org/message-test/xsd; ns1:FirstNamemyfirst/ns1:FirstName ns1:MiddleNamemymiddle/ns1:MiddleName ns1:LastNamemylast/ns1:LastName /ns1:EchoName Thanks, Keith. On 7/4/07, Raghu Upadhyayula [EMAIL PROTECTED] wrote: Thanks Anne. How do you submit a request having complex types with a POST? Can you show me for the login method sample with User object containing username password? Thanks Raghu -- *From:* Anne Thomas Manes [mailto:[EMAIL PROTECTED] *Sent:* Tuesday, July 03, 2007 2:41 PM *To:* axis-user@ws.apache.org *Subject:* Re: Axis2 rest You can submit a resource representation (containing complex types) using PUT or POST. But Jeff is correct that you cannot submit a complex query parameter via URL encoding. Also note that encoding a password as a query parameter in a URL (per Raghu's example) violates just about every security best practice imaginable. And this time I'll bite my tongue and not rant about the inappropriateness of turning a method into a resource. Anne On 7/3/07, *Walker**, Jeff *[EMAIL PROTECTED] wrote: You don't pass complex types in REST web services. Period. It's all about those Query parameters, the name-value pairs following the '?' and separated by the ''. REST services is all about manipulating resources, not passing complex types. If you want to send complex types, then you need the so-called 'big' web services technologies like SOAP/WSDL. -jeff -Original Message- From: Raghu Upadhyayula [mailto: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 3:45 PM To: axis-user@ws.apache.org Subject: RE: Axis2 rest Hi Zakaria, For the methods with simple parameters you use it like this Say I have a webservice MyService with login method and username password parameters, then the rest URL will look like this. http://localhost/axis2/services/MyService/login?username=raghupassword= xxx But I'm not sure how to call it if the parameter is a complex type, like if my login method takes in a User object which has username password as members of the User object, then I'm not sure how to call that. Thanks Raghu -Original Message- From: zakaria ghandour [mailto: [EMAIL PROTECTED] Sent: Tuesday, July 03, 2007 9:10 AM To: axis-user@ws.apache.org Subject: Re: Axis2 rest Hi, axis2/services/{service name}/{Operation name} can you tel me how to call ws as rest if there is parameters ?? thanks -- View this message in context: http://www.nabble.com/Axis2---rest-tf4018616.html#a11414842 Sent from the Axis - User mailing list archive at Nabble.com. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - 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/
Re: Axis2 rest
Hi zakaria , In the current version of Axis2 (Axis2 1.2) , we support none of the below parameters. Thanks Deepal i didn't turn off REST explicitly i use axis2 in Intalio BPM , intalio use geronimo and axis2 i think that axis2 disable rest by default. how to activate rest in axis2.xml ? parameter name=enableRESTInAxis2MainServlet locked=truetrue/parameter parameter name=disableREST locked=truefalse/parameter parameter name=disableSeparateEndpointForREST locked=truefalse/parameter can i have details ?? thanks - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2: REST response without xlinks
Achim Its better to think of the Axis2 support as POX (Plain Old XML) than REST. The services inside Axis2 don't currently have any concept of entities or resources, so the only way to do this would be to write your own service from XML up. You would need to use either the -d none databinding option or the RawXMLMessageReceiver to handle your own XML code. Yes it would change the SOAP version too. There is quite a lot of thought going on in Axis2 about how to handle REST and map resources into Axis2 more widely. Can I suggest - since you obviously have some interesting ideas in this space - that you join axis-dev and kick off a thread there? There's also a thread over at wso2.org about defining a model for mapping SQL data stores into services which you might be interested in too. Paul On 5/11/07, Achim Abeling [EMAIL PROTECTED] wrote: Hi, I am trying out Axis2 with a REST service. It works well out of the box but the response does not have xlinks to included entities. E.g. I have a bean A which has a reference to bean B as a property. In my response I see the xml representation of bean A with a representation of bean B as a child. How can I make Axis2 generate responses where the reference to bean B is realized as an xlink like in ?xml version=1.0? p:Parts xmlns:p=http://www.parts-depot.com; xmlns:xlink=http://www.w3.org/1999/xlink; Part id=00345 xlink:href=http://www.parts-depot.com/parts/00345/ Part id=00346 xlink:href=http://www.parts-depot.com/parts/00346/ Part id=00347 xlink:href=http://www.parts-depot.com/parts/00347/ Part id=00348 xlink:href=http://www.parts-depot.com/parts/00348/ /p:Parts And if it is possible to generate such responses does the configuration affect my SOAP service which is running beside my REST service? Best regards Achim - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Paul Fremantle VP/Technology, WSO2 and OASIS WS-RX TC Co-chair http://bloglines.com/blog/paulfremantle [EMAIL PROTECTED] Oxygenating the Web Service Platform, www.wso2.com - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [axis2]REST requests failing
I don't think so. I'm looking at the code right now, and it looks like the InputStream being null problem still exists. Not sure how to fix it though. Anyone have any ideas? Roshan Punnoose Phone: 301-497-6039 From: keith chapman [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 3:00 PM To: axis-user@ws.apache.org Subject: Re: [axis2]REST requests failing Hi Roshan, Can you provide me more details please so that I can try and reproduce the problem. I get the feeling that your not using the latest code though (I think this is fixed in the latest code). I will be glad to check it out if you can provide me some details. It works for me with the latest code... Thanks, Keith. On 3/14/07, Punnoose, Roshan [EMAIL PROTECTED] wrote: I'm not exactly sure the right way to proceed with this one. So I looked at the Axis2 1.0 code and was able to work with it to make this work for the time being. This is what I did: 1) Created my own servlet that extended AxisServlet (MyAxisServlet) which overrode the doGet(...) method. 2) Pretty much copied the code from the AxisServlet, except if it is a REST request, I did this: messageContext = createMessageContext(request, response, false); processGetRequest(messageContext, request, response); 3) processGetRequest(...) : Got this mostly from the 1.0 code. The only issue was that for the dispatchAndVerify(...) I had to have both the RequestURIDispatcher() to get the AxisService and the RequestURIOperationDispatcher() to get the AxisOperation being used. I have a feeling that a lot of these change might break what else is implemented, so if anyone has a real solution to the reason why the RESTUtil is sending a null inputStream into the processURLRequest, I'm very willing to listen. Roshan Punnoose Phone: 301-497-6039 -Original Message- From: Punnoose, Roshan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 11:30 AM To: axis-user@ws.apache.org Subject: RE: [axis2]REST requests failing Looks like the RESTUtil is sending the inputStream as null in the processURLRequest, which will break the TransportUtils class either way. What can we do? Roshan Punnoose Phone: 301-497-6039 -Original Message- From: Punnoose, Roshan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 11:24 AM To: axis-user@ws.apache.org Subject: [axis2]REST requests failing I have a REST GET request, and I keep getting this error: java.lang.NullPointerException. java.lang.NullPointerException at java.io.Reader.init(Reader.java:61) at java.io.InputStreamReader.init(InputStreamReader.java:80) at org.apache.axis2.builder.XFormURLEncodedBuilder.extractParametersFromReq uest(XFormURLEncodedBuilder.java:123) at org.apache.axis2.builder.XFormURLEncodedBuilder.processDocument(XFormURL EncodedBuilder.java:77) at org.apache.axis2.transport.TransportUtils.createSOAPMessage (TransportUti ls.java:120) at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil .java:98) at org.apache.axis2.transport.http.AxisServlet$ProcessRESTRequest.processUR LRequest(AxisServlet.java:767) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:236) Any ideas? Roshan Punnoose Phone: 301-497-6039 - 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/ BEGIN:VCARD VERSION:2.1 N:Punnoose;Roshan FN:Punnoose, Roshan ADR;WORK:;2115 LABEL;WORK:2115 EMAIL;PREF;INTERNET:[EMAIL PROTECTED] REV:20050413T183207Z END:VCARD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [axis2]REST requests failing
Looks like the RESTUtil is sending the inputStream as null in the processURLRequest, which will break the TransportUtils class either way. What can we do? Roshan Punnoose Phone: 301-497-6039 -Original Message- From: Punnoose, Roshan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 11:24 AM To: axis-user@ws.apache.org Subject: [axis2]REST requests failing I have a REST GET request, and I keep getting this error: java.lang.NullPointerException. java.lang.NullPointerException at java.io.Reader.init(Reader.java:61) at java.io.InputStreamReader.init(InputStreamReader.java:80) at org.apache.axis2.builder.XFormURLEncodedBuilder.extractParametersFromReq uest(XFormURLEncodedBuilder.java:123) at org.apache.axis2.builder.XFormURLEncodedBuilder.processDocument(XFormURL EncodedBuilder.java:77) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUti ls.java:120) at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil .java:98) at org.apache.axis2.transport.http.AxisServlet$ProcessRESTRequest.processUR LRequest(AxisServlet.java:767) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:236) Any ideas? Roshan Punnoose Phone: 301-497-6039 BEGIN:VCARD VERSION:2.1 N:Punnoose;Roshan FN:Punnoose, Roshan ADR;WORK:;2115 LABEL;WORK:2115 EMAIL;PREF;INTERNET:[EMAIL PROTECTED] REV:20050413T183207Z END:VCARD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: [axis2]REST requests failing
I'm not exactly sure the right way to proceed with this one. So I looked at the Axis2 1.0 code and was able to work with it to make this work for the time being. This is what I did: 1) Created my own servlet that extended AxisServlet (MyAxisServlet) which overrode the doGet(...) method. 2) Pretty much copied the code from the AxisServlet, except if it is a REST request, I did this: messageContext = createMessageContext(request, response, false); processGetRequest(messageContext, request, response); 3) processGetRequest(...) : Got this mostly from the 1.0 code. The only issue was that for the dispatchAndVerify(...) I had to have both the RequestURIDispatcher() to get the AxisService and the RequestURIOperationDispatcher() to get the AxisOperation being used. I have a feeling that a lot of these change might break what else is implemented, so if anyone has a real solution to the reason why the RESTUtil is sending a null inputStream into the processURLRequest, I'm very willing to listen. Roshan Punnoose Phone: 301-497-6039 -Original Message- From: Punnoose, Roshan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 11:30 AM To: axis-user@ws.apache.org Subject: RE: [axis2]REST requests failing Looks like the RESTUtil is sending the inputStream as null in the processURLRequest, which will break the TransportUtils class either way. What can we do? Roshan Punnoose Phone: 301-497-6039 -Original Message- From: Punnoose, Roshan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 11:24 AM To: axis-user@ws.apache.org Subject: [axis2]REST requests failing I have a REST GET request, and I keep getting this error: java.lang.NullPointerException. java.lang.NullPointerException at java.io.Reader.init(Reader.java:61) at java.io.InputStreamReader.init(InputStreamReader.java:80) at org.apache.axis2.builder.XFormURLEncodedBuilder.extractParametersFromReq uest(XFormURLEncodedBuilder.java:123) at org.apache.axis2.builder.XFormURLEncodedBuilder.processDocument(XFormURL EncodedBuilder.java:77) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUti ls.java:120) at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil .java:98) at org.apache.axis2.transport.http.AxisServlet$ProcessRESTRequest.processUR LRequest(AxisServlet.java:767) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:236) Any ideas? Roshan Punnoose Phone: 301-497-6039 BEGIN:VCARD VERSION:2.1 N:Punnoose;Roshan FN:Punnoose, Roshan ADR;WORK:;2115 LABEL;WORK:2115 EMAIL;PREF;INTERNET:[EMAIL PROTECTED] REV:20050413T183207Z END:VCARD - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2]REST requests failing
Hi Roshan, Can you provide me more details please so that I can try and reproduce the problem. I get the feeling that your not using the latest code though (I think this is fixed in the latest code). I will be glad to check it out if you can provide me some details. It works for me with the latest code... Thanks, Keith. On 3/14/07, Punnoose, Roshan [EMAIL PROTECTED] wrote: I'm not exactly sure the right way to proceed with this one. So I looked at the Axis2 1.0 code and was able to work with it to make this work for the time being. This is what I did: 1) Created my own servlet that extended AxisServlet (MyAxisServlet) which overrode the doGet(...) method. 2) Pretty much copied the code from the AxisServlet, except if it is a REST request, I did this: messageContext = createMessageContext(request, response, false); processGetRequest(messageContext, request, response); 3) processGetRequest(...) : Got this mostly from the 1.0 code. The only issue was that for the dispatchAndVerify(...) I had to have both the RequestURIDispatcher() to get the AxisService and the RequestURIOperationDispatcher() to get the AxisOperation being used. I have a feeling that a lot of these change might break what else is implemented, so if anyone has a real solution to the reason why the RESTUtil is sending a null inputStream into the processURLRequest, I'm very willing to listen. Roshan Punnoose Phone: 301-497-6039 -Original Message- From: Punnoose, Roshan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 11:30 AM To: axis-user@ws.apache.org Subject: RE: [axis2]REST requests failing Looks like the RESTUtil is sending the inputStream as null in the processURLRequest, which will break the TransportUtils class either way. What can we do? Roshan Punnoose Phone: 301-497-6039 -Original Message- From: Punnoose, Roshan [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 14, 2007 11:24 AM To: axis-user@ws.apache.org Subject: [axis2]REST requests failing I have a REST GET request, and I keep getting this error: java.lang.NullPointerException. java.lang.NullPointerException at java.io.Reader.init(Reader.java:61) at java.io.InputStreamReader.init(InputStreamReader.java:80) at org.apache.axis2.builder.XFormURLEncodedBuilder.extractParametersFromReq uest(XFormURLEncodedBuilder.java:123) at org.apache.axis2.builder.XFormURLEncodedBuilder.processDocument(XFormURL EncodedBuilder.java:77) at org.apache.axis2.transport.TransportUtils.createSOAPMessage(TransportUti ls.java:120) at org.apache.axis2.transport.http.util.RESTUtil.processURLRequest(RESTUtil .java:98) at org.apache.axis2.transport.http.AxisServlet$ProcessRESTRequest.processUR LRequest(AxisServlet.java:767) at org.apache.axis2.transport.http.AxisServlet.doGet(AxisServlet.java:236) Any ideas? Roshan Punnoose Phone: 301-497-6039 - 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/
RE: [axis2] REST approach
Hi, I am new to web services. I was looking at the 'userguide' provided with axis2 distribution. The sample has used AXIOM data binding mechanism. Can we use any other mechanism in it's place for the same example. Regards, Nalini ***The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review,retransmission,dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.*** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [axis2] REST approach
http://ws.apache.org/axis2/1_1_1/userguide-creatingclients.html#createclients http://ws.apache.org/axis2/1_1_1/userguide-creatingclients-xmlbeans.html http://ws.apache.org/axis2/1_1_1/userguide-creatingclients-jibx.html Hope the above docs will help you.. ~Thilina On 2/28/07, Nalini Srivastava [EMAIL PROTECTED] wrote: Hi, I am new to web services. I was looking at the 'userguide' provided with axis2 distribution. The sample has used AXIOM data binding mechanism. Can we use any other mechanism in it's place for the same example. Regards, Nalini ***The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review,retransmission,dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer.*** - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- Thilina Gunarathne WSO2, Inc.; http://www.wso2.com/ Home page: http://webservices.apache.org/~thilina/ Blog: http://thilinag.blogspot.com/ - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] REST request not quite working
I'm facing the same problem. I guess its a bug. On 9/20/06, Shruti Krishnagiri [EMAIL PROTECTED] wrote: Shruti Krishnagiri [EMAIL PROTECTED] wrote: I'm facing a problem gettinga specificREST request to work. One of my service methods takes in an array of strings as a parameter and the corresponding wsdl snippet looks like this: - xs:element name=generatePriceList- xs:complexType- xs:sequence xs:element minOccurs=0 type= xs:string name=items maxOccurs=unbounded / /xs:sequence /xs:complexType /xs:element The Rest request is however only constructing an array of one string even though I specified an '' separated list. Only the first goes into the array. The SOAP request for the same works correctly. What am I doing wrong? Get your own web address for just $1.99/1st yr. We'll help. Yahoo! Small Business. How low will we go? Check out Yahoo! Messenger's low PC-to-Phone call rates.
Re: [Axis2] rest question
And another really good illustration about REST. REST is an architectural style in which the central theme is resources (not methods). http://www.innoq.com/blog/st/2006/06/30/rest_vs_soap_oh_no_not_again.htmlAnneOn 6/29/06, Anne Thomas Manes [EMAIL PROTECTED] wrote:Here's a useful guide to understanding REST:http://prescod.net/rest/Steps_to_extreme.html AnneOn 6/27/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: If you have two methods, then you must have two endpoints. Otherwise, it isn't RESTful.Anne On 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Anne I am sorry - I probably didnt get the answer.I have a service class that has 2 methods -public OMElement dothis(OMElement om1)public OMElement dothat(OMElement om2)Now for this service there will be one REST endpoint address - right? then my question is given my payload xml - how does axis decide whichmethod to invoke in my service?I didnt quite get what u meant byYou have only one function associated with POST to a specific URL Are u saying that my service can have only one method for it to be restenabled?thanksAnamitra Anne Thomas Manes [EMAIL PROTECTED]To m axis-user@ws.apache.orgcc 06/27/2006 01:17 PMSubject Re: [Axis2] rest question Please respond to [EMAIL PROTECTED] he.orgWhen using a RESTful service, *POST* is your method. You have only one function associated with POST to a specific URL. If you have a service thatexposes methods other than GET, POST, PUT, or DELETE, then it isn'tRESTful.AnneOn 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:Hi As per the axis2 doc it seems that if I want to do a POST rest service - the only way axis runtime would detect which method to delegate the calltois from the name of the top level element in the http message body XML -right?I have a service whose method definition is like public OMElement dothis(OMElelemt payload)When I do the SOAP clientinvoke I send the soap action as urn:dothisandmy payload top element does not match the method name - This works fine with axis2.But now if I have to do REST call and not have the root element as methodname - how can I acheive that using rest? [I presume soap action is notgoing to work here or is it?]thanks Anamitra-To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]- To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] REST invocation problem
I have exactly the same error - I was abt to file a jira - seems like a bug in the REST implementation of axis2. Can anyone confirm if this is a bug? thanks Anamitra Fabien Couble fabien.couble.ex [EMAIL PROTECTED] To om axis-user@ws.apache.org cc 06/30/2006 08:30 AMSubject [Axis2] REST invocation problem Please respond to [EMAIL PROTECTED] he.org Hi everybody, I have an error when I want to invoke a module in REST manner like http://localhost:8080/axis2/rest/MyService/echo. The error is the following: ERROR org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/axis2].[AxisRESTServlet] - Servlet.service() pour la servlet AxisRESTServlet a généré une exception java.lang.NullPointerException at org.apache.axis2.util.SchemaUtil.handleMediaTypeURLEncoded(SchemaUtil.java:105) at org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(RESTUtil.java:129) at org.apache.axis2.transport.http.AxisRESTServlet.doGet(AxisRESTServlet.java:36) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve..java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve..java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Unknown Source) Concerning, the service Version which is installed by default in Axis2, it works properly! Someone has an idea...? Regards Fabien COUBLE This message contains information that may be privileged or confidential and is the property of the Capgemini Group. It is intended only for the person to whom it is addressed. If you are not the intended recipient, you are not authorized to read, print, retain, copy, disseminate, distribute, or use this message or any part thereof. If you receive this message in error, please notify the sender immediately and delete all copies of this message. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] rest question
Here's a useful guide to understanding REST:http://prescod.net/rest/Steps_to_extreme.html AnneOn 6/27/06, Anne Thomas Manes [EMAIL PROTECTED] wrote: If you have two methods, then you must have two endpoints. Otherwise, it isn't RESTful.Anne On 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Anne I am sorry - I probably didnt get the answer.I have a service class that has 2 methods -public OMElement dothis(OMElement om1)public OMElement dothat(OMElement om2)Now for this service there will be one REST endpoint address - right? then my question is given my payload xml - how does axis decide whichmethod to invoke in my service?I didnt quite get what u meant byYou have only one function associated with POST to a specific URL Are u saying that my service can have only one method for it to be restenabled?thanksAnamitra Anne Thomas Manes [EMAIL PROTECTED]To m axis-user@ws.apache.orgcc 06/27/2006 01:17 PMSubject Re: [Axis2] rest question Please respond to [EMAIL PROTECTED] he.orgWhen using a RESTful service, *POST* is your method. You have only one function associated with POST to a specific URL. If you have a service thatexposes methods other than GET, POST, PUT, or DELETE, then it isn'tRESTful.AnneOn 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:Hi As per the axis2 doc it seems that if I want to do a POST rest service - the only way axis runtime would detect which method to delegate the calltois from the name of the top level element in the http message body XML -right?I have a service whose method definition is like public OMElement dothis(OMElelemt payload)When I do the SOAP clientinvoke I send the soap action as urn:dothisandmy payload top element does not match the method name - This works fine with axis2.But now if I have to do REST call and not have the root element as methodname - how can I acheive that using rest? [I presume soap action is notgoing to work here or is it?]thanks Anamitra-To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]- To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] REST vs. SOAP and enableREST
RESTiness refers to how the service is exposed to the outside world, not to the way Axis handles the request internally. The message receiver determines how Axis handles the request internally.A REST interface exposes the service as a resource with a unique URL. It supports the following possible operations/methods on that resource (and no others): - GET- POST- PUT- DELETEAnneOn 6/29/06, heikki [EMAIL PROTECTED] wrote: Hi there,it seems I'm not quite getting how Axis2 handles REST vs. SOAP .. >From the documentation I had gathered that this element in the server side's axis2.xml :parameter name=enableREST locked=falsetrue/parameter should cause REST handling of incoming messages. I had therefore also assumed that setting this parameter to false, or removing it altogether, would cause Axis2 to handle incoming messages as SOAP -- which would mean (I thought) discarding the envelope before binding the payload to the type expected in the SEI. However, I see no difference in behaviour at all ! Whether I set this parameter to false or true or take it out; Axis2 keeps handling messages as REST messages ! So if I have a client sending SOAP (instead of REST) messages, the SOAP message does not get processed correctly, as it's trying to bind the SOAP:Envelope type to the type expected in the SEI -- it does this even though the enableREST param is false ! I have now modified the generated MyServiceMessageReceiverInOut such that its fromOM() method checks for SOAP-ness of the param and if so, it discards the SOAP envelope before trying to bind the payload. This way it now correctly handles both SOAP and REST messages coming in. But I have a distinct feeling that this is fishy; that I shouldn't have to do this; that I'm missing something here; and that the enableREST parameter setting should have some impact on how Axis2 behaves. Anyone care to explain these matters ?thank you !Heikki Doeleman
Re: [Axis2] rest question
When using a RESTful service, *POST* is your method. You have only one function associated with POST to a specific URL. If you have a service that exposes methods other than GET, POST, PUT, or DELETE, then it isn't RESTful. AnneOn 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:HiAs per the axis2 doc it seems that if I want to do a POST rest service - the only way axis runtime would detect which method to delegate the call tois from the name of the top level element in the http message body XML -right?I have a service whose method definition is like public OMElement dothis(OMElelemt payload)When I do the SOAP clientinvoke I send the soap action as urn:dothis andmy payload top element does not match the method name - This works finewith axis2. But now if I have to do REST call and not have the root element as methodname - how can I acheive that using rest? [I presume soap action is notgoing to work here or is it?]thanksAnamitra -To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] rest question
Hi Anne I am sorry - I probably didnt get the answer. I have a service class that has 2 methods - public OMElement dothis(OMElement om1) public OMElement dothat(OMElement om2) Now for this service there will be one REST endpoint address - right? then my question is given my payload xml - how does axis decide which method to invoke in my service? I didnt quite get what u meant by You have only one function associated with POST to a specific URL Are u saying that my service can have only one method for it to be rest enabled? thanks Anamitra Anne Thomas Manes [EMAIL PROTECTED] To maxis-user@ws.apache.org cc 06/27/2006 01:17 PMSubject Re: [Axis2] rest question Please respond to [EMAIL PROTECTED] he.org When using a RESTful service, *POST* is your method. You have only one function associated with POST to a specific URL. If you have a service that exposes methods other than GET, POST, PUT, or DELETE, then it isn't RESTful. Anne On 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi As per the axis2 doc it seems that if I want to do a POST rest service - the only way axis runtime would detect which method to delegate the call to is from the name of the top level element in the http message body XML - right? I have a service whose method definition is like public OMElement dothis(OMElelemt payload) When I do the SOAP client invoke I send the soap action as urn:dothis and my payload top element does not match the method name - This works fine with axis2. But now if I have to do REST call and not have the root element as method name - how can I acheive that using rest? [I presume soap action is not going to work here or is it?] thanks Anamitra - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] rest question
You have only one function public OMElement dothis(OMElement om1) public OMElement dothat(OMElement om2) are both considered the same signature therefore they are one function.. associated with POST (IN order to be RESTful you invoke using method=POST) to a specific URL certainly true assuming one endpoint address The statement is correct.. Do you perhaps have more specific questions? Martin -- * This email message and any files transmitted with it contain confidential information intended only for the person(s) to whom this email message is addressed. If you have received this email message in error, please notify the sender immediately by telephone or email and destroy the original message without making a copy. Thank you. - Original Message - From: [EMAIL PROTECTED] To: axis-user@ws.apache.org Sent: Tuesday, June 27, 2006 1:43 PM Subject: Re: [Axis2] rest question Hi Anne I am sorry - I probably didnt get the answer. I have a service class that has 2 methods - public OMElement dothis(OMElement om1) public OMElement dothat(OMElement om2) Now for this service there will be one REST endpoint address - right? then my question is given my payload xml - how does axis decide which method to invoke in my service? I didnt quite get what u meant by You have only one function associated with POST to a specific URL Are u saying that my service can have only one method for it to be rest enabled? thanks Anamitra Anne Thomas Manes [EMAIL PROTECTED] To maxis-user@ws.apache.org cc 06/27/2006 01:17 PMSubject Re: [Axis2] rest question Please respond to [EMAIL PROTECTED] he.org When using a RESTful service, *POST* is your method. You have only one function associated with POST to a specific URL. If you have a service that exposes methods other than GET, POST, PUT, or DELETE, then it isn't RESTful. Anne On 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi As per the axis2 doc it seems that if I want to do a POST rest service - the only way axis runtime would detect which method to delegate the call to is from the name of the top level element in the http message body XML - right? I have a service whose method definition is like public OMElement dothis(OMElelemt payload) When I do the SOAP client invoke I send the soap action as urn:dothis and my payload top element does not match the method name - This works fine with axis2. But now if I have to do REST call and not have the root element as method name - how can I acheive that using rest? [I presume soap action is not going to work here or is it?] thanks Anamitra - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: [Axis2] rest question
If you have two methods, then you must have two endpoints. Otherwise, it isn't RESTful.AnneOn 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Anne I am sorry - I probably didnt get the answer.I have a service class that has 2 methods -public OMElement dothis(OMElement om1)public OMElement dothat(OMElement om2)Now for this service there will be one REST endpoint address - right? then my question is given my payload xml - how does axis decide whichmethod to invoke in my service?I didnt quite get what u meant byYou have only one function associated with POST to a specific URL Are u saying that my service can have only one method for it to be restenabled?thanksAnamitra Anne Thomas Manes [EMAIL PROTECTED]To maxis-user@ws.apache.orgcc 06/27/2006 01:17 PMSubject Re: [Axis2] rest question Please respond to [EMAIL PROTECTED]he.orgWhen using a RESTful service, *POST* is your method. You have only one function associated with POST to a specific URL. If you have a service thatexposes methods other than GET, POST, PUT, or DELETE, then it isn'tRESTful.AnneOn 6/27/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:HiAs per the axis2 doc it seems that if I want to do a POST rest service - the only way axis runtime would detect which method to delegate the calltois from the name of the top level element in the http message body XML -right?I have a service whose method definition is like public OMElement dothis(OMElelemt payload)When I do the SOAP clientinvoke I send the soap action as urn:dothisandmy payload top element does not match the method name - This works fine with axis2.But now if I have to do REST call and not have the root element as methodname - how can I acheive that using rest? [I presume soap action is notgoing to work here or is it?]thanks Anamitra-To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]-To unsubscribe, e-mail: [EMAIL PROTECTED]For additional commands, e-mail: [EMAIL PROTECTED]
Re: Axis2: REST-Style with HTTP-GET - how to add parameters?
Thank you for your help! But how can I configure Axis2 to generate a WSDL that does have a GET binding? Thank you very much. Cheers, Christoph Anne Thomas Manes [EMAIL PROTECTED] To maxis-user@ws.apache.org cc 19.05.2006 21:44 Subject Re: Axis2: REST-Style with HTTP-GET Please respond to - how to add parameters? axis-user Your WSDL doesn't have a GET binding (just POST). On 5/18/06, Christoph Miksovic [EMAIL PROTECTED] wrote: Hello everybody, I have problems acessing the Axis2SampleDocLitService Sample using REST-Style with HTTP-GET. Can you please tell me what is the correct way to set the parameter? The operation signature is echoString(String echoStringParam) (see WSDL File below). I tried several things like for instance http://localhost:8080/axis2/rest/Axis2SampleDocLitService/echoString?echoStringParam=hello But I always get an error as follows: org.apache.axis2.AxisFault: Data binding error; nested exception is: java.lang.RuntimeException: Data binding error; nested exception is: org.apache.axis2.AxisFault: Data binding error; nested exception is: java.lang.RuntimeException: Data binding error org.apache.axis2.transport.http.util.RESTUtil.processGetRequest(RESTUtil.java:141) org.apache.axis2.transport.http.AxisRESTServlet.doGet(AxisRESTServlet.java :36) javax.servlet.http.HttpServlet.service(HttpServlet.java:689) javax.servlet.http.HttpServlet.service(HttpServlet.java:802) Thanks a lot for any help! Cheers, Christoph _ WSDL File, generated by Axis2 Engine: wsdl:definitions targetNamespace= http://userguide.axis2.apache.org/Axis2SampleDocLit; - wsdl:types - schema targetNamespace=http://userguide.axis2.apache.org/xsd; elementFormDefault=qualified attributeFormDefault=unqualified - complexType name=ArrayOfstring_literal - sequence element type=string name=string maxOccurs=unbounded/ /sequence /complexType - complexType name=SOAPStruct - all element type=float name=varFloat/ element type=int name=varInt/ element type=string name=varString/ /all /complexType element type=string name=echoStringParam/ element type=int name=echoIntParam/ element type=string name=echoStringReturn/ element type=xsd1:ArrayOfstring_literal name=echoStringArrayParam/ element type=xsd1:ArrayOfstring_literal name=echoStringArrayReturn/ element type=xsd1:SOAPStruct name=echoStructParam/ element type=xsd1:SOAPStruct name=echoStructReturn/ /schema /wsdl:types - wsdl:message name=echoStringArray wsdl:part element=xsd1:echoStringArrayParam name=part1/ /wsdl:message - wsdl:message name=echoStringArrayResponse wsdl:part element=xsd1:echoStringArrayReturn name=part1/ /wsdl:message - wsdl:message name=echoString wsdl:part element=xsd1:echoStringParam name=part1/ /wsdl:message - wsdl:message name=echoStringResponse wsdl:part element=xsd1:echoStringReturn name=part1/ /wsdl:message - wsdl:message name=echoStruct wsdl:part element=xsd1:echoStructParam name=part1/ /wsdl:message - wsdl:message name=echoStructResponse wsdl:part element=xsd1:echoStructReturn name=part1/ /wsdl:message - wsdl:portType name=Axis2SampleDocLitServicePortType - wsdl:operation name=echoStringArray wsdl:input message=tns:echoStringArray/ wsdl:output message=tns:echoStringArrayResponse/ /wsdl:operation - wsdl:operation name=echoString wsdl:input message=tns:echoString/ wsdl:output message=tns:echoStringResponse/ /wsdl:operation - wsdl:operation name=echoStruct wsdl:input message=tns:echoStruct/ wsdl:output message=tns:echoStructResponse/ /wsdl:operation /wsdl:portType - wsdl:binding type=tns:Axis2SampleDocLitServicePortType name=Axis2SampleDocLitServiceSOAP11Binding
Re: Axis2: REST-Style with HTTP-GET - how to add parameters?
Your WSDL doesn't have a GET binding (just POST).On 5/18/06, Christoph Miksovic [EMAIL PROTECTED] wrote:Hello everybody,I have problems acessing the Axis2SampleDocLitService Sample using REST-Style with HTTP-GET.Can you please tell me what is the correct way to set the parameter?The operation signature is echoString(String echoStringParam) (see WSDLFile below).I tried several things like for instance http://localhost:8080/axis2/rest/Axis2SampleDocLitService/echoString?echoStringParam=helloBut I always get an error as follows: org.apache.axis2.AxisFault: Data binding error; nested exception is:java.lang.RuntimeException: Data binding error; nested exception is:org.apache.axis2.AxisFault: Data binding error; nested exception is: java.lang.RuntimeException: Data binding errororg.apache.axis2.transport.http.util.RESTUtil.processGetRequest(RESTUtil.java:141)org.apache.axis2.transport.http.AxisRESTServlet.doGet(AxisRESTServlet.java :36)javax.servlet.http.HttpServlet.service(HttpServlet.java:689)javax.servlet.http.HttpServlet.service(HttpServlet.java:802)Thanks a lot for any help!Cheers,Christoph_ WSDL File, generated by Axis2 Engine:wsdl:definitions targetNamespace=http://userguide.axis2.apache.org/Axis2SampleDocLit -wsdl:types-schema targetNamespace=http://userguide.axis2.apache.org/xsdelementFormDefault=qualified attributeFormDefault=unqualified -complexType name=ArrayOfstring_literal-sequenceelement type=string name=string maxOccurs=unbounded//sequence /complexType-complexType name=SOAPStruct-allelement type=float name=varFloat/element type=int name=varInt/ element type=string name=varString//all/complexTypeelement type=string name=echoStringParam/element type=int name=echoIntParam/ element type=string name=echoStringReturn/element type=xsd1:ArrayOfstring_literal name=echoStringArrayParam/element type=xsd1:ArrayOfstring_literal name=echoStringArrayReturn/ element type=xsd1:SOAPStruct name=echoStructParam/element type=xsd1:SOAPStruct name=echoStructReturn//schema/wsdl:types- wsdl:message name=echoStringArraywsdl:part element=xsd1:echoStringArrayParam name=part1//wsdl:message-wsdl:message name=echoStringArrayResponse wsdl:part element=xsd1:echoStringArrayReturn name=part1//wsdl:message-wsdl:message name=echoStringwsdl:part element=xsd1:echoStringParam name=part1/ /wsdl:message-wsdl:message name=echoStringResponsewsdl:part element=xsd1:echoStringReturn name=part1//wsdl:message-wsdl:message name=echoStruct wsdl:part element=xsd1:echoStructParam name=part1//wsdl:message-wsdl:message name=echoStructResponsewsdl:part element=xsd1:echoStructReturn name=part1/ /wsdl:message-wsdl:portType name=Axis2SampleDocLitServicePortType-wsdl:operation name=echoStringArraywsdl:input message=tns:echoStringArray/ wsdl:output message=tns:echoStringArrayResponse//wsdl:operation-wsdl:operation name=echoStringwsdl:input message=tns:echoString/ wsdl:output message=tns:echoStringResponse//wsdl:operation-wsdl:operation name=echoStructwsdl:input message=tns:echoStruct/ wsdl:output message=tns:echoStructResponse//wsdl:operation/wsdl:portType-wsdl:binding type=tns:Axis2SampleDocLitServicePortTypename=Axis2SampleDocLitServiceSOAP11Binding soap:binding style=document transport=http://schemas.xmlsoap.org/soap/http/-wsdl:operation name=echoStringArray soap:operation style=document soapAction=echoStringArray/-wsdl:inputsoap:body namespace= http://userguide.axis2.apache.org/Axis2SampleDocLituse=literal//wsdl:input-wsdl:outputsoap:body namespace= http://userguide.axis2.apache.org/Axis2SampleDocLituse=literal//wsdl:output/wsdl:operation-wsdl:operation name=echoStringsoap:operation style=document soapAction=echoString/ -wsdl:inputsoap:body namespace=http://userguide.axis2.apache.org/Axis2SampleDocLituse=literal/ /wsdl:input-wsdl:outputsoap:body namespace=http://userguide.axis2.apache.org/Axis2SampleDocLituse=literal/ /wsdl:output/wsdl:operation-wsdl:operation name=echoStructsoap:operation style=document soapAction=echoStruct/-wsdl:input soap:body namespace=http://userguide.axis2.apache.org/Axis2SampleDocLituse=literal//wsdl:input- wsdl:outputsoap:body namespace=http://userguide.axis2.apache.org/Axis2SampleDocLituse=literal//wsdl:output /wsdl:operation/wsdl:binding-wsdl:binding type=tns:Axis2SampleDocLitServicePortTypename=Axis2SampleDocLitServiceSOAP12Bindingsoap12:binding style=document transport= http://schemas.xmlsoap.org/soap/http/-wsdl:operation name=echoStringArraysoap12:operation style=document soapAction=echoStringArray/ -wsdl:inputsoap12:body namespace=http://userguide.axis2.apache.org/Axis2SampleDocLit use=literal/ /wsdl:input-wsdl:outputsoap12:body namespace=http://userguide.axis2.apache.org/Axis2SampleDocLit use=literal/ /wsdl:output/wsdl:operation-wsdl:operation name=echoStringsoap12:operation style=document soapAction=echoString/-wsdl:input soap12:body namespace=http://userguide.axis2.apache.org/Axis2SampleDocLit use=literal//wsdl:input-