Oops, I almost forgot.   

I am running Apache SOAP 2.3.1 on Linux using an IBM 1.3.1 JVM.  The server is a Borland SOAP server of some description that I have little or no influence on.  The VB programmer sitting next to me is having no trouble whatsoever using Microsoft SOAP against the same server.

-----Original Message-----
From: Neil Brennan 
Sent: Wednesday, 18 September 2002 16:15
To: soap-user@xml.apache.org
Subject: SOAP RPC problems with complex types

Hi Folks,

The long and short of it is that I'm having a terrible time trying to use either Apache SOAP or Axis with complex types.

The following is a complete (short) program that works with one WSDL and not another for two services on the same server.   I'm using the Axis tool WSDL2Java to generate all the classes I need for the complex data types, and they look fine as far as I can tell.

The commented-out case works fine, the currently uncommented one throws this exception:

Exception in thread "main" [SOAPException: faultCode=SOAP-ENV:Client; msg=Unable to set &apos;StartTime&apos; property: argument type mismatch.; targetException=java.lang.IllegalArgumentException: Unable to set 'StartTime' property: argument type mismatch.]
        at org.apache.soap.rpc.Call.invoke(Call.java:294)
        at com.touchcorp.net.soap.SoapTest.main(SoapTest.java:66)

I downloaded the source code and added some debug statements only to find that for some unknown (to me) reason, the SOAP code is trying to set the java.util.Calendar StartTime property to a java.util.Date.  

Why?  It's specified in my code as a Calendar, and in the WSDL as an "xs:dateTime" which is meant to map to a Calendar, isn't it?

I have attached the relevant WSDL2Java-generated classes for the complex return type in case that's the problem.  Please help!  I'm starting to give up all hope of this working.

Regards,

Neil Brennan

=============
SoapTest.java
=============

// package
package com.touchcorp.net.soap;

// java imports
import java.io.*;
import java.net.*;
import java.util.*;

// other imports
import org.apache.soap.*;
import org.apache.soap.encoding.*;
import org.apache.soap.encoding.soapenc.*;
import org.apache.soap.rpc.*;
import org.apache.soap.util.xml.*;

public class SoapTest
{
    public static void main(String[] args) throws Exception
    {
/*
	// itrailer setup
	URL url = new URL("http://tims.moveyourselftrailer.com.au:8000/scripts/trailer.dll/soap/ITrailer");
	String uri = "urn:uTrailerTypeInfo";
	String method = "getTrailerTypesOnSite";
	Class type = com.touchcorp.soap.itrailer.TTrailerTypeInfo.class;
	Vector parameters = new Vector();
	parameters.addElement(new Parameter("Depot", String.class, "TWEED", null));
*/

	// ihire setup
	URL url = new URL("http://tims.moveyourselftrailer.com.au:8000/scripts/Hire.dll/soap/IHire");
	String uri = "urn:uHireInfo";
	String method = "getHireFromCustomerLicence";
	Class type = com.touchcorp.soap.ihire.THireInfo.class;
	Vector parameters = new Vector();
	parameters.addElement(new Parameter("LicenceNumber", String.class, "2345678", null));
	parameters.addElement(new Parameter("LicenceState", String.class, "VIC", null));
	parameters.addElement(new Parameter("Depot", String.class, "TWEED", null));

	// get short version of type class name
	String typeName = type.getName();
	int index = typeName.lastIndexOf(".");
	if (index > 0)
	    typeName = typeName.substring(index+1);

	// set up bean mappings
	SOAPMappingRegistry registry = new SOAPMappingRegistry();
	BeanSerializer serializer = new BeanSerializer();
	registry.mapTypes(Constants.NS_URI_SOAP_ENC, new QName(uri, typeName), type, serializer, serializer);

	// build the call
	Call call = new Call();
	call.setSOAPMappingRegistry(registry);
	call.setTargetObjectURI(uri);
	call.setMethodName(method);
	call.setEncodingStyleURI(Constants.NS_URI_SOAP_ENC);
	call.setParams(parameters);

	// make the call
	Response response = call.invoke(url, "");

	// deal with response
	if (response.generatedFault())
	{
	    Fault fault = response.getFault();
	    throw new SOAPException(fault.getFaultCode(), fault.getFaultString());
	}

	// done
	Object result = response.getReturnValue().getValue();
	System.out.println("result: " + (new com.touchcorp.util.xml.XMLOutputter()).toString(result));
    }
}

