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 JOVANOVIC Nenad <Ne...@svc.co.at> on 2011/01/19 11:43:58 UTC

[Axis2] Missing field (with minOccurs="1") in response

Hi all,

when a string element in a response object is declared with nillable="true" and minOccurs="1" in the WSDL,
but the element is not explicitly initialized to null in the service implementation code, the element
is not included in the response message (violating the WSDL). Expected: xsi:nil="1". 
Is this a bug, or am I missing something? For details see below.

Thanks,
Nenad Jovanovic


WSDL snippet:

    <!-- this container is used as return type of a web service function -->
    <xs:complexType name="Container">
        <xs:sequence>
            <!-- this element will be initialized explicitly with null for test purposes -->
            <xs:element minOccurs="0" name="myString1" nillable="true" type="xs:string"/>
            <!-- this element will NOT be initialized explicitly; expected return: xsi:nil="1" -->
            <xs:element minOccurs="1" name="myString2" nillable="true" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

Code generation parameters in the Ant buildfile:

        <arg line="-uri ${wsdl.uri}"/>
        <arg line="-o ${build.dir}/service"/>
        <arg line="-ss"/>
        <arg line="-sd"/>
        <arg line="-s"/>
        <arg line="-Euwc"/>
        <arg line="-Eosv"/>
        <arg line="-ssi"/>
        <arg line="-uw"/>

SOAP response snippet:

      <ns2:getContainerResponse xmlns:ns2="http://foo.bar">
         <ns2:return>
            <ns1:myString1 xmlns:ns1="http://foo.bar/xsd">s1</ns1:myString1>
            <!-- no myString2 element here, even though the WSDL promised it -->
         </ns2:return>
      </ns2:getContainerResponse>


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


Re: [Axis2] Missing field (with minOccurs="1") in response

Posted by Afkham Azeez <af...@gmail.com>.
Yes, if that element is not included in the response, it is indeed a bug,
since the response violates the schema (minOccurs=1). Please file a JIRA
issue at https://issues.apache.org/jira/browse/AXIS

On Wed, Jan 19, 2011 at 4:13 PM, JOVANOVIC Nenad
<Ne...@svc.co.at>wrote:

> Hi all,
>
> when a string element in a response object is declared with nillable="true"
> and minOccurs="1" in the WSDL,
> but the element is not explicitly initialized to null in the service
> implementation code, the element
> is not included in the response message (violating the WSDL). Expected:
> xsi:nil="1".
> Is this a bug, or am I missing something? For details see below.
>
> Thanks,
> Nenad Jovanovic
>
>
> WSDL snippet:
>
>    <!-- this container is used as return type of a web service function -->
>    <xs:complexType name="Container">
>        <xs:sequence>
>            <!-- this element will be initialized explicitly with null for
> test purposes -->
>            <xs:element minOccurs="0" name="myString1" nillable="true"
> type="xs:string"/>
>            <!-- this element will NOT be initialized explicitly; expected
> return: xsi:nil="1" -->
>            <xs:element minOccurs="1" name="myString2" nillable="true"
> type="xs:string"/>
>        </xs:sequence>
>    </xs:complexType>
>
> Code generation parameters in the Ant buildfile:
>
>        <arg line="-uri ${wsdl.uri}"/>
>        <arg line="-o ${build.dir}/service"/>
>        <arg line="-ss"/>
>        <arg line="-sd"/>
>        <arg line="-s"/>
>        <arg line="-Euwc"/>
>        <arg line="-Eosv"/>
>        <arg line="-ssi"/>
>        <arg line="-uw"/>
>
> SOAP response snippet:
>
>      <ns2:getContainerResponse xmlns:ns2="http://foo.bar">
>         <ns2:return>
>            <ns1:myString1 xmlns:ns1="http://foo.bar/xsd
> ">s1</ns1:myString1>
>            <!-- no myString2 element here, even though the WSDL promised it
> -->
>         </ns2:return>
>      </ns2:getContainerResponse>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@axis.apache.org
> For additional commands, e-mail: java-user-help@axis.apache.org
>
>


-- 
*Afkham Azeez*
Senior Software Architect & Senior Manager; WSO2, Inc.; http://wso2.com,
*
*
*Member; Apache Software Foundation;
**http://www.apache.org/*<http://www.apache.org/>
*
email: **azeez@wso2.com* <az...@wso2.com>* cell: +94 77 3320919
blog: **http://blog.afkham.org* <http://blog.afkham.org>*
twitter: **http://twitter.com/afkham_azeez*<http://twitter.com/afkham_azeez>
*
linked-in: **http://lk.linkedin.com/in/afkhamazeez*
*
*
*Lean . Enterprise . Middleware*
*
*