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 Shehan Simen <ss...@itree.com.au> on 2008/09/12 06:04:01 UTC

wsdl2java and wsdl problem

Hi,
I have  a question about wsdl. The wsdl2java fails in following case. But I feel the wsdl is wrong.
I got the following element in a complex type.

<s:complexType name="ResponseBusinessEntity" mixed="false">
<s:complexContent mixed="false">
<s:extension base="tns:ResponseBody">
<s:sequence>
<s:choice minOccurs="0" maxOccurs="unbounded">
                        <s:element name="legalName" type="tns:IndividualName" minOccurs="0"/>
                        <s:element name="mainName" type="tns:OrganisationName" minOccurs="0"/>
</s:choice>
</s:sequence>
            </s:extension>
            </s:complexContent>
</s:complexType>

I believe this is logically wrong or useless. The choice is multiple. What is the use of it?
Does this means there can be 5 choices with 3 legalName and 2 mainName? Then what is use of choice? We can just use both of them without choice, but with minOccurs="0" maxOccurs="unbounded"
 I believe it should be as follows.

<s:choice minOccurs="0" maxOccurs="1">
                        <s:element name="legalName" type="tns:IndividualName" minOccurs="0" maxOccurs="unbounded"/>
                        <s:element name="mainName" type="tns:OrganisationName" minOccurs="0" maxOccurs="unbounded"/>
</s:choice>

Anyway axis2 does not generate stub properly for the first case.
What do you guys think?

Please let me know if I am wrong.



Re: wsdl2java and wsdl problem

Posted by sh_santosh <sa...@gmail.com>.
Dear Anne,

I need to expose java web services. I am using Axis1.4, Java 1.5 and Tomcat
5.0 for exposing services.

SOAP request and SOAP response have 'authentication' tag in SOAP header.

SOAP Request -

<S:Envelope>
        <S:Header>
             <authentication>
                   <userid>UserName</userid>
                   <password>Password</password>
            </authentication>
        </S:Header>
        <S:Body>
              <OTA_TestAvailRQ EchoToken="LI" Target="Production"
Version="1.0">
              .......................................
              </OTA_TestAvailRQ>
        </S:Body>
</S:Envelope>
--------------------------------------------------------------
SOAP response  -

<S:Envelope>
        <S:Header>
             <wsp:authentication>
                     <wsp:userid>XXUserName</wsp:userid>
                     <wsp:password>XXPassword</wsp:password>
                     <wsp:payloadVersion>2007B</wsp:payloadVersion>
            </wsp:authentication>
        </S:Header>
        <S:Body>
               <OTA_TestAvailRS EchoToken="LI" PrimaryLangID="en"
Target="Production"                                               
TimeStamp="2009-03-24T20:26:37.058+01:00" Version="1.006">
              ................
              </OTA_TestAvailRS>
        </S:Body>
</S:Envelope>

By seeing the SOAP message structure, we have decided to add SOAP header
explicitly in WSDL.
We are NOT able  to differentiate between SOAP request and SOAP response
'authentication' tag in WSDL.

We have attempted to solve the above problem by creating 2 different type of
WSDL.
Please have look into these wsdl.

WSDL-1 :

<wsdl:definitions targetNamespace="http://test.com"
xmlns:tns="http://test.com"
        xmlns="http://schemas.xmlsoap.org/wsdl/"
        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>
                <xsd:schema targetNamespace="http://test.com">
                <!-- SOAP Request Header -->
                        <xsd:element name="Authentication">
                        <xsd:complexType>
                                <xsd:sequence>
                                        <xsd:element minOccurs="1"
maxOccurs="1" name="userid" type="xsd:string"/>
                                        <xsd:element minOccurs="1"
maxOccurs="1" name="password" type="xsd:string"/>                                        
                                </xsd:sequence>
                        </xsd:complexType>
            </xsd:element>
            <!-- SOAP Response Header -->
            <xsd:element name="Authentication">
                        <xsd:complexType>
                                <xsd:sequence>
                                        <xsd:element minOccurs="1"
maxOccurs="1" name="userid" type="xsd:string"/>
                                        <xsd:element minOccurs="1"
maxOccurs="1" name="password" type="xsd:string"/>
                                        <xs:element minOccurs="1"
