> Hi Michele,
>
> The current code in the CVS tree now defaults to using the 2001 Schema
URIs.
> Please try your code with the latest CVS tree, or one of the nightly
builds.

Hi Matt,

I am back in my office after a long weekend.
I tried with the xml-soap nightly sources dated July 5 and the resulting
traces were much much better, almost there.
I still have a server error that means that none of the interfaces could
load my soap packet.
The raw traces are the following:

Apache SOAP July 5 client
*********************

POST /MSSoapSamples/AddrBook/Service/Rpc/IsapiVb/AddrBook.WSDL HTTP/1.0
Host: MSSoapSampleServer
Content-Type: text/xml; charset=utf-8
Content-Length: 1145
SOAPAction: "http://tempuri.org/action/AddrBook.AddAddr";

<?xml version='1.0' encoding='UTF-8'?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
<SOAP-ENV:Body>
<ns1:AddAddr xmlns:ns1="http://tempuri.org/message/";
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";>
<Addr xmlns:ns2="http://tempuri.org/type/"; xsi:type="ns2:Addr">
<phoneNumbers xmlns:ns3="http://schemas.xmlsoap.org/soap/encoding/";
xsi:type="ns3:Array" ns3:arrayType="xsd:string[5]">
<item xsi:type="xsd:string">First</item>
<item xsi:type="xsd:string">Second</item>
<item xsi:type="xsd:string">Fifth (just kidding :))</item>
<item xsi:type="xsd:string">Fourth</item>
<item xsi:type="xsd:string">Last</item>
</phoneNumbers>
<zipCode xsi:type="xsd:string">20141</zipCode>
<name xsi:type="xsd:string">Michele</name>
<birthday xsi:type="xsd:dateTime" xsi:null="true"/>
<state xsi:type="xsd:string">Italy</state>
<city xsi:type="xsd:string">Milano</city>
<street xsi:type="xsd:string">123 Someway</street>
</Addr>
</ns1:AddAddr>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>


And this is the Microsoft client
***********************

POST /MSSoapSamples/AddrBook/Service/Rpc/IsapiVb/AddrBook.WSDL HTTP/1.1
Content-Type: text/xml; charset="UTF-8"
Host: localhost
SOAPAction: "http://tempuri.org/action/AddrBook.AddAddr";
Content-Length: 839

<?xml version="1.0" encoding="UTF-8" standalone="no"?><SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/";
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/";><SOAP-ENV:Body><S
OAPSDK1:AddAddr
xmlns:SOAPSDK1="http://tempuri.org/message/";><Addr><name>name</name><street>
street</street><city>city</city><state>state</state><zip-code>zipcode</zip-c
ode><phone-numbers xmlns:SOAPSDK2="http://www.w3.org/2001/XMLSchema";
xmlns:SOAPSDK3="http://schemas.xmlsoap.org/soap/encoding/";
SOAPSDK3:arrayType="SOAPSDK2:string[2]"
xmlns:SOAPSDK4="http://www.w3.org/2001/XMLSchema-instance";
SOAPSDK4:type="SOAPSDK3:Array"><SOAPSDK3:string>1111</SOAPSDK3:string><SOAPS
DK3:string>2222</SOAPSDK3:string></phone-numbers><birthday>1899-12-30T00:01:
01Z</birthday></Addr></SOAPSDK1:AddAddr></SOAP-ENV:Body></SOAP-ENV:Envelope>


The main difference I can see is that the phone numbers are SOAPSDK3:string
(that is http://schemas.xmlsoap.org/soap/encoding/) while the apache client
phone numbers are xsd:string (that is http://www.w3.org/2001/XMLSchema).

The code I created is pretty straightforward: I created a bean like this

package AddrBook;
public class Address implements java.io.Serializable {
    private String name;
    private String street;
    private String city;
    private String zipCode;
    private String[] phoneNumbers;
    private String state;
    private java.util.Date birthday;

    ....
}

with the appropriate getters and setters
This bean reflects the type defined in WSDL

      <complexType name ='ArrayOfstring'>
        <complexContent>
          <restriction base='SOAP-ENC:Array'>
            <attribute ref='SOAP-ENC:arrayType' wsdl:arrayType='string[]'/>
          </restriction>
        </complexContent>
      </complexType>

      <complexType name='Addr'>
        <sequence>
          <element name='name' type='string'/>
          <element name='street' type='string'/>
          <element name='city' type='string'/>
          <element name='state' type='string'/>
          <element name='zip-code' type='string'/>
          <element name='phone-numbers' type='typens:ArrayOfstring'/>
          <element name='birthday' type='dateTime'/>
        </sequence>
      </complexType>


Finally, I prepare the call this way

        SOAPMappingRegistry smr = new SOAPMappingRegistry();

        Vector params = new Vector();
        Parameter AddrParam = new Parameter("Addr", Address.class, addr,
null);
        params.addElement(AddrParam);

        BeanSerializer addrBookSerializer = new BeanSerializer();
        smr.mapTypes(Constants.NS_URI_SOAP_ENC,
            new QName("http://tempuri.org/type/";, "Addr"),
            addr.getClass(), addrBookSerializer, null);

        call.setParams(params);
        call.setSOAPMappingRegistry(smr);
        call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
        call.setTargetObjectURI("http://tempuri.org/message/";);
        call.setMethodName("AddAddr");
        org.apache.soap.rpc.Response resp =
            call.invoke(url, "http://tempuri.org/action/AddrBook.AddAddr";);


I would really like to know if I have made a mistake, the WSDL file is not
correct or what.

Reply via email to