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
-
J2EE / C# DataTransfer problem using WebServices (2 messages)
- Posted by: Matthias Zint
- Posted on: June 29 2004 11:58 EDT
Threaded Messages (2)
- What is the WSDL binding style and use attributes? by Web Master on June 29 2004 14:18 EDT
- Document/Literal by Matthias Zint on June 30 2004 05:05 EDT
-
What is the WSDL binding style and use attributes?[ Go to top ]
- Posted by: Web Master
- Posted on: June 29 2004 14:18 EDT
- in response to Matthias Zint
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? -
Document/Literal[ Go to top ]
- Posted by: Matthias Zint
- Posted on: June 30 2004 05:05 EDT
- in response to Web Master
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).