Hi,

I am using AXIS to generate WebService client. I have following WSDL with Test2 
referencing to global "symbol" element.

<definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"; 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"; 
xmlns:s="http://www.w3.org/2001/XMLSchema"; xmlns:s0="http://tempuri.org/"; 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"; 
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"; 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"; 
xmlns="http://schemas.xmlsoap.org/wsdl/"; targetNamespace="http://tempuri.org/";>
        <types>
                <s:schema elementFormDefault="qualified" 
targetNamespace="http://tempuri.org/";>
                        <s:element name="symbol" type="s:string"/>
                        <s:element name="Test2">
                                <s:complexType>
                                        <s:sequence>
                                                <s:element ref="symbol"  
maxOccurs="25"/>
                                        </s:sequence>
                                </s:complexType>
                        </s:element>
                        <s:element name="Test2Response">
                                <s:complexType>
                                        <s:sequence>
                                                <s:element minOccurs="1" maxOccurs="1" 
name="Test2Result" type="s:int"/>
                                        </s:sequence>
                                </s:complexType>
                        </s:element>
                </s:schema>
        </types>
        <message name="Test2SoapIn">
                <part name="parameters" element="s0:Test2"/>
        </message>
        <message name="Test2SoapOut">
                <part name="parameters" element="s0:Test2Response"/>
        </message>
        <portType name="Service1Soap">
                <operation name="Test2">
                        <input message="s0:Test2SoapIn"/>
                        <output message="s0:Test2SoapOut"/>
                </operation>
        </portType>
        <binding name="Service1Soap" type="s0:Service1Soap">
                <soap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
                <operation name="Test2">
                        <soap:operation soapAction="http://tempuri.org/Test2"; 
style="document"/>
                        <input>
                                <soap:body use="literal"/>
                        </input>
                        <output>
                                <soap:body use="literal"/>
                        </output>
                </operation>
        </binding>
        <service name="Service1">
                <port name="Service1Soap" binding="s0:Service1Soap">
                        <soap:address 
location="http://localhost:8080/JavaTEstService/Service1.asmx"/>
                </port>
        </service>
</definitions>

If I run WSDL2Java on this wsdl and then run Java client application, I get following 
SOAP request. Here Symbol array is serialized using Soap Encoding.

<?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>
                <Test2 xmlns="http://tempuri.org/";>
                        <symbol soapenc:arrayType="xsd:string[2]" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/";>
                                <item xmlns="">Symbol1</item>
                                <item xmlns="">Symbol2</item>
                        </symbol>
                </Test2>
        </soapenv:Body>
</soapenv:Envelope>


If I remove reference and use following schema for Test2 instead 

<s:element name="Test2">
        <s:complexType>
                <s:sequence>
                        <s:element name="symbol" type="s:string" maxOccurs="25"/>
                </s:sequence>
        </s:complexType>
</s:element>

then I get 

<?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>
                <Test2 xmlns="http://tempuri.org/";>
                        <symbol>Symbol1</symbol>
                        <symbol>Symbol2</symbol>
                </Test2>
        </soapenv:Body>
</soapenv:Envelope>

In above request there is no Soap Encoding for symbol array. 

This behavior seems to be inconsistent. Is there a way that I can get arrays always 
encoded in same fashion regardless whether it is a reference or not. I would like to 
get second type of request format.

Can anyone answer my question.

Thanks,
-Himmat

Reply via email to