maxOccurs="1" name="payloadVersion" type="xs:string"/>                                        
                                </xsd:sequence>
                        </xsd:complexType>
            </xsd:element>
                </xsd:schema>
   </wsdl:types>
   
   
   <wsdl:message name="HelloMessage">
     <wsdl:part name="headerRQ" element="tns:Authentication"/>    
      <wsdl:part name="body" type="xsd:string"/>
   </wsdl:message>
   <wsdl:message name="HelloMessageResponse">  
      <wsdl:part name="headerRS" element="tns:Authentication"/>  
      <wsdl:part name="body" type="xsd:string"/>
   </wsdl:message>
   <wsdl:portType name="HelloPortType">
      <wsdl:operation name="sayHello">
         <wsdl:input message="tns:HelloMessage"/>
         <wsdl:output message="tns:HelloMessageResponse"/>
         </wsdl:operation>
      </wsdl:portType>
      <wsdl:binding name="HelloBinding" type="tns:HelloPortType">
         <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
         <wsdl:operation name="sayHello">
         <wsdlsoap:operation soapAction="" />
            <wsdl:input>
               <wsdlsoap:body use="literal"/>              
               <wsdlsoap:header part="header" use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <wsdlsoap:body use="literal"/>
            <wsdlsoap:header part="header" use="literal"/>          
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   <wsdl:service name="HelloService">
      <wsdl:port binding="tns:HelloBinding" name="HelloPort">
         <wsdlsoap:address
location="http://localhost:8080/hello-service/hello-service"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>

WSDL-2 :

<wsdl:definitions targetNamespace="http://test.com"
xmlns:tns="http://test.com"
        xmlns="http://schemas.xmlsoap.org/wsdl/"
        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>
                <xsd:schema targetNamespace="http://test.com">
                <!-- SOAP Request Header -->
                        <xsd:element name="Authentication">
                        <xsd:complexType>
                                <xsd:sequence>
                                        <xsd:element minOccurs="1"
maxOccurs="1" name="userid" type="xsd:string"/>
                                        <xsd:element minOccurs="1"
maxOccurs="1" name="password" type="xsd:string"/>                                        
                                </xsd:sequence>
                        </xsd:complexType>
            </xsd:element>
            <!-- SOAP Response Header -->
            <xsd:element name="Authentication">
                        <xsd:complexType>
                                <xsd:sequence>
                                        <xsd:element minOccurs="1"
maxOccurs="1" name="userid" type="xsd:string"/>
                                        <xsd:element minOccurs="1"
maxOccurs="1" name="password" type="xsd:string"/>
                                        <xs:element minOccurs="1"
maxOccurs="1" name="payloadVersion" type="xs:string"/>                                        
                                </xsd:sequence>
                        </xsd:complexType>
            </xsd:element>
                </xsd:schema>
   </wsdl:types>
   
   <wsdl:message name="headerRQ">
     <wsdl:part name="header" element="tns:Authentication"/>        
   </wsdl:message>
   
   <wsdl:message name="headerRS">
     <wsdl:part name="header" element="tns:Authentication"/>      
   </wsdl:message>  
   
   <wsdl:message name="HelloMessage">      
      <wsdl:part name="body" type="xsd:string"/>
   </wsdl:message>
   
   <wsdl:message name="HelloMessageResponse">        
      <wsdl:part name="body" type="xsd:string"/>
   </wsdl:message>
   
   <wsdl:portType name="HelloPortType">
      <wsdl:operation name="sayHello">
         <wsdl:input message="tns:HelloMessage"/>
         <wsdl:output message="tns:HelloMessageResponse"/>
         </wsdl:operation>
      </wsdl:portType>
     
      <wsdl:binding name="HelloBinding" type="tns:HelloPortType">
         <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http" />
         <wsdl:operation name="sayHello">
         <wsdlsoap:operation soapAction="" />
            <wsdl:input>
               <wsdlsoap:body use="literal"/>              
               <wsdlsoap:header message="tns:headerRQ" part="header"
use="literal"/>
         </wsdl:input>
         <wsdl:output>
            <wsdlsoap:body use="literal"/>
            <wsdlsoap:header message="tns:headerRS" part="header"
use="literal"/>          
         </wsdl:output>
      </wsdl:operation>
   </wsdl:binding>
   
   <wsdl:service name="HelloService">
      <wsdl:port binding="tns:HelloBinding" name="HelloPort">
         <wsdlsoap:address
location="http://localhost:8080/hello-service/hello-service"/>
      </wsdl:port>
   </wsdl:service>
</wsdl:definitions>


Please advise.

Regards,
Santosh 

