You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by "Michael Hawes (JIRA)" <ji...@apache.org> on 2014/04/17 16:52:15 UTC
[jira] [Updated] (AXIS2-5645) Error calling web service via
GET/POST with a request type extending another type
[ 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.
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}
If I replace webServiceXsdName.xsd with this code, it works 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 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.
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}
If I replace webServiceXsdName.xsd with this code, it works 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.
> 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}
> If I replace webServiceXsdName.xsd with this code, it works 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