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 Russell Butek <bu...@us.ibm.com> on 2002/01/29 16:49:32 UTC
Re: interpretation of minoccurs/maxoccurs in sequence elements
(I'm cross posting this to axis-dev.)
Matthew, do you know whether this is a common convention? It's ALMOST the
same as nillable=true and from my knowledge, that is more prevalent.
The spec is probably too loose here. What do other folks think? How
should this type be interpreted?
Russell Butek
butek@us.ibm.com
"J. Matthew Pryor" <ma...@versata.com> on 01/27/2002 09:36:45 PM
Please respond to axis-user@xml.apache.org
To: <ax...@xml.apache.org>
cc:
Subject: interpretation of minoccurs/maxoccurs in sequence elements
Hello,
The WSDL at this address (
http://www.richsolutions.com/RichPayments/RichCardValidator.asmx?WSDL )
uses
a convention to define the input type of certain operations
<s:element name="GetCardType">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="CardNumber"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
Now WSDL2Java interprets that as meaning an Array of java.lang.String with
Zero or One elements and generates code that marshals it as such, i.e.
<CardNumber>
<item>1111222233334444</item>
</CardNumber>
However invoking this service returns an error
<soap:Fault>
<faultcode>soap:Client</faultcode>
<faultstring>Server was unable to read request. --> There is an
error in XML document (6, 6). --> 'Element' is an invalid node type.
Line
6, position 6.</faultstring>
<detail />
</soap:Fault>
If I change the WSDL to specify exactly one in the sequence element i.e.
<s:element name="GetCardType">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" name="CardNumber"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
Of course I get code generated that just expects a single String, and I can
invoke the service without error.
My question is this, who is mis-interpreting the XML Schema to Java type
mapping ?
I must confess I really don't know what standard this would be covered
under.
I can imagine that this may be under-specified and we have to differing
interpretations, but I was wondering if there is a definitive statement.
I have very little .Net experience, but many of the .Net services I have
seen WSDL for use this convention and it would be nice for AXIS developed
clients to be able to inter-operate.
Thanks for any clarification
Matthew
---
Re: interpretation of minoccurs/maxoccurs in sequence elements
Posted by Simon Fell <so...@zaks.demon.co.uk>.
looking through the WSDL, its using doc/literal with element
references in the parts, so with
<message name="GetCardTypeSoapIn">
<part name="parameters" element="s0:GetCardType" />
</message>
<s:element name="GetCardType">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="CardNumber" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
The correct serializations are
[occurs=0]
<ns:GetCardType>
</ns:GetCardType>
or [occurs=1]
<ns:GetCardType>
<ns:CardNumber>1234</ns:CardNumber>
</ns:GetCardType>
Cheers
Simon
www.pocketsoap.com
On Tue, 29 Jan 2002 09:49:32 -0600, in soap you wrote:
>(I'm cross posting this to axis-dev.)
>
>Matthew, do you know whether this is a common convention? It's ALMOST the
>same as nillable=true and from my knowledge, that is more prevalent.
>
>The spec is probably too loose here. What do other folks think? How
>should this type be interpreted?
>
>Russell Butek
>butek@us.ibm.com
>
>
>"J. Matthew Pryor" <ma...@versata.com> on 01/27/2002 09:36:45 PM
>
>Please respond to axis-user@xml.apache.org
>
>To: <ax...@xml.apache.org>
>cc:
>Subject: interpretation of minoccurs/maxoccurs in sequence elements
>
>
>
>Hello,
>
>The WSDL at this address (
>http://www.richsolutions.com/RichPayments/RichCardValidator.asmx?WSDL )
>uses
>a convention to define the input type of certain operations
>
><s:element name="GetCardType">
> <s:complexType>
> <s:sequence>
> <s:element minOccurs="0" maxOccurs="1" name="CardNumber"
>type="s:string" />
> </s:sequence>
> </s:complexType>
></s:element>
>
>Now WSDL2Java interprets that as meaning an Array of java.lang.String with
>Zero or One elements and generates code that marshals it as such, i.e.
>
><CardNumber>
> <item>1111222233334444</item>
></CardNumber>
>
>However invoking this service returns an error
>
> <soap:Fault>
> <faultcode>soap:Client</faultcode>
> <faultstring>Server was unable to read request. --> There is an
>error in XML document (6, 6). --> 'Element' is an invalid node type.
>Line
>6, position 6.</faultstring>
> <detail />
> </soap:Fault>
>
>If I change the WSDL to specify exactly one in the sequence element i.e.
><s:element name="GetCardType">
> <s:complexType>
> <s:sequence>
> <s:element minOccurs="1" maxOccurs="1" name="CardNumber"
>type="s:string" />
> </s:sequence>
> </s:complexType>
></s:element>
>
>Of course I get code generated that just expects a single String, and I can
>invoke the service without error.
>
>My question is this, who is mis-interpreting the XML Schema to Java type
>mapping ?
>
>I must confess I really don't know what standard this would be covered
>under.
>
>I can imagine that this may be under-specified and we have to differing
>interpretations, but I was wondering if there is a definitive statement.
>
>I have very little .Net experience, but many of the .Net services I have
>seen WSDL for use this convention and it would be nice for AXIS developed
>clients to be able to inter-operate.
>
>Thanks for any clarification
>
>Matthew
>---
>
>