Another thing about this that is important to know is that I ***DID
NOT** use what everyone is saying to use as far as WS-I-compliant WSDL
is concerned.  I used rpc/encoded.  The reason being is that when I used
doc/literal and wrapped style, .NET blew-up.  On the other-hand, if I
stuck with the conventional rpc/encoded wsdl, .NET worked like a charm
as a client to my web service.

Regards,

Tami 

-----Original Message-----
From: Tami Wright [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, September 29, 2004 4:54 PM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: RE: Array of Objects in Axis and .NET interop

Marcus,

Thanks for the quick response.  I also found that the code/beans that
is/are generated (for my schema complexTypes that are being returned by
some of my web service methods) when doing a WSDL2Java (without the -h
parameter) have typeDesc info that is being passed in.  That is what I
was referring to in the copy/paste job below.  So, I tried just putting
null in there like I showed in the changed code below and it works!  
(So, we're probably going about accomplishing the same task just with
different approaches.)

Thanks again!

Tami 

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 29, 2004 4:45 PM
To: Tami Wright
Subject: RE: Question about your post

Tami,
No, actually the code I changed was the actual typedesc info generated
by wsdl2java.  It is either in the bean itself or if using the -h
generate helper switch then it is in the _Helper class that was
generated for the bean.

/**
 * TestBeanChild_Helper.java
 *
 * This file was auto-generated from WSDL
 * by the Apache Axis 1.2beta3 Aug 31, 2004 (10:11:01 PDT) WSDL2Java
emitter.
 */

package test.complex;

public class TestBeanChild_Helper {
    // Type metadata
    private static org.apache.axis.description.TypeDesc typeDesc =
        new org.apache.axis.description.TypeDesc(TestBeanChild.class,
true);

    static {
        typeDesc.setXmlType(new
javax.xml.namespace.QName("http://complex.test";, "TestBeanChild"));
        org.apache.axis.description.ElementDesc elemField = new
org.apache.axis.description.ElementDesc();
        elemField.setFieldName("name");
        elemField.setXmlName(new
javax.xml.namespace.QName("http://complex.test";, "name"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema";,
"string"));
        typeDesc.addFieldDesc(elemField);
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("phone");
        elemField.setXmlName(new
javax.xml.namespace.QName("http://complex.test";, "phone"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema";,
"string"));
        typeDesc.addFieldDesc(elemField);

//Remove the following element description.
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("testBeans");
        elemField.setXmlName(new
javax.xml.namespace.QName("http://complex.test";, "testBeans"));
        elemField.setXmlType(new
javax.xml.namespace.QName("urn:TestTypedArraysWrappedLiteralService",
"ArrayOf_tns3_TestBean"));
        typeDesc.addFieldDesc(elemField);

//Remove the following element description.
        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("beanData");
        elemField.setXmlName(new
javax.xml.namespace.QName("http://complex.test";, "beanData"));
        elemField.setXmlType(new
javax.xml.namespace.QName("urn:TestTypedArraysWrappedLiteralService",
"ArrayOf_tns2_string"));
        typeDesc.addFieldDesc(elemField);

        elemField = new org.apache.axis.description.ElementDesc();
        elemField.setFieldName("item");
        elemField.setXmlName(new
javax.xml.namespace.QName("http://complex.test";, "item"));
        elemField.setXmlType(new
javax.xml.namespace.QName("http://complex.test";, "TestBean"));
        typeDesc.addFieldDesc(elemField);
    }

    /**
     * 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);
    }

}

I have not done much more experimentation with this to verify everything
works properly with .NET, but the xml appears correct.

marcus
-----Original Message-----
From: Tami Wright [mailto:[EMAIL PROTECTED]
Sent: Wednesday, September 29, 2004 3:30 PM
To: [EMAIL PROTECTED]
Subject: RE: Question about your post


Hi marcus,

A couple of more questions (I hope you don't mind)...

Are you changing the following code:

"
 /**
     * 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);
    }
"

To:
"
 /**
     * 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, null);
    }

    /**
     * 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, null);
    }
"

In other words, putting "null" instead of "typeDesc" in the
Serializer/Deserializer of each bean that's returning an array?

Thanks,

Tami
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Tuesday, September 28, 2004 9:02 AM
To: Tami Wright
Subject: RE: Question about your post

Tami,
That's right, it is quite unacceptable but does allow work to continue
until the fix is in place.  

Even though the signature in Java returns the ArrayOf_* class, since the
xml is correct, .NET will reflect the correct return type as the class
array.

NOTE: I have also found that the correct xml can be generated if the
type desc info for the field is not included in the helper class.  I am
hoping this information will assist in debugging the problem.

marcus

-----Original Message-----
From: Tami Wright [mailto:[EMAIL PROTECTED]
Sent: Monday, September 27, 2004 10:55 AM
To: [EMAIL PROTECTED]
Subject: RE: Question about your post


That's nuts!  So, in the bean that has an array that is a property (say
the array is "Campaign[] campaigns") instead of the signature being
"Campaign[] getCampaigns()" it's "ArrayOf_Campaign getCampaigns()"?  Did
you create an interface or what?

Thanks for your help!

Tami

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, September 27, 2004 11:34 AM
To: Tami Wright
Subject: RE: Question about your post

Tami,
The change I made was in the bean that I was returning.  My service
method returns a bean with a property which is an array.  So I changed
the property to return the ArrayOf_ class instead of the array.

If this doesn't help let me know.  I am still working on some cleaner
work arounds and/or fixes depending on what I find.

marcus

-----Original Message-----
From: Tami Wright [mailto:[EMAIL PROTECTED]
Sent: Monday, September 27, 2004 9:36 AM
To: [EMAIL PROTECTED]
Subject: Question about your post


Hi Marcus,

My name is Tami Wright.  I'm trying to get .NET and Axis to play nice
together and noticed you stated that you got the serializers to work
correctly for returning a correctly serialized array to .NET.  Where did
you change it from returning a Bean[] to an ArrayOf_tns3?  In the
axis-generated marshalling code inside the bean that returns the array
of objects or elsewhere?

Thanks in advance!

Tami






Reply via email to