Anne Thomas Manes wrote:
> 
> The type declaration is valid.
> 
> <s:choice> indicates that the element may contain one of the elements
> listed in the choice group. The minOccurs="0" attribute indicates that
> the element is optional. It is not intended to be an array; therefore,
> it would be inappropriate to say maxOccurs="unbounded".
> 
> Anne
> 
> 
> On Fri, Sep 12, 2008 at 12:04 AM, Shehan Simen <ss...@itree.com.au>
> wrote:
>> Hi,
>>
>> I have  a question about wsdl. The wsdl2java fails in following case. But
>> I
>> feel the wsdl is wrong.
>>
>> I got the following element in a complex type.
>>
>>
>>
>> <s:complexType name="ResponseBusinessEntity" mixed="false">
>>
>> <s:complexContent mixed="false">
>>
>> <s:extension base="tns:ResponseBody">
>>
>> <s:sequence>
>>
>> <s:choice minOccurs="0" maxOccurs="unbounded">
>>
>>                         <s:element name="legalName"
>> type="tns:IndividualName" minOccurs="0"/>
>>
>>                         <s:element name="mainName"
>> type="tns:OrganisationName" minOccurs="0"/>
>>
>> </s:choice>
>>
>> </s:sequence>
>>
>>             </s:extension>
>>
>>             </s:complexContent>
>>
>> </s:complexType>
>>
>>
>>
>> I believe this is logically wrong or useless. The choice is multiple.
>> What
>> is the use of it?
>>
>> Does this means there can be 5 choices with 3 legalName and 2 mainName?
>> Then
>> what is use of choice? We can just use both of them without choice, but
>> with
>> minOccurs="0" maxOccurs="unbounded"
>>
>>  I believe it should be as follows.
>>
>>
>>
>> <s:choice minOccurs="0" maxOccurs="1">
>>
>>                         <s:element name="legalName"
>> type="tns:IndividualName" minOccurs="0" maxOccurs="unbounded"/>
>>
>>                         <s:element name="mainName"
>> type="tns:OrganisationName" minOccurs="0" maxOccurs="unbounded"/>
>>
>> </s:choice>
>>
>>
>>
>> Anyway axis2 does not generate stub properly for the first case.
>>
>> What do you guys think?
>>
>>
>>
>> Please let me know if I am wrong.
>>
>>
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/wsdl2java-and-wsdl-problem-tp19449136p25747847.html
Sent from the Axis - User mailing list archive at Nabble.com.


RE: wsdl2java and wsdl problem

Posted by Shehan Simen <ss...@itree.com.au>.
Hi Anne,
What you said is true.
I believe that maxOccures="unbounded" should be a syntax error for a choice.
Can anybody think a use of this in choice?

Regards,
Shehan

-----Original Message-----
From: Anne Thomas Manes [mailto:atmanes@gmail.com]
Sent: Friday, 12 September 2008 9:57 PM
To: axis-user@ws.apache.org
Subject: Re: wsdl2java and wsdl problem

The type declaration is valid.

<s:choice> indicates that the element may contain one of the elements
listed in the choice group. The minOccurs="0" attribute indicates that
the element is optional. It is not intended to be an array; therefore,
it would be inappropriate to say maxOccurs="unbounded".

Anne


On Fri, Sep 12, 2008 at 12:04 AM, Shehan Simen <ss...@itree.com.au> wrote:
> Hi,
>
> I have  a question about wsdl. The wsdl2java fails in following case. But I
> feel the wsdl is wrong.
>
> I got the following element in a complex type.
>
>
>
> <s:complexType name="ResponseBusinessEntity" mixed="false">
>
> <s:complexContent mixed="false">
>
> <s:extension base="tns:ResponseBody">
>
> <s:sequence>
>
> <s:choice minOccurs="0" maxOccurs="unbounded">
>
>                         <s:element name="legalName"
> type="tns:IndividualName" minOccurs="0"/>
>
>                         <s:element name="mainName"
> type="tns:OrganisationName" minOccurs="0"/>
>
> </s:choice>
>
> </s:sequence>
>
>             </s:extension>
>
>             </s:complexContent>
>
> </s:complexType>
>
>
>
> I believe this is logically wrong or useless. The choice is multiple. What
> is the use of it?
>
> Does this means there can be 5 choices with 3 legalName and 2 mainName? Then
> what is use of choice? We can just use both of them without choice, but with
> minOccurs="0" maxOccurs="unbounded"
>
>  I believe it should be as follows.
>
>
>
> <s:choice minOccurs="0" maxOccurs="1">
>
>                         <s:element name="legalName"
> type="tns:IndividualName" minOccurs="0" maxOccurs="unbounded"/>
>
>                         <s:element name="mainName"
> type="tns:OrganisationName" minOccurs="0" maxOccurs="unbounded"/>
>
> </s:choice>
>
>
>
> Anyway axis2 does not generate stub properly for the first case.
>
> What do you guys think?
>
>
>
> Please let me know if I am wrong.
>
>
>
>

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


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