=============
THireInfo.java
=============

/**
 * THireInfo.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package com.touchcorp.soap.ihire;

public class THireInfo  implements java.io.Serializable {
    private int number;
    private java.lang.String sourceDepot;
    private java.lang.String destinationDepot;
    private java.util.Calendar startTime;
    private java.util.Calendar finishTime;
    private int timeLength;
    private java.lang.String trailerTypeCode;
    private java.lang.String trailerCode;
    private boolean applySackTruck;
    private java.lang.String sackTruckCode;
    private boolean applyContentsInsurance;
    private boolean leavingMetro;
    private boolean returned;
    private java.util.Calendar returnedTime;
    private int customerNumber;
    private double totalPrice;
    private com.touchcorp.soap.ihire.THireItemInfo[] hireItems;

    public THireInfo() {
    }

    public int getNumber() {
        return number;
    }

    public void setNumber(int number) {
        this.number = number;
    }

    public java.lang.String getSourceDepot() {
        return sourceDepot;
    }

    public void setSourceDepot(java.lang.String sourceDepot) {
        this.sourceDepot = sourceDepot;
    }

    public java.lang.String getDestinationDepot() {
        return destinationDepot;
    }

    public void setDestinationDepot(java.lang.String destinationDepot) {
        this.destinationDepot = destinationDepot;
    }

    public java.util.Calendar getStartTime() {
        return startTime;
    }

    public void setStartTime(java.util.Calendar startTime) {
        this.startTime = startTime;
    }

    public java.util.Calendar getFinishTime() {
        return finishTime;
    }

    public void setFinishTime(java.util.Calendar finishTime) {
        this.finishTime = finishTime;
    }

    public int getTimeLength() {
        return timeLength;
    }

    public void setTimeLength(int timeLength) {
        this.timeLength = timeLength;
    }

    public java.lang.String getTrailerTypeCode() {
        return trailerTypeCode;
    }

    public void setTrailerTypeCode(java.lang.String trailerTypeCode) {
        this.trailerTypeCode = trailerTypeCode;
    }

    public java.lang.String getTrailerCode() {
        return trailerCode;
    }

    public void setTrailerCode(java.lang.String trailerCode) {
        this.trailerCode = trailerCode;
    }

    public boolean isApplySackTruck() {
        return applySackTruck;
    }

    public void setApplySackTruck(boolean applySackTruck) {
        this.applySackTruck = applySackTruck;
    }

    public java.lang.String getSackTruckCode() {
        return sackTruckCode;
    }

    public void setSackTruckCode(java.lang.String sackTruckCode) {
        this.sackTruckCode = sackTruckCode;
    }

    public boolean isApplyContentsInsurance() {
        return applyContentsInsurance;
    }

    public void setApplyContentsInsurance(boolean applyContentsInsurance) {
        this.applyContentsInsurance = applyContentsInsurance;
    }

    public boolean isLeavingMetro() {
        return leavingMetro;
    }

    public void setLeavingMetro(boolean leavingMetro) {
        this.leavingMetro = leavingMetro;
    }

    public boolean isReturned() {
        return returned;
    }

    public void setReturned(boolean returned) {
        this.returned = returned;
    }

    public java.util.Calendar getReturnedTime() {
        return returnedTime;
    }

    public void setReturnedTime(java.util.Calendar returnedTime) {
        this.returnedTime = returnedTime;
    }

    public int getCustomerNumber() {
        return customerNumber;
    }

    public void setCustomerNumber(int customerNumber) {
        this.customerNumber = customerNumber;
    }

    public double getTotalPrice() {
        return totalPrice;
    }

    public void setTotalPrice(double totalPrice) {
        this.totalPrice = totalPrice;
    }

    public com.touchcorp.soap.ihire.THireItemInfo[] getHireItems() {
        return hireItems;
    }

    public void setHireItems(com.touchcorp.soap.ihire.THireItemInfo[] hireItems) {
        this.hireItems = hireItems;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof THireInfo)) return false;
        THireInfo other = (THireInfo) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true && 
            number == other.getNumber() &&
            ((sourceDepot==null && other.getSourceDepot()==null) || 
             (sourceDepot!=null &&
              sourceDepot.equals(other.getSourceDepot()))) &&
            ((destinationDepot==null && other.getDestinationDepot()==null) || 
             (destinationDepot!=null &&
              destinationDepot.equals(other.getDestinationDepot()))) &&
            ((startTime==null && other.getStartTime()==null) || 
             (startTime!=null &&
              startTime.equals(other.getStartTime()))) &&
            ((finishTime==null && other.getFinishTime()==null) || 
             (finishTime!=null &&
              finishTime.equals(other.getFinishTime()))) &&
            timeLength == other.getTimeLength() &&
            ((trailerTypeCode==null && other.getTrailerTypeCode()==null) || 
             (trailerTypeCode!=null &&
              trailerTypeCode.equals(other.getTrailerTypeCode()))) &&
            ((trailerCode==null && other.getTrailerCode()==null) || 
             (trailerCode!=null &&
              trailerCode.equals(other.getTrailerCode()))) &&
            applySackTruck == other.isApplySackTruck() &&
            ((sackTruckCode==null && other.getSackTruckCode()==null) || 
             (sackTruckCode!=null &&
              sackTruckCode.equals(other.getSackTruckCode()))) &&
            applyContentsInsurance == other.isApplyContentsInsurance() &&
            leavingMetro == other.isLeavingMetro() &&
            returned == other.isReturned() &&
            ((returnedTime==null && other.getReturnedTime()==null) || 
             (returnedTime!=null &&
              returnedTime.equals(other.getReturnedTime()))) &&
            customerNumber == other.getCustomerNumber() &&
            totalPrice == other.getTotalPrice() &&
            ((hireItems==null && other.getHireItems()==null) || 
             (hireItems!=null &&
              java.util.Arrays.equals(hireItems, other.getHireItems())));
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        _hashCode += getNumber();
        if (getSourceDepot() != null) {
            _hashCode += getSourceDepot().hashCode();
        }
        if (getDestinationDepot() != null) {
            _hashCode += getDestinationDepot().hashCode();
        }
        if (getStartTime() != null) {
            _hashCode += getStartTime().hashCode();
        }
        if (getFinishTime() != null) {
            _hashCode += getFinishTime().hashCode();
        }
        _hashCode += getTimeLength();
        if (getTrailerTypeCode() != null) {
            _hashCode += getTrailerTypeCode().hashCode();
        }
        if (getTrailerCode() != null) {
            _hashCode += getTrailerCode().hashCode();
        }
        _hashCode += new Boolean(isApplySackTruck()).hashCode();
        if (getSackTruckCode() != null) {
            _hashCode += getSackTruckCode().hashCode();
        }
        _hashCode += new Boolean(isApplyContentsInsurance()).hashCode();
        _hashCode += new Boolean(isLeavingMetro()).hashCode();
        _hashCode += new Boolean(isReturned()).hashCode();
        if (getReturnedTime() != null) {
            _hashCode += getReturnedTime().hashCode();
        }
        _hashCode += getCustomerNumber();
        _hashCode += new Double(getTotalPrice()).hashCode();
        if (getHireItems() != null) {
            for (int i=0;
                 i<java.lang.reflect.Array.getLength(getHireItems());
                 i++) {
                java.lang.Object obj = java.lang.reflect.Array.get(getHireItems(), i);
                if (obj != null &&
                    !obj.getClass().isArray()) {
                    _hashCode += obj.hashCode();
                }
            }
        }
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(THireInfo.class);

    static {
        org.apache.axis.description.FieldDesc field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("number");
        field.setXmlName(new javax.xml.namespace.QName("", "Number"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("sourceDepot");
        field.setXmlName(new javax.xml.namespace.QName("", "SourceDepot"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("destinationDepot");
        field.setXmlName(new javax.xml.namespace.QName("", "DestinationDepot"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("startTime");
        field.setXmlName(new javax.xml.namespace.QName("", "StartTime"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("finishTime");
        field.setXmlName(new javax.xml.namespace.QName("", "FinishTime"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("timeLength");
        field.setXmlName(new javax.xml.namespace.QName("", "TimeLength"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("trailerTypeCode");
        field.setXmlName(new javax.xml.namespace.QName("", "TrailerTypeCode"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("trailerCode");
        field.setXmlName(new javax.xml.namespace.QName("", "TrailerCode"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("applySackTruck");
        field.setXmlName(new javax.xml.namespace.QName("", "ApplySackTruck"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("sackTruckCode");
        field.setXmlName(new javax.xml.namespace.QName("", "SackTruckCode"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("applyContentsInsurance");
        field.setXmlName(new javax.xml.namespace.QName("", "ApplyContentsInsurance"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("leavingMetro");
        field.setXmlName(new javax.xml.namespace.QName("", "LeavingMetro"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("returned");
        field.setXmlName(new javax.xml.namespace.QName("", "Returned"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("returnedTime");
        field.setXmlName(new javax.xml.namespace.QName("", "ReturnedTime"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("customerNumber");
        field.setXmlName(new javax.xml.namespace.QName("", "CustomerNumber"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("totalPrice");
        field.setXmlName(new javax.xml.namespace.QName("", "TotalPrice"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("hireItems");
        field.setXmlName(new javax.xml.namespace.QName("", "HireItems"));
        typeDesc.addFieldDesc(field);
    };

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}

================
THireItemInfo.java
================

/**
 * THireItemInfo.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis WSDL2Java emitter.
 */

