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 iksrazal <ik...@gmail.com> on 2005/12/06 12:44:11 UTC

Re: Problem with [sequence.choice.element] structure in WSDL2Java?

Just a simple thought - have you thought about defining an Array in your wsdl 
and returning that? Simply create a List on the service side and use 
toArray() ? 

iksrazal

Em Terça 06 Dezembro 2005 10:20, o Tim R J Langford escreveu:
> Greetings All,
>
>
> 1) I am having a problem with the WSDL2Java code generated from the
> current schema element :
>
>
> <s:complexType name="ParagraphType">
>     <s:sequence>
>         <s:choice minOccurs="0" maxOccurs="unbounded">
>             <s:element minOccurs="0" maxOccurs="1" name="Text"
> type="s1:FormattedTextTextType"/>
>             <s:element minOccurs="0" maxOccurs="1" name="Image"
> type="s:string"/>
>             <s:element minOccurs="0" maxOccurs="1" name="URL"
> type="s:anyURI"/>
>         </s:choice>
>     </s:sequence>
>     <s:attribute name="ParagraphNumber" type="s:nonNegativeInteger"/>
> </s:complexType>
>
>
>
> 2) This schema represents (among other things) such messages as :
>
> <VendorMessage Title="XXXImages" Language="en" InfoType="URI">
>     <SubSection SubTitle="95" SubSectionNumber="1">
>         <Paragraph ParagraphNumber="1">
>            <URL>http://www.XXX.com/1.gif</URL>
>            <URL>http://www.XXX.com/2.gif</URL>
>            <URL>http://www.XXX.com/3.gif</URL>
>            <URL>http://www.XXX.com/4.gif</URL>
>            <URL>http://www.XXX.com/5.gif</URL>
>            <URL>http://www.XXX.com/6.gif</URL>
>         </Paragraph>
>     </SubSection>
> </VendorMessage>
>
>
> 3) However the corresponding ParagraphType class generated by WSDL2Java
> has the following member variables generated (which are not sets of the
> corresponding elements) :
>
>     private org.opentravel.www.OTA._2003._05.FormattedTextTextType text;
>     private java.lang.String image;
>     private org.apache.axis.types.URI URL;
>     private org.apache.axis.types.NonNegativeInteger paragraphNumber;
> // attribute
>
> 4) So when the message is unmarshalled only the final <URL>  (in this
> example) is available through the accessor method of the unmarshalled
> bean and the others are lost...
>
> I have looked though the other WSDL posts on this forum but cannot seem
> to find a solution. Is there are special parameter I should set when
> generating the Java, or is this possibly a bug in the generator (the
> schema does seem a slightly esoteric way of defining the structure)?
>
> Any help would be greatfully appreciated because this has become a bit
> of a show stopper to the project.
>
> Thankyou for your time,
>
> Tim

Re: Problem with [sequence.choice.element] structure in WSDL2Java?

Posted by Tim R J Langford <ti...@multicom.co.uk>.
Hello Everyone,

Thanks for your response Iksreal. Unfortunately I cannot change the 
schema because it si published and my webservice is a client of it 
(hence I have no control overs its definition). The schema is valid (if 
a slightly strange way of epxressing the structure) as far as I can see, 
but the beans generated by WSDL are incorrect I think, as it should 
produce a collection of  {URL, Text, Image} elements. Although I can 
imagine why the generation has failed due to the any allowable ordering 
of the elements.

Is this a bug? Should I submit it it to some JIRA/bug tracking mechanism?

Kind Regards,

Tim

PS: Sorry if this is a duplicate posting - we have had some problems 
with our mail servers.


iksrazal wrote:

>Just a simple thought - have you thought about defining an Array in your wsdl 
>and returning that? Simply create a List on the service side and use 
>toArray() ? 
>
>iksrazal
>
>Em Terça 06 Dezembro 2005 10:20, o Tim R J Langford escreveu:
>  
>
>>Greetings All,
>>
>>
>>1) I am having a problem with the WSDL2Java code generated from the
>>current schema element :
>>
>>
>><s:complexType name="ParagraphType">
>>    <s:sequence>
>>        <s:choice minOccurs="0" maxOccurs="unbounded">
>>            <s:element minOccurs="0" maxOccurs="1" name="Text"
>>type="s1:FormattedTextTextType"/>
>>            <s:element minOccurs="0" maxOccurs="1" name="Image"
>>type="s:string"/>
>>            <s:element minOccurs="0" maxOccurs="1" name="URL"
>>type="s:anyURI"/>
>>        </s:choice>
>>    </s:sequence>
>>    <s:attribute name="ParagraphNumber" type="s:nonNegativeInteger"/>
>></s:complexType>
>>
>>
>>
>>2) This schema represents (among other things) such messages as :
>>
>><VendorMessage Title="XXXImages" Language="en" InfoType="URI">
>>    <SubSection SubTitle="95" SubSectionNumber="1">
>>        <Paragraph ParagraphNumber="1">
>>           <URL>http://www.XXX.com/1.gif</URL>
>>           <URL>http://www.XXX.com/2.gif</URL>
>>           <URL>http://www.XXX.com/3.gif</URL>
>>           <URL>http://www.XXX.com/4.gif</URL>
>>           <URL>http://www.XXX.com/5.gif</URL>
>>           <URL>http://www.XXX.com/6.gif</URL>
>>        </Paragraph>
>>    </SubSection>
>></VendorMessage>
>>
>>
>>3) However the corresponding ParagraphType class generated by WSDL2Java
>>has the following member variables generated (which are not sets of the
>>corresponding elements) :
>>
>>    private org.opentravel.www.OTA._2003._05.FormattedTextTextType text;
>>    private java.lang.String image;
>>    private org.apache.axis.types.URI URL;
>>    private org.apache.axis.types.NonNegativeInteger paragraphNumber;
>>// attribute
>>
>>4) So when the message is unmarshalled only the final <URL>  (in this
>>example) is available through the accessor method of the unmarshalled
>>bean and the others are lost...
>>
>>I have looked though the other WSDL posts on this forum but cannot seem
>>to find a solution. Is there are special parameter I should set when
>>generating the Java, or is this possibly a bug in the generator (the
>>schema does seem a slightly esoteric way of defining the structure)?
>>
>>Any help would be greatfully appreciated because this has become a bit
>>of a show stopper to the project.
>>
>>Thankyou for your time,
>>
>>Tim
>>    
>>
>
>  
>