Problems with optional parameters while using REST endpoint.

Shiv Shankar <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <CABjUeKtt8TcfOhH3-geH-h-ehD71L5W3sUx8TQRRYLXmfGvn2w@mail.gmail.com>
Hello,

One of my service have optional elements specified. When I use SOAP and
send xml request with the optional parameter missing, it works fine. But
when I do a GET request to the REST endpoint it complains about the missing
optional parameter. If I include the optional parameter in the GET request,
the service works fine.

Is this a genuine limitation of Axis2. If not, what should I do to fix it?

Snippets,

*wsdl*

<xs:element name="TestRequest">
    <xs:complexType>
    <xs:sequence>
        <xs:element name="id" type="xs:string"/>
        <xs:element minOccurs="0" name="item" type="xs:string"/>
    </xs:sequence>
    </xs:complexType>
</xs:element>

*Case 1*

http://localhost/servlet/services/TestService/test?id=123

*Error *:

<soapenv:Fault>
   <faultcode/>
   <faultstring>Required element item defined in the schema can not be
found in the request; nested exception is:
org.apache.axis2.AxisFault: Required element item defined in the schema can
not be found in the request
    </faultstring>
    <detail/>
</soapenv:Fault>

*Case 2*

http://localhost/servlet/services/TestService/test?id=123&item=boombox

*Gives expected results*.

Thanks,
Shiv
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.