package com.touchcorp.soap.ihire;

public class THireItemInfo  implements java.io.Serializable {
    private java.lang.String item;
    private java.lang.String name;
    private double price;

    public THireItemInfo() {
    }

    public java.lang.String getItem() {
        return item;
    }

    public void setItem(java.lang.String item) {
        this.item = item;
    }

    public java.lang.String getName() {
        return name;
    }

    public void setName(java.lang.String name) {
        this.name = name;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }

    private java.lang.Object __equalsCalc = null;
    public synchronized boolean equals(java.lang.Object obj) {
        if (!(obj instanceof THireItemInfo)) return false;
        THireItemInfo other = (THireItemInfo) obj;
        if (obj == null) return false;
        if (this == obj) return true;
        if (__equalsCalc != null) {
            return (__equalsCalc == obj);
        }
        __equalsCalc = obj;
        boolean _equals;
        _equals = true && 
            ((item==null && other.getItem()==null) || 
             (item!=null &&
              item.equals(other.getItem()))) &&
            ((name==null && other.getName()==null) || 
             (name!=null &&
              name.equals(other.getName()))) &&
            price == other.getPrice();
        __equalsCalc = null;
        return _equals;
    }

    private boolean __hashCodeCalc = false;
    public synchronized int hashCode() {
        if (__hashCodeCalc) {
            return 0;
        }
        __hashCodeCalc = true;
        int _hashCode = 1;
        if (getItem() != null) {
            _hashCode += getItem().hashCode();
        }
        if (getName() != null) {
            _hashCode += getName().hashCode();
        }
        _hashCode += new Double(getPrice()).hashCode();
        __hashCodeCalc = false;
        return _hashCode;
    }

    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(THireItemInfo.class);

    static {
        org.apache.axis.description.FieldDesc field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("item");
        field.setXmlName(new javax.xml.namespace.QName("", "Item"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("name");
        field.setXmlName(new javax.xml.namespace.QName("", "Name"));
        typeDesc.addFieldDesc(field);
        field = new org.apache.axis.description.ElementDesc();
        field.setFieldName("price");
        field.setXmlName(new javax.xml.namespace.QName("", "Price"));
        typeDesc.addFieldDesc(field);
    };

    /**
     * Return type metadata object
     */
    public static org.apache.axis.description.TypeDesc getTypeDesc() {
        return typeDesc;
    }

    /**
     * Get Custom Serializer
     */
    public static org.apache.axis.encoding.Serializer getSerializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanSerializer(
            _javaType, _xmlType, typeDesc);
    }

    /**
     * Get Custom Deserializer
     */
    public static org.apache.axis.encoding.Deserializer getDeserializer(
           java.lang.String mechType, 
           java.lang.Class _javaType,  
           javax.xml.namespace.QName _xmlType) {
        return 
          new  org.apache.axis.encoding.ser.BeanDeserializer(
            _javaType, _xmlType, typeDesc);
    }

}