axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Hawes (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (AXIS2-5645) Error calling web service via GET/POST with a request type extending another type
Date Thu, 17 Apr 2014 14:58:14 GMT

     [ https://issues.apache.org/jira/browse/AXIS2-5645?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

Michael Hawes updated AXIS2-5645:
---------------------------------

    Description: 
I've written a web service with a request that extends another type. I've written it by generating
Java code from a .wsdl with org.apache.axis2.tool.ant.AntCodegenTask, and I'm running it in
Tomcat 6.0. I can call it without a problem if I send the requests from SoapUI or similar,
but if I send the same request via GET or POST from a browser or using CURL, I get this error:

{code:xml}<faultstring>org.apache.axis2.databinding.ADBException: Unexpected subelement
{http://domain.company.com/product}requestName</faultstring>{code}

It's saying there's an unexpected element of a type that is actually the correct request type,
even though in a GET/POST request that request object is implicit. If I stop it extending
the request's base type, it works fine in both the browser and SoapUI.

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.

Here's the setup from my .wsdl:

webservices.wsdl:

{code:xml}<definitions targetNamespace="http://domain.company.com/product"
    xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://domain.company.com/product"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:cm="http://domain.company.com/product"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/">

    <types>
        <schema elementFormDefault="qualified" targetNamespace="http://domain.company.com/product"
            xmlns="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="http://xml.apache.org/xml-soap"
            xmlns:tns="http://domain.company.com/product" xmlns:intf="http://domain.company.com/product"
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:cm="http://domain.company.com/product">

            <include schemaLocation="webServiceXsdName.xsd" />

            ...

        </schema>
    </types>

    ... (web service set up here, along with other working services that are callable by both
SoapUI and GET/POST)

</definitions>{code}

webServiceXsdName.xsd:

{code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://domain.company.com/product" targetNamespace="http://domain.company.com/product"
    elementFormDefault="qualified">

    <xsd:include schemaLocation="baseTypesXsdName.xsd" />
   
    <xsd:element name="requestName">
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="requestBaseType">
                    <xsd:sequence>
                        <xsd:element name="param1" type="xsd:int" minOccurs="0" maxOccurs="1"
/>
                    </xsd:sequence>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>

    ...

</xsd:schema>{code}

baseTypesXsdName.xsd:

{code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://domain.company.com/product"
targetNamespace="http://domain.company.com/product" elementFormDefault="qualified">

    <xsd:complexType name="requestBaseType">
        <xsd:sequence>
            <xsd:element name="baseParam1" type="xsd:int" minOccurs="1" maxOccurs="1" />
            <xsd:element name="baseParam2" type="xsd:string" minOccurs="1" maxOccurs="1"
/>
            <xsd:element name="baseParam3" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="true" />
            <xsd:element name="baseParam4" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
            <xsd:element name="baseParam5" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
        </xsd:sequence>
    </xsd:complexType>

    ...

</xsd:schema>{code}

Here's the code for webServiceXsdName.xsd without the type extension. This code works just
fine:

{code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://domain.company.com/product" targetNamespace="http://domain.company.com/product"
    elementFormDefault="qualified">
   
    <xsd:element name="requestName">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="baseParam1" type="xsd:int" minOccurs="1" maxOccurs="1"
/>
                <xsd:element name="baseParam2" type="xsd:string" minOccurs="1" maxOccurs="1"
/>
                <xsd:element name="baseParam3" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="true" />
                <xsd:element name="baseParam4" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
                <xsd:element name="baseParam5" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
                <xsd:element name="param1" type="xsd:int" minOccurs="0" maxOccurs="1" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    ...

</xsd:schema>{code}

  was:
I've written a web service with a request that extends another type. I've written it by generating
Java code from a .wsdl with org.apache.axis2.tool.ant.AntCodegenTask, and I'm running it in
Tomcat 6.0. I can call it without a problem if I send the requests from SoapUI or similar,
but if I send the same request via GET or POST from a browser or using CURL, I get this error:

{code:xml}<faultstring>org.apache.axis2.databinding.ADBException: Unexpected subelement
{http://domain.company.com/product}requestName</faultstring>{code}

It's saying there's an unexpected element of a type that is actually the correct request type,
even though in a GET/POST request that request object is implicit. If I stop it extending
the request's base type, it works fine in both the browser and SoapUI.

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 can work around the problem but it makes things messy if I want
to still be able to use CURL, and I do need that ability.

Here's the setup from my .wsdl:

webservices.wsdl:

{code:xml}<definitions targetNamespace="http://domain.company.com/product"
    xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://domain.company.com/product"
    xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:cm="http://domain.company.com/product"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/">

    <types>
        <schema elementFormDefault="qualified" targetNamespace="http://domain.company.com/product"
            xmlns="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="http://xml.apache.org/xml-soap"
            xmlns:tns="http://domain.company.com/product" xmlns:intf="http://domain.company.com/product"
            xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:cm="http://domain.company.com/product">

            <include schemaLocation="webServiceXsdName.xsd" />

            ...

        </schema>
    </types>

    ... (web service set up here, along with other working services that are callable by both
SoapUI and GET/POST)

</definitions>{code}

webServiceXsdName.xsd:

{code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://domain.company.com/product" targetNamespace="http://domain.company.com/product"
    elementFormDefault="qualified">

    <xsd:include schemaLocation="baseTypesXsdName.xsd" />
   
    <xsd:element name="requestName">
        <xsd:complexType>
            <xsd:complexContent>
                <xsd:extension base="requestBaseType">
                    <xsd:sequence>
                        <xsd:element name="param1" type="xsd:int" minOccurs="0" maxOccurs="1"
/>
                    </xsd:sequence>
                </xsd:extension>
            </xsd:complexContent>
        </xsd:complexType>
    </xsd:element>

    ...

</xsd:schema>{code}

baseTypesXsdName.xsd:

{code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://domain.company.com/product"
targetNamespace="http://domain.company.com/product" elementFormDefault="qualified">

    <xsd:complexType name="requestBaseType">
        <xsd:sequence>
            <xsd:element name="baseParam1" type="xsd:int" minOccurs="1" maxOccurs="1" />
            <xsd:element name="baseParam2" type="xsd:string" minOccurs="1" maxOccurs="1"
/>
            <xsd:element name="baseParam3" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="true" />
            <xsd:element name="baseParam4" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
            <xsd:element name="baseParam5" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
        </xsd:sequence>
    </xsd:complexType>

    ...

</xsd:schema>{code}

Here's the code for webServiceXsdName.xsd without the type extension. This code works just
fine:

{code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns="http://domain.company.com/product" targetNamespace="http://domain.company.com/product"
    elementFormDefault="qualified">
   
    <xsd:element name="requestName">
        <xsd:complexType>
            <xsd:sequence>
                <xsd:element name="baseParam1" type="xsd:int" minOccurs="1" maxOccurs="1"
/>
                <xsd:element name="baseParam2" type="xsd:string" minOccurs="1" maxOccurs="1"
/>
                <xsd:element name="baseParam3" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="true" />
                <xsd:element name="baseParam4" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
                <xsd:element name="baseParam5" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
                <xsd:element name="param1" type="xsd:int" minOccurs="0" maxOccurs="1" />
            </xsd:sequence>
        </xsd:complexType>
    </xsd:element>

    ...

</xsd:schema>{code}


> Error calling web service via GET/POST with a request type extending another type
> ---------------------------------------------------------------------------------
>
>                 Key: AXIS2-5645
>                 URL: https://issues.apache.org/jira/browse/AXIS2-5645
>             Project: Axis2
>          Issue Type: Bug
>          Components: adb, codegen
>    Affects Versions: 1.6.2
>         Environment: Tomcat 6.0 running on Windows 8 x64
>            Reporter: Michael Hawes
>
> I've written a web service with a request that extends another type. I've written it
by generating Java code from a .wsdl with org.apache.axis2.tool.ant.AntCodegenTask, and I'm
running it in Tomcat 6.0. I can call it without a problem if I send the requests from SoapUI
or similar, but if I send the same request via GET or POST from a browser or using CURL, I
get this error:
> {code:xml}<faultstring>org.apache.axis2.databinding.ADBException: Unexpected subelement
{http://domain.company.com/product}requestName</faultstring>{code}
> It's saying there's an unexpected element of a type that is actually the correct request
type, even though in a GET/POST request that request object is implicit. If I stop it extending
the request's base type, it works fine in both the browser and SoapUI.
> 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.
> Here's the setup from my .wsdl:
> webservices.wsdl:
> {code:xml}<definitions targetNamespace="http://domain.company.com/product"
>     xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://domain.company.com/product"
>     xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
>     xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
>     xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:cm="http://domain.company.com/product"
>     xmlns:http="http://schemas.xmlsoap.org/wsdl/http/">
>     <types>
>         <schema elementFormDefault="qualified" targetNamespace="http://domain.company.com/product"
>             xmlns="http://www.w3.org/2001/XMLSchema" xmlns:apachesoap="http://xml.apache.org/xml-soap"
>             xmlns:tns="http://domain.company.com/product" xmlns:intf="http://domain.company.com/product"
>             xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:cm="http://domain.company.com/product">
>             <include schemaLocation="webServiceXsdName.xsd" />
>             ...
>         </schema>
>     </types>
>     ... (web service set up here, along with other working services that are callable
by both SoapUI and GET/POST)
> </definitions>{code}
> webServiceXsdName.xsd:
> {code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     xmlns="http://domain.company.com/product" targetNamespace="http://domain.company.com/product"
>     elementFormDefault="qualified">
>     <xsd:include schemaLocation="baseTypesXsdName.xsd" />
>    
>     <xsd:element name="requestName">
>         <xsd:complexType>
>             <xsd:complexContent>
>                 <xsd:extension base="requestBaseType">
>                     <xsd:sequence>
>                         <xsd:element name="param1" type="xsd:int" minOccurs="0" maxOccurs="1"
/>
>                     </xsd:sequence>
>                 </xsd:extension>
>             </xsd:complexContent>
>         </xsd:complexType>
>     </xsd:element>
>     ...
> </xsd:schema>{code}
> baseTypesXsdName.xsd:
> {code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://domain.company.com/product"
targetNamespace="http://domain.company.com/product" elementFormDefault="qualified">
>     <xsd:complexType name="requestBaseType">
>         <xsd:sequence>
>             <xsd:element name="baseParam1" type="xsd:int" minOccurs="1" maxOccurs="1"
/>
>             <xsd:element name="baseParam2" type="xsd:string" minOccurs="1" maxOccurs="1"
/>
>             <xsd:element name="baseParam3" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="true" />
>             <xsd:element name="baseParam4" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
>             <xsd:element name="baseParam5" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
>         </xsd:sequence>
>     </xsd:complexType>
>     ...
> </xsd:schema>{code}
> Here's the code for webServiceXsdName.xsd without the type extension. This code works
just fine:
> {code:xml}<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
>     xmlns="http://domain.company.com/product" targetNamespace="http://domain.company.com/product"
>     elementFormDefault="qualified">
>    
>     <xsd:element name="requestName">
>         <xsd:complexType>
>             <xsd:sequence>
>                 <xsd:element name="baseParam1" type="xsd:int" minOccurs="1" maxOccurs="1"
/>
>                 <xsd:element name="baseParam2" type="xsd:string" minOccurs="1" maxOccurs="1"
/>
>                 <xsd:element name="baseParam3" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="true" />
>                 <xsd:element name="baseParam4" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
>                 <xsd:element name="baseParam5" type="xsd:boolean" minOccurs="0" maxOccurs="1"
default="false" />
>                 <xsd:element name="param1" type="xsd:int" minOccurs="0" maxOccurs="1"
/>
>             </xsd:sequence>
>         </xsd:complexType>
>     </xsd:element>
>     ...
> </xsd:schema>{code}



--
This message was sent by Atlassian JIRA
(v6.2#6252)

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@axis.apache.org
For additional commands, e-mail: java-dev-help@axis.apache.org


Mime
View raw message