You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Bouche Paul <Pa...@student.hpi.uni-potsdam.de> on 2004/09/06 15:46:19 UTC
Ecoding Problem document vs. rpc
Hello,
I use this list for the first time and maybe this problem has been posted before, if so then please point me to a solution.
when trying to return an array of integers for intance there is the
following problem trying to generate a DOC style service. AXIS still
generates a WSDL document that is trying to bind RPC encoded
schema types to a document style binding. AXIS falsly references the
the RPC style SOAP encoding schema in a DOC style context.
And even when generating a RPC style WSDL for the same service,
according to the last reference this is deligerately non-interoperable
and against the WS-I Basic Profile 1.0.
this is concerning Axis version 1.1.
And still in Axis 1.2beta3 when I try to return a String[] in document literal it creates only a string return value in WSDL and then in the SOAP response creates three child elements of the body element if returning a String[3].
below is the source code, the WSDL and the SOAP for the first problem (all using AXIS 1.1).
source code:
package testhashmapservicealldoc;
public class TestHashMapService {
public String[] sayStringList (String instringlist)
{
String[] ret = new String[] { "one", "two", "three",
instringlist};
return ret;
}
public int[] sayIntList (String inintlist)
{
int[] ret = {1, 2, Integer.parseInt(inintlist)};
return ret;
}
}
deployment descriptor:
<deployment name="test" xmlns=" http://xml.apache.org/axis/wsdd/"
xmlns:java=" http://xml.apache.org/axis/wsdd/providers/java">
<service name="TestHashMapServiceDoc" style="document">
<parameter name="className"
value="testhashmapservicealldoc.TestHashMapService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
generated WSDL document by ?WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace=" http://peter:8080/axis/services/TestHashMapServi
ceDoc" xmlns=" http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap=" http://xml.apache.org/xml-soap"
xmlns:impl=" http://peter:8080/axis/services/TestHashMapServiceDoc"
xmlns:intf=" http://peter:8080/axis/services/TestHashMapServiceDoc"
xmlns:soapenc=" http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1=" http://testhashmapservicealldoc"
xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap=" http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd=" http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace=" http://testhashmapservicealldoc"
xmlns=" http://www.w3.org/2001/XMLSchema">
<element name="instringlist" type="xsd:string"/>
<element name="inintlist" type="xsd:string"/>
</schema>
<schema
targetNamespace=" http://peter:8080/axis/services/TestHashMapServi
ceDoc" xmlns=" http://www.w3.org/2001/XMLSchema">
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
<element name="sayStringListReturn"
type="impl:ArrayOf_xsd_string"/>
<complexType name="ArrayOf_xsd_int">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>
</restriction>
</complexContent>
</complexType>
<element name="sayIntListReturn" type="impl:ArrayOf_xsd_int"/>
</schema>
</wsdl:types>
<wsdl:message name="sayStringListRequest">
<wsdl:part element="tns1:instringlist" name="instringlist"/>
</wsdl:message>
<wsdl:message name="sayIntListRequest">
<wsdl:part element="tns1:inintlist" name="inintlist"/>
</wsdl:message>
<wsdl:message name="sayStringListResponse">
<wsdl:part element="impl:sayStringListReturn"
name="sayStringListReturn"/>
</wsdl:message>
<wsdl:message name="sayIntListResponse">
<wsdl:part element="impl:sayIntListReturn"
name="sayIntListReturn"/>
</wsdl:message>
<wsdl:portType name="TestHashMapService">
<wsdl:operation name="sayStringList"
parameterOrder="instringlist">
<wsdl:input message="impl:sayStringListRequest"
name="sayStringListRequest"/>
<wsdl:output message="impl:sayStringListResponse"
name="sayStringListResponse"/>
</wsdl:operation>
<wsdl:operation name="sayIntList" parameterOrder="inintlist">
<wsdl:input message="impl:sayIntListRequest"
name="sayIntListRequest"/>
<wsdl:output message="impl:sayIntListResponse"
name="sayIntListResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestHashMapServiceDocSoapBinding"
type="impl:TestHashMapService">
<wsdlsoap:binding style="document"
transport=" http://schemas.xmlsoap.org/soap/http"/ <http://schemas.xmlsoap.org/soap/http> >
<wsdl:operation name="sayStringList">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayStringListRequest">
<wsdlsoap:body namespace=" http://testhashmapservicealldoc"
use="literal"/>
</wsdl:input>
<wsdl:output name="sayStringListResponse">
<wsdlsoap:body
namespace=" http://peter:8080/axis/services/TestHashMapServiceDoc"
use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayIntList">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayIntListRequest">
<wsdlsoap:body namespace=" http://testhashmapservicealldoc"
use="literal"/>
</wsdl:input>
<wsdl:output name="sayIntListResponse">
<wsdlsoap:body
namespace=" http://peter:8080/axis/services/TestHashMapServiceDoc"
use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestHashMapServiceService">
<wsdl:port binding="impl:TestHashMapServiceDocSoapBinding"
name="TestHashMapServiceDoc">
<wsdlsoap:address
location=" http://peter:8080/axis/services/TestHashMapServiceDoc"/ <http://peter:8080/axis/services/TestHashMapServiceDoc> >
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Basic Profile Final Version 1.0 WS-I states:
5.2.3 soapenc:Array
The recommendations in WSDL 1.1 Section 2.2 for declaration of
array types have
been interpreted in various ways, leading to interoperability problems.
Further,
there are other clearer ways to declare arrays.
R2110 In a DESCRIPTION, array declarations MUST NOT extend or
restrict the
soapenc:Array type.
R2111 In a DESCRIPTION, array declarations MUST NOT use
wsdl:arrayType attribute
in the type declaration.
R2112 In a DESCRIPTION, array declaration wrapper elements
SHOULD NOT be named
using the convention ArrayOfXXX.
R2113 A MESSAGE containing serialized arrays MUST NOT include
the
soapenc:arrayType attribute.
For example,
INCORRECT:
Given the WSDL Description:
<xsd:element name="MyArray2" type="tns:MyArray2Type"/>
<xsd:complexType name="MyArray2Type"
xmlns:soapenc=" http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl=" http://schemas.xmlsoap.org/wsdl/" >
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:sequence>
<xsd:element name="x" type="xsd:string"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="tns:MyArray2Type[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>The SOAP message would serialize as (omitting
namespace
declarations for clarity):
<MyArray2 soapenc:arrayType="tns:MyArray2Type[]" >
<x>abcd</x>
<x>efgh</x>
</MyArray2>
CORRECT:
Given the WSDL Description:
<xsd:element name="MyArray1" type="tns:MyArray1Type"/>
<xsd:complexType name="MyArray1Type">
<xsd:sequence>
<xsd:element name="x" type="xsd:string"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>The SOAP message would serialize as (omitting
namespace
declarations for clarity):
<MyArray1>
<x>abcd</x>
<x>efgh</x>
</MyArray1>
RE: Ecoding Problem document vs. rpc
Posted by Anne Thomas Manes <an...@manes.net>.
Axis 1.1 has very poor support for document/literal. If you want to use Axis
1.1, then you cannot use java2wsdl to generate the WSDL file. You must
develop the WSDL yourself and run wsdl2java.
Please describe the problem that you're experiencing with Axis 1.2 beta3 in
more detail.
Regards,
Anne
_____
From: Bouche Paul [mailto:Paul.Bouche@student.hpi.uni-potsdam.de]
Sent: Monday, September 06, 2004 9:46 AM
To: Axis User List (E-mail)
Subject: Ecoding Problem document vs. rpc
Hello,
I use this list for the first time and maybe this problem has been posted
before, if so then please point me to a solution.
when trying to return an array of integers for intance there is the
following problem trying to generate a DOC style service. AXIS still
generates a WSDL document that is trying to bind RPC encoded
schema types to a document style binding. AXIS falsly references the
the RPC style SOAP encoding schema in a DOC style context.
And even when generating a RPC style WSDL for the same service,
according to the last reference this is deligerately non-interoperable
and against the WS-I Basic Profile 1.0.
this is concerning Axis version 1.1.
And still in Axis 1.2beta3 when I try to return a String[] in document
literal it creates only a string return value in WSDL and then in the SOAP
response creates three child elements of the body element if returning a
String[3].
below is the source code, the WSDL and the SOAP for the first problem (all
using AXIS 1.1).
source code:
package testhashmapservicealldoc;
public class TestHashMapService {
public String[] sayStringList (String instringlist)
{
String[] ret = new String[] { "one", "two", "three",
instringlist};
return ret;
}
public int[] sayIntList (String inintlist)
{
int[] ret = {1, 2, Integer.parseInt(inintlist)};
return ret;
}
}
deployment descriptor:
<deployment name="test" xmlns="http://xml.apache.org/axis/wsdd/"
xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<service name="TestHashMapServiceDoc" style="document">
<parameter name="className"
value="testhashmapservicealldoc.TestHashMapService"/>
<parameter name="allowedMethods" value="*"/>
</service>
</deployment>
generated WSDL document by ?WSDL:
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions
targetNamespace="http://peter:8080/axis/services/TestHashMapServi
ceDoc" xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap"
xmlns:impl="http://peter:8080/axis/services/TestHashMapServiceDoc"
xmlns:intf="http://peter:8080/axis/services/TestHashMapServiceDoc"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns1="http://testhashmapservicealldoc"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<wsdl:types>
<schema targetNamespace="http://testhashmapservicealldoc"
xmlns="http://www.w3.org/2001/XMLSchema">
<element name="instringlist" type="xsd:string"/>
<element name="inintlist" type="xsd:string"/>
</schema>
<schema
targetNamespace="http://peter:8080/axis/services/TestHashMapServi
ceDoc" xmlns="http://www.w3.org/2001/XMLSchema">
<complexType name="ArrayOf_xsd_string">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType"
wsdl:arrayType="xsd:string[]"/>
</restriction>
</complexContent>
</complexType>
<element name="sayStringListReturn"
type="impl:ArrayOf_xsd_string"/>
<complexType name="ArrayOf_xsd_int">
<complexContent>
<restriction base="soapenc:Array">
<attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:int[]"/>
</restriction>
</complexContent>
</complexType>
<element name="sayIntListReturn" type="impl:ArrayOf_xsd_int"/>
</schema>
</wsdl:types>
<wsdl:message name="sayStringListRequest">
<wsdl:part element="tns1:instringlist" name="instringlist"/>
</wsdl:message>
<wsdl:message name="sayIntListRequest">
<wsdl:part element="tns1:inintlist" name="inintlist"/>
</wsdl:message>
<wsdl:message name="sayStringListResponse">
<wsdl:part element="impl:sayStringListReturn"
name="sayStringListReturn"/>
</wsdl:message>
<wsdl:message name="sayIntListResponse">
<wsdl:part element="impl:sayIntListReturn"
name="sayIntListReturn"/>
</wsdl:message>
<wsdl:portType name="TestHashMapService">
<wsdl:operation name="sayStringList"
parameterOrder="instringlist">
<wsdl:input message="impl:sayStringListRequest"
name="sayStringListRequest"/>
<wsdl:output message="impl:sayStringListResponse"
name="sayStringListResponse"/>
</wsdl:operation>
<wsdl:operation name="sayIntList" parameterOrder="inintlist">
<wsdl:input message="impl:sayIntListRequest"
name="sayIntListRequest"/>
<wsdl:output message="impl:sayIntListResponse"
name="sayIntListResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="TestHashMapServiceDocSoapBinding"
type="impl:TestHashMapService">
<wsdlsoap:binding style="document"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="sayStringList">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayStringListRequest">
<wsdlsoap:body namespace="http://testhashmapservicealldoc"
use="literal"/>
</wsdl:input>
<wsdl:output name="sayStringListResponse">
<wsdlsoap:body
namespace="http://peter:8080/axis/services/TestHashMapServiceDoc"
use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="sayIntList">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="sayIntListRequest">
<wsdlsoap:body namespace="http://testhashmapservicealldoc"
use="literal"/>
</wsdl:input>
<wsdl:output name="sayIntListResponse">
<wsdlsoap:body
namespace="http://peter:8080/axis/services/TestHashMapServiceDoc"
use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="TestHashMapServiceService">
<wsdl:port binding="impl:TestHashMapServiceDocSoapBinding"
name="TestHashMapServiceDoc">
<wsdlsoap:address
location="http://peter:8080/axis/services/TestHashMapServiceDoc"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
Basic Profile Final Version 1.0 WS-I states:
5.2.3 soapenc:Array
The recommendations in WSDL 1.1 Section 2.2 for declaration of
array types have
been interpreted in various ways, leading to interoperability problems.
Further,
there are other clearer ways to declare arrays.
R2110 In a DESCRIPTION, array declarations MUST NOT extend or
restrict the
soapenc:Array type.
R2111 In a DESCRIPTION, array declarations MUST NOT use
wsdl:arrayType attribute
in the type declaration.
R2112 In a DESCRIPTION, array declaration wrapper elements
SHOULD NOT be named
using the convention ArrayOfXXX.
R2113 A MESSAGE containing serialized arrays MUST NOT include
the
soapenc:arrayType attribute.
For example,
INCORRECT:
Given the WSDL Description:
<xsd:element name="MyArray2" type="tns:MyArray2Type"/>
<xsd:complexType name="MyArray2Type"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" >
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:sequence>
<xsd:element name="x" type="xsd:string"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:attribute ref="soapenc:arrayType"
wsdl:arrayType="tns:MyArray2Type[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>The SOAP message would serialize as (omitting
namespace
declarations for clarity):
<MyArray2 soapenc:arrayType="tns:MyArray2Type[]" >
<x>abcd</x>
<x>efgh</x>
</MyArray2>
CORRECT:
Given the WSDL Description:
<xsd:element name="MyArray1" type="tns:MyArray1Type"/>
<xsd:complexType name="MyArray1Type">
<xsd:sequence>
<xsd:element name="x" type="xsd:string"
minOccurs="0" maxOccurs="unbounded"/>
</xsd:sequence>
</xsd:complexType>The SOAP message would serialize as (omitting
namespace
declarations for clarity):
<MyArray1>
<x>abcd</x>
<x>efgh</x>
</MyArray1>