J2EE / C# DataTransfer problem using WebServices

Discussions

XML & Web services: J2EE / C# DataTransfer problem using WebServices

  1. Hi everybody,

    I have 2 questions regarding WebServices DataTypes. I'm using Jboss 4.0.0DR4 and a C# Client.

    1. Problem with String Arrays

    I created a function in J2EE exposed as a web-service that returns a string array to the caller:

    Code:
    /**
    * @jboss-net.web-method
    * @jboss-net.wsdd-operation
    * @ejb.interface-method view-type = "remote"
    */
    public String[] testStringArray(){
    String s[] = {"test","string"};
    return s;
    }
     


    When I call this function in a C# Client - I get an System.InvalidOperationException that states that there is an error in the XML-Document.

    Part of the WSDL looks like this:

    Code:
    ...
    - <complexType name="ArrayOf_xsd_string">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" />
      </restriction>
      </complexContent>
      </complexType>
    ...
      <wsdl:message name="testStringArrayRequest" />
    ...
    - <wsdl:message name="testStringArrayResponse">
      <wsdl:part name="testStringArrayReturn" type="impl:ArrayOf_xsd_string" />
      </wsdl:message>
     


    If I transfer an int-array everything works fine. Does this have something to do with the way XDoclet generates the WSDL-file ?? Or is this a fault of the WSDL generator from Microsoft.


    2. Accessing Array content in C#

    If I transfer an int-array everyting works fine:

    Code:
    /**
    * @jboss-net.web-method
    * @jboss-net.wsdd-operation
    * @ejb.interface-method view-type = "remote"
    */
    public int[] testIntArray(){
    int i[] = {10,20,30};
    return i;
    }
     


    but on the C# site I can't figure out how to access the content of the array...

    Code:
    ...
    int[] testint = stub.testIntArray();
    Console.WriteLine(testint[0]);
    ...
     


    The output is 0 - which should be 10. What is the problem with this ?? testint.Length returns the correct array size of 3.

    Thanks
    matt
  2. Unless these are document/literal .NET will not understand the binding, or will have interop problems. Is there any way to instruct jboss to generate document/literal binding?
  3. Document/Literal[ Go to top ]

    I think I read something about changing the style of the message. But would this constraint only apply to array types ??

    I don't get any problems when exchanging simple Types like String, int, double, boolean etc. Furthermore it works fine to transfer BeanObjects and Arrays of Beans (Jboss uses AXIS and AXIS implements a BeanSerializer/DeSerializer).