Re: wsdl2java and wsdl problem

Posted by Anne Thomas Manes <at...@gmail.com>.
The type declaration is valid.

<s:choice> indicates that the element may contain one of the elements
listed in the choice group. The minOccurs="0" attribute indicates that
the element is optional. It is not intended to be an array; therefore,
it would be inappropriate to say maxOccurs="unbounded".

Anne


On Fri, Sep 12, 2008 at 12:04 AM, Shehan Simen <ss...@itree.com.au> wrote:
> Hi,
>
> I have  a question about wsdl. The wsdl2java fails in following case. But I
> feel the wsdl is wrong.
>
> I got the following element in a complex type.
>
>
>
> <s:complexType name="ResponseBusinessEntity" mixed="false">
>
> <s:complexContent mixed="false">
>
> <s:extension base="tns:ResponseBody">
>
> <s:sequence>
>
> <s:choice minOccurs="0" maxOccurs="unbounded">
>
>                         <s:element name="legalName"
> type="tns:IndividualName" minOccurs="0"/>
>
>                         <s:element name="mainName"
> type="tns:OrganisationName" minOccurs="0"/>
>
> </s:choice>
>
> </s:sequence>
>
>             </s:extension>
>
>             </s:complexContent>
>
> </s:complexType>
>
>
>
> I believe this is logically wrong or useless. The choice is multiple. What
> is the use of it?
>
> Does this means there can be 5 choices with 3 legalName and 2 mainName? Then
> what is use of choice? We can just use both of them without choice, but with
> minOccurs="0" maxOccurs="unbounded"
>
>  I believe it should be as follows.
>
>
>
> <s:choice minOccurs="0" maxOccurs="1">
>
>                         <s:element name="legalName"
> type="tns:IndividualName" minOccurs="0" maxOccurs="unbounded"/>
>
>                         <s:element name="mainName"
> type="tns:OrganisationName" minOccurs="0" maxOccurs="unbounded"/>
>
> </s:choice>
>
>
>
> Anyway axis2 does not generate stub properly for the first case.
>
> What do you guys think?
>
>
>
> Please let me know if I am wrong.
>
>
>
>

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


Re: wsdl2java and wsdl problem

Posted by Amila Suriarachchi <am...@gmail.com>.
Could you please log a jira with the wsdl. Did you try with any other
databindings like xmlbeans or jaxbri?

thanks,
Amila.

On Fri, Sep 12, 2008 at 9:34 AM, Shehan Simen <ss...@itree.com.au> wrote:

>  Hi,
>
> I have  a question about wsdl. The wsdl2java fails in following case. But I
> feel the wsdl is wrong.
>
> I got the following element in a complex type.
>
>
>
> <s:complexType name="ResponseBusinessEntity" mixed="false">
>
> <s:complexContent mixed="false">
>
> <s:extension base="tns:ResponseBody">
>
> <s:sequence>
>
> <s:choice minOccurs="0" maxOccurs="unbounded">
>
>                         <s:element name="legalName" type="
> tns:IndividualName" minOccurs="0"/>
>
>                         <s:element name="mainName" type="
> tns:OrganisationName" minOccurs="0"/>
>
> </s:choice>
>
> </s:sequence>
>
>             </s:extension>
>
>             </s:complexContent>
>
> </s:complexType>
>
>
>
> I believe this is logically wrong or useless. The choice is multiple. What
> is the use of it?
>
> Does this means there can be 5 choices with 3 legalName and 2 mainName?
> Then what is use of choice? We can just use both of them without choice, but
> with minOccurs="0" maxOccurs="unbounded"
>
>  I believe it should be as follows.
>
>
>
> <s:choice minOccurs="0" maxOccurs="1">
>
>                         <s:element name="legalName" type="
> tns:IndividualName" minOccurs="0" maxOccurs="unbounded"/>
>
>                         <s:element name="mainName" type="
> tns:OrganisationName" minOccurs="0" maxOccurs="unbounded"/>
>
> </s:choice>
>
>
>
> Anyway axis2 does not generate stub properly for the first case.
>
> What do you guys think?
>
>
>
> Please let me know if I am wrong.
>
>
>
>
>



-- 
Amila Suriarachchi,
WSO2 Inc.