Kishanthan, Sagara, anyone.. Can someone assist with my problem? I cannot get my web service to work via REST. It works perfectly with a SOAP request.
Thanks. J ________________________________ From: Jack Sprat <rexclaim...@yahoo.com> To: "java-user@axis.apache.org" <java-user@axis.apache.org> Sent: Monday, July 23, 2012 4:35 PM Subject: Re: [Axis2] REST web service Hi Kishanthan. I'm fairly certain that the WSDL is correct. It works fine with a SOAP request and "echoRequest" is the correct element name. With REST I get a response with the correct format but the value is blank (see my first message for the details). I don't know where the code snippet you included below came from. This is the snippet from the WSDL: <xsd:simpleType name="EchoRequestType"> <xsd:restriction base="xsd:string"> <xsd:maxLength value="100"/> </xsd:restriction> </xsd:simpleType> The following SOAP request works fine: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/%22; xmlns:ship="http://ws.estesexpress.com/shipmenttracking%22;> <soapenv:Header/> <soapenv:Body> <ship:echoRequest>ping</ship:echoRequest> </soapenv:Body> </soapenv:Envelope> I still don't know where the problem lies. Any help is appreciated. Thanks, J ________________________________ From: Kishanthan Thangarajah <kshanth2...@gmail.com> To: java-user@axis.apache.org; Jack Sprat <rexclaim...@yahoo.com> Cc: "axis-u...@ws.apache.org" <axis-u...@ws.apache.org> Sent: Saturday, July 21, 2012 3:25 PM Subject: Re: [Axis2] REST web service Hi, On Fri, Jul 6, 2012 at 2:39 AM, Jack Sprat <rexclaim...@yahoo.com> wrote: I have a WSDL 1.1 web service with 2 operations. The service was generated from the WSDL with Axis2 1.6.1. One operation is a simple echo that I am trying to invoke via REST. The echo operation should return the request string in the response. I can access the operation but nothing comes back in the response. I thought it should work like this: >http://mywebservice.com/test/services/ShipmentTrackingService/echo?echoRequest=test > > I went through the given wsdl and schema. I think the issue here is that "echoRequest" is not the name of the request element defined in wsdl and that is why having it in the url fails. The following is my understanding on how to make this work. For example, if you have the following as the definition for EchoRequestType in your wsdl, <xsd:complexType name="EchoRequestType"> <xsd:sequence> <xsd:element minOccurs="0" name="val" nillable="true" type="xsd:string"/> </xsd:sequence> </xsd:complexType> Then invoking the echo operation via REST would be like, http://localhost:8080/axis2/services/ShipmentTrackingService/echo?val=thissstest You can see that the name of request element is "val" and it is given as the request parameter in the url. Thanks, Kishanthan. I get a response but there is nothing in the response element. It works fine when invoked via SOAP with soapUI. The response I get is: ><ship:echoResponse xmlns:ship=http://mynamespace.com/shipmenttracking; /> > >The pertinent parts of the WSDL are shown below. > ><wsdl:types> ><xsd:schema attributeFormDefault="qualified" elementFormDefault="qualified" >targetNamespace="http://mywebservice.com/shipmenttracking%22; >xmlns:xsd="http://www.w3.org/2001/XMLSchema%22%3Epe%3E%3Cxsd:simpleType >name="EchoRequestType"> ><xsd:restriction base="xsd:string"> ><xsd:maxLength value="100"/> ></xsd:restriction> ></xsd:simpleType> ><!-- Echo Request Type --> ><xsd:element name="echoRequest" type="tns:EchoRequestType"/> ><!-- Echo Response Type --><xsd:element name="echoResponse" type="xsd:string"/> ></xsd:schema> ></wsdl:types> > ><!-- Define SOAP message names. --> ><wsdl:message name="echoRequestMsg"><wsdl:part name="echoRequest" >element="tns:echoRequest"></wsdl:part></wsdl:message> ><wsdl:message name="echoResponseMsg"><wsdl:part name="echoResponse" >element="tns:echoResponse"></wsdl:part></wsdl:message> > >Any help is appreciated. > >Thanks. >J --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org For additional commands, e-mail: java-user-h...@axis.apache.org