When I used Axis 1.0 with .NET I ran into problems with the namespace in the Axis generated WSDL.  There is a bug report on this and that may be fixed in 1.1.

I worked around this by fixing the C# code that was generated and added the proper name space string to the class definitions.

McCaslin Orion wrote:
RE: Interoperability Axis with .NET (C#)
Using the Axis1.0 samples for encoding using custom serralizer/deserializer, I wish to pass an array of complex data types to .Net(C# Web Reference).  In addition, I am using Java2Wsdl. 
The C# .Net side Web Refernce auto-generated code catches System.InvalidOperationException: There is an error in XML document (5, 5). ---> System.InvalidOperationException: Namespace prefix 'null' is not defined.
 
Below is the relevant Java code:
 
<!--server-config.wsdd data service entry -->
<service name="ElementService" provider="java:RPC">
        <parameter name="className" value="com.bah.tia.portal.service.elementService.ElementService"/>
        <parameter name="allowedMethods" value="*" />
  <typeMapping qname="multiRef" xmlns:ns="
http://schemas.xmlsoap.org/wsdl/"
      languageSpecificType="java:com.bah.tia.portal.domain.Data"
                     serializer="com.bah.tia.portal.util.customSerialization.DataSerFactory"
                     deserializer="com.bah.tia.portal.util.customSerialization.DataDeserFactory"
                     encodingStyle="
http://schemas.xmlsoap.org/soap/encoding/"/>
</service>
 
public class ElementService
{
    public Data[] getDataObjects()
    {
        Data[] dataObjects = new Data[3];
        dataObjects[0]= new Data();
        dataObjects[1]= new Data();
        dataObjects[2]= new Data();
        return(dataObjects);
    }
    public String helloWorld()
    {
        System.out.println("testing...");
        return("Hello World!!");
    }
}
 
public class Data
{
    public String stringMember;
    public Float floatMember;
    public Data() {
        stringMember = "default string";
        floatMember  = new Float(0.00);
    }
 
    public Data(String stringMember, Float floatMember) {
        this();
        this.stringMember = stringMember;
        this.floatMember  = floatMember;
    }
}
 
public class DataSer implements Serializer
{
    public static final String STRINGMEMBER = "stringMember";
    public static final String FLOATMEMBER = "floatMember";

    public void serialize(QName name, Attributes attributes,
                          Object value, SerializationContext context)
        throws IOException
    {

       if (value instanceof Data) {
           Data data = "">
           context.startElement(name, attributes);
           context.serialize(new QName("", STRINGMEMBER), null, data.stringMember);
           context.serialize(new QName("", FLOATMEMBER), null, data.floatMember);
           context.endElement();
       }
       else
           throw new IOException("Can't serialize a " + value.getClass().getName() + " with a DataSerializer.");
       }
      
   public String getMechanismType() { return Constants.AXIS_SAX; }

    public boolean writeSchema(Types types) throws Exception {
        return false;
    }
}
 
 
public class DataDeser extends DeserializerImpl
{
    public static final String STRINGMEMBER = "stringMember";
    public static final String FLOATMEMBER  = "floatMember";
    private Hashtable typesByMemberName = new Hashtable();
 
    public DataDeser()
    {
        typesByMemberName.put(STRINGMEMBER, Constants.XSD_STRING);
        typesByMemberName.put(FLOATMEMBER, Constants.XSD_FLOAT);
        value = new Data();
    }
 
     public SOAPHandler onStartChild(String namespace,
                                    String localName,
                                    String prefix,
                                    Attributes attributes,
                                    DeserializationContext context)
        throws SAXException
    {
        QName typeQName = (QName)typesByMemberName.get(localName);
 
        if (typeQName == null)
            throw new SAXException("Invalid element in Data struct - " + localName);
 
        // These can come in either order.
        Deserializer dSer = context.getDeserializerForType(typeQName);
 
        try {
            dSer.registerValueTarget(new FieldTarget(value, localName));
        } catch (NoSuchFieldException e) {
            e.printStackTrace();
            throw new SAXException(e);
        }
 
        if (dSer == null)
            throw new SAXException("No deserializer for a " + typeQName + "???");
 
        return (SOAPHandler)dSer;
    }
}
JAVA2WSDL:
 
WSDL
<?xml version="1.0" encoding="UTF-8"?>
<complexType name="Data">
<sequence>
<element name="stringMember" nillable="true" type="xsd:string"/>
<element name="floatMember" nillable="true" type="xsd:float"/>
</sequence>
</complexType>
</schema>
<complexType name="ArrayOf_tns2_Data">
<complexContent>
<restriction base="soapenc:Array">
</restriction>
</complexContent>
</complexType>
<element name="ArrayOf_tns2_Data" nillable="true" type="impl:ArrayOf_tns2_Data"/>
</schema>
<wsdl:message name="getDataObjectsRequest">
<wsdl:message name="helloWorldRequest">
<wsdl:message name="helloWorldResponse">
<wsdl:part name="helloWorldReturn" type="xsd:string"/>
<wsdl:message name="getDataObjectsResponse">
<wsdl:part name="getDataObjectsReturn" type="impl:ArrayOf_tns2_Data"/>
<wsdl:portType name="ElementService">
<wsdl:operation name="getDataObjects">
<wsdl:input message="impl:getDataObjectsRequest" name="getDataObjectsRequest"/>
<wsdl:output message="impl:getDataObjectsResponse" name="getDataObjectsResponse"/>
<wsdl:operation name="helloWorld">
<wsdl:input message="impl:helloWorldRequest" name="helloWorldRequest"/>
<wsdl:output message="impl:helloWorldResponse" name="helloWorldResponse"/>
<wsdl:binding name="ElementServiceSoapBinding" type="impl:ElementService">
<wsdl:operation name="getDataObjects">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="getDataObjectsRequest">
<wsdl:output name="getDataObjectsResponse">
<wsdl:operation name="helloWorld">
<wsdlsoap:operation soapAction=""/>
<wsdl:input name="helloWorldRequest">
<wsdl:output name="helloWorldResponse">
<wsdl:service name="ElementServiceService">
<wsdl:port binding="impl:ElementServiceSoapBinding" name="ElementService">

--
Charlie Simon
ChazWare Consulting
PO Box 835
Southbury, CT 06488-0835
Email: [EMAIL PROTECTED]
WWW: www.chazware.com

Yours in Christ,
Charles Simon
Council Vice President
Good Shepherd Lutheran Church
466 Elm Street
Monroe, CT 06468
Email: [EMAIL PROTECTED]
WWW: goodshepherdlutheranct.org

Charles E. Simon
Principal Software Engineer (eBIS)
Aonix Corporation
35 Nutmeg Drive
Trumbull, CT 06611
Voice: (203)383-4773
FAX: (203)383-4601
Email: [EMAIL PROTECTED]
WWW: www.aonix.com

Reply via email to