.NET/Java double-dimensional (jagged) array interop
- From: tiberiu.motoc@xxxxxxxxx
- Date: 20 Jan 2007 11:35:16 -0800
Hi.
I've asked this question on the MSDN forums, but I've had no replies.
I'm really stuck, so I'm gonna try my luck here.
I have a Java web service which contains a simple function; the
function returns a double-dimensional array of integers. I ran the wsdl
utility and I created a simple .NET web client which calls the
function. I noticed that the result is returned as a jagged array,
since multi-dimensional arrays cannot be serialized, and that is ok
with me. However, the returned result is an empty jagged array. I think
the error is in the generated client class, but I don't know enough
about SOAP&serialization to fix it.
Here is the respective portion in my wsdl file (generated by Eclipse
bottom-up web service wizard):
<element name="get_ccbdataResponse">
<complexType>
<sequence>
<element name="get_ccbdataReturn" type="impl:ArrayOf_xsd_int"
maxOccurs="unbounded"/>
</sequence>
</complexType>
</element>
<complexType name="ArrayOf_xsd_int">
<sequence>
<element name="item" type="xsd:int" minOccurs="0"
maxOccurs="unbounded"/>
</sequence>
</complexType>
And here is the respective portion of the Client file (generated by the
wsdl.exe utility)
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
RequestNamespace="http://DefaultNamespace",
ResponseNamespace="http://DefaultNamespace",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return:
System.Xml.Serialization.XmlArrayAttribute("get_ccbData3Return")]
[return: System.Xml.Serialization.XmlArrayItemAttribute("item",
typeof(int), IsNullable=false)]
public int[][] get_ccbData3() {
object[] results = this.Invoke("get_ccbData3", new object[0]);
return ((int[][])(results[0]));
}
After noticing that a response looks like this (and after getting some
nasty errors):
<?xml version="1.0" encoding="utf-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body><get_ccbData3Response
xmlns="http://DefaultNamespace"><get_ccbData3Return><get_ccbData3Return>1</get_cc
bData3Return><get_ccbData3Return>2</get_ccbData3Return></get_ccbData3Return><get_ccbData3Return><get_ccbData3Return>3</get_ccbData3Return>
<get_ccbData3Return>4</get_ccbData3Return></get_ccbData3Return></get_ccbData3Response></soapenv:Body></soapenv:Envelope>
I changed my client to look like this:
[System.Web.Services.Protocols.SoapDocumentMethodAttribute("",
RequestNamespace="http://DefaultNamespace",
ResponseNamespace="http://DefaultNamespace",
Use=System.Web.Services.Description.SoapBindingUse.Literal,
ParameterStyle=System.Web.Services.Protocols.SoapParameterStyle.Wrapped)]
[return:
System.Xml.Serialization.XmlArrayAttribute("get_ccbData3Return")]
[return:
System.Xml.Serialization.XmlArrayItemAttribute("get_ccbData3Return",
typeof(int[]), IsNullable=false)]
public int[][] get_ccbData3()
{
object[] results = this.Invoke("get_ccbData3", new object[0]);
return ((int[][])(results[0]));
}
Unfortunately, this way, the return is an empty jagged array (size of
2X0). Where does the problem lie? I bet there is something wrong with
the XML serialization attributes of the client. What can I do to fix
it?
Thanks,
Tiberiu
.
- Follow-Ups:
- Re: .NET/Java double-dimensional (jagged) array interop
- From: tiberiu . motoc
- Re: .NET/Java double-dimensional (jagged) array interop
- Prev by Date: validating xml doc with multiple schemas using wildcards
- Next by Date: Select Filter with namespaces
- Previous by thread: validating xml doc with multiple schemas using wildcards
- Next by thread: Re: .NET/Java double-dimensional (jagged) array interop
- Index(es):
Relevant Pages
|