axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Davanum Srinivas (JIRA)" <axis-...@ws.apache.org>
Subject [jira] Commented: (AXIS-1926) wrapped document/literal generates wrong SOAP message for arrays within arrays
Date Fri, 15 Apr 2005 19:25:18 GMT
     [ http://issues.apache.org/jira/browse/AXIS-1926?page=comments#action_62931 ]
     
Davanum Srinivas commented on AXIS-1926:
----------------------------------------

*** PLEASE USE LATEST CVS ***

I was going through all the emails with Anne and came up with the "correct" soap message (i
will upload a diff to the generated code as attachment to the bug report)

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <login xmlns="http://some.company.com/ws">
            <username>abc</username>
            <password>def</password>
            <options>
                <name>dummy1</name>
                <value xsi:type="xsd:string">dummy_val1</value>
            </options>
            <options>
                <name>dummy2</name>
                <value xsi:type="ns1:ArrayOfNamedValue" xmlns:ns1="http://some.company.com/ws">
                    <item xmlns="">
                        <ns1:name>dummy2-1</ns1:name>
                        <ns1:value xsi:type="xsd:string">val2-1</ns1:value>
                    </item>
                    <item xmlns="">
                        <ns1:name>dummy2-2</ns1:name>
                        <ns1:value xsi:type="xsd:int">314</ns1:value>
                    </item>
                </value>
            </options>
        </login>
    </soapenv:Body>
</soapenv:Envelope>

Basically there were 2 things:
#1: In the RemoteLoginManagerSoapBindingStub, ">loginResponse" and "ArrayOfNamedValue"
were both mapped to NamedValue[].class. so the last one wins. Hence changed the order. and
moved "ArrayOfNamedValue" to the end. This added the xsi:type="ns1:ArrayOfNamedValue" on the
wire

#2: Since we don't generate any file for ArrayOfNamedValue, there is no place to specify that
you should use "item"'s under "value". Hack here is to add a line in NamedValue.java itself.
elemField.setItemQName(new javax.xml.namespace.QName("", "item"));

With these changes, am able to get the effect that you wanted, which is to send NamedValue's
like this and receive it on the server.

NamedValue[] options = new NamedValue[]{
              new NamedValue("dummy1", "dummy_val1"),
              new NamedValue("dummy2", new NamedValue[]{
                    new NamedValue("dummy2-1", "val2-1"),
                    new NamedValue("dummy2-2", new Integer(314))
              })
};

thanks,
-- dims


> wrapped document/literal generates wrong SOAP message for arrays within arrays
> ------------------------------------------------------------------------------
>
>          Key: AXIS-1926
>          URL: http://issues.apache.org/jira/browse/AXIS-1926
>      Project: Axis
>         Type: Bug
>  Environment: Linux, Axis 1.2RC3
>     Reporter: Tim K
>  Attachments: RemoteLoginManager.wsdl
>
> First of all, this has been discussed on the users mailing list, please refer to this
thread as it may have more up-to-date information:
> http://article.gmane.org/gmane.comp.apache.webservices.axis.user/29082
> I have a data type defined as:
> <complexType name="NamedValue">
> <sequence>
>   <element name="name" nillable="true" type="xsd:string" />
>   <element name="value" nillable="true" type="xsd:anyType" />
> </sequence>
> </complexType>
> I need the value to be xsd:anyType so that I can send arrays of NamedValue with various
types for value.
> On the server side I have a method defined as:
> NamedValue[] login(String username, String password, NamedValue[] options)
> Which in the WSDL the request looks like this:
> - <element name="login">
> -   <complexType>
> -     <sequence>
>          <element name="username" type="xsd:string" />
>          <element name="password" type="xsd:string" />
>          <element name="options" type="impl:NamedValue" maxOccurs="unbounded" />
>     </sequence>
>   </complexType>
> </element>
> And the response like this:
> - <element name="loginResponse">
> - <complexType>
> -   <sequence>
>       <element name="loginReturn" type="impl:NamedValue" maxOccurs="unbounded" />
>   </sequence>
> </complexType>
> </element>
> If I create on the client side an options array that looks like this:
> NamedValue[] options = new NamedValue[]
>   {
>     new NamedValue("dummy1", "dummy_val1"),
>     new NamedValue("dummy2",
>                    new NamedValue[]
>                    {
>                      new NamedValue("dummy2-1", "val2-1"),
>                      new NamedValue("dummy2-2", new Integer(314))
>                    })
>   };
> Note the array inside the array above.
> A request to the server from an Axis client (latest CVS version of 1.2RC3) looks like
this:
> <login xmlns="http://some/namespace">
>    <username>tim</username>
>    <password>tim</password>
>    <options>
>       <name>dummy1</name>
>       <value xsi:type="xsd:string">dummy_val1</value>
>    </options>
>    <options>
>       <name>dummy2</name>
>       <value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace">
>         <name>dummy2-1</name>
>         <value xsi:type="xsd:string">val2-1</value>
>       </value>
>       <value xsi:type="ns2:NamedValue" xmlns:ns2="http://some/namespace">
>         <name>dummy2-2</name>
>         <value xsi:type="xsd:int">314</value>
>       </value>
>    </options>
> </login>
> The encoding of the array inside the array does not seem right to me, the server ends
up with a NamedValue value for "dummy2" instead of a NamedValue[].
> From Anne Thomas Manes:
> You're right. The array within the array should be mapped to this:
> <login xmlns="http://some/namespace">
>    <username>tim</username>
>    <password>tim</password>
>    <options>
>       <name>dummy1</name>
>       <value xsi:type="xsd:string">dummy_val1</value>
>    </options>
>    <options>
>       <name>dummy2</name>
>       <value xsi:type="ns1:NamedValue" xmlns:ns1="http://some/namespace">
>         <name>dummy2-1</name>
>         <value xsi:type="xsd:string">val2-1</value>
>         <name>dummy2-2</name>
>         <value xsi:type="xsd:int">314</value>
>       </value>
>    </options>
> </login>
> I suggest you file a bug report, because Axis is not generating the
> right message structure per the WSDL.
> Anne

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
If you want more information on JIRA, or have a bug to report see:
   http://www.atlassian.com/software/jira


Mime
View raw message