Browser/CURL requests to WS w/response extending a type

Mike Hawes <[email protected]>
Newsgroups gmane.text.xml.axis.user
Message-ID <CANv-AtRiU1P9gHYiBYOmC5pYs8OgeahiO2PH=A8u7d34NQVUaQ@mail.gmail.com>
I've written a web service with Axis2 1.6.2 with a request that extends
another type, with a request element that looks like this in its .xsd:

<xsd:element name="requestName">
    <xsd:complexType>
        <xsd:complexContent>
            <xsd:extension base="requestBaseType">
                <xsd:sequence>
                    <xsd:element name="param1" type="xsd:int" minOccurs="1"
maxOccurs="1" />
                    <xsd:element name="param2" type="xsd:string"
minOccurs="1" maxOccurs="1" />
                    <xsd:element name="param3" type="xsd:int" minOccurs="0"
maxOccurs="1" />
                </xsd:sequence>
            </xsd:extension>
        </xsd:complexContent>
    </xsd:complexType>
</xsd:element>

<xsd:complexType name="requestBaseType">
    <xsd:sequence>
        <xsd:element name="baseTypeParam1" type="xsd:string" minOccurs="0"
maxOccurs="1" />
    </xsd:sequence>
</xsd:complexType>

Sending requests to this web service works just fine if I send the requests
from SoapUI or similar, but if I send the same request via GET from a
browser I get this error:

<faultstring>org.apache.axis2.databinding.ADBException: Unexpected
subelement {http://campusm.gw.com/campusm}requestName</faultstring>

It's saying there's an unexpected element of a type that is the correct
request type, even though in a GET request that request object is implicit.

If I stop it extending requestBaseType, it works fine in both the browser
and SoapUI. Here's the xsd definition that fixes the problem:

<xsd:element name="requestName">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="baseTypeParam1" type="xsd:string"
minOccurs="0" maxOccurs="1" />
            <xsd:element name="param1" type="xsd:int" minOccurs="1"
maxOccurs="1" />
            <xsd:element name="param2" type="xsd:string" minOccurs="1"
maxOccurs="1" />
            <xsd:element name="param3" type="xsd:int" minOccurs="0"
maxOccurs="1" />
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>

Here's an example of the GET request I send in the browser that gets this
error:

http://localhost:8080/path/to/webservice?baseTypeParam1=stuff&param1=12&param2=thing&param3=13

Here's an example of the request I send from SoapUI that works:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:cam="http://campusm.gw.com/campusm">
   <soapenv:Header/>
   <soapenv:Body>
      <cam:requestName>
         <cam:baseTypeParam1>stuff</cam:baseTypeParam1>
         <cam:param1>12</cam:param1>
         <cam:param2>thing</cam:param2>
         <cam:param3>13</cam:param3>
      </cam:requestName>
   </soapenv:Body>
</soapenv:Envelope>

I need the request to extend a type so that I can have multiple web
services sending a large common subset of their request parameters to the
same function in my Java code. This would allow the function to take a
parameter of the base request type, and have each web service just pass its
request into that function without any conversion or worring about the
individual parameters at that point.

I also need to be able to call the web services with CURL, which is not
possible if the web services won't work with a GET request.

This seems to be a bug with Axis2. Is this a known issue and will it be
fixed?

Best regards,
Mike

-- 
campusM: http://www.campusM.com
Email: [email protected]
Tel: 01902 837451
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.