You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by "Kordes, Paul" <pk...@vignette.com> on 2003/06/05 16:21:08 UTC

.Net unbounded element deserialization error

Help anyone ...

I'm testing interoperability of my webservice with a .NET Client (Visual
Basic).  I have deployed my webservice such that we have our own custom
wsdl.  Basically we wrap the entire input and output in one javebean object
each.  In this case, there is no input, and the output contains an array.
Rather than use a soaparray, we have simply designated a single element of
the output object with a maxoccurs=unbounded.  That single element is a
complex type that has 3 elements itself.  This works fine in the java world,
however, when I use the .NET client, I get the following error ...

Unhandled Exception: System.InvalidOperationException: There is an error in
XML document (10, 15). ---> System.InvalidCastException: Cannot assign
object of type testWSAccept.useengc0007065.Struct1 to an object of type
testWSAccept.useengc0007065.Struct1[].
   at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read1_
testTableResponse()

I don't understand why it is hitting this error.  Below is the wsdl.  It
does contain one artifical wsdl:type, namely Struct1Array that is defined
but not used anywhere.  This is leftover from when we were using SoapArrays
earlier.  Any help would be VERY appreciated.  I'm absolutely stuck.
Thanks,

Paul Kordes

<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="urn:vignette"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="urn:vignette"
xmlns:intf="urn:vignette"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <wsdl:types>
  <schema targetNamespace="urn:vignette"
xmlns="http://www.w3.org/2001/XMLSchema">
   <import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
   <complexType name="Struct1">
    <sequence>
     <element name="Param1" type="xsd:string"/>
     <element name="Param2" type="xsd:string"/>
     <element name="Param3" type="xsd:string"/>
    </sequence>
   </complexType>
   <complexType name="testTableResponse">
    <sequence>
     <element maxOccurs="unbounded" name="Output1" type="impl:Struct1"/>
    </sequence>
   </complexType>
   <complexType name="Struct1Array">
    <complexContent>
     <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="impl:Struct1[]"/>
     </restriction>
    </complexContent>
   </complexType>
  </schema>
 </wsdl:types>
 <wsdl:message name="testTableRequest"/>
 <wsdl:message name="testTableResponse">
  <wsdl:part name="outputs" type="intf:testTableResponse"/>
 </wsdl:message>
 <wsdl:portType name="accept">
  <wsdl:operation name="testTable">
   <wsdl:input message="intf:testTableRequest" name="testTableRequest"/>
   <wsdl:output message="intf:testTableResponse" name="testTableResponse"/>
  </wsdl:operation>
 </wsdl:portType>
 <wsdl:binding name="acceptSoapBinding" type="intf:accept">
  <wsdlsoap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
  <wsdl:operation name="testTable">
   <wsdlsoap:operation soapAction=""/>
   <wsdl:input name="testTableRequest">
    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:vignette" use="encoded"/>
   </wsdl:input>
   <wsdl:output name="testTableResponse">
    <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
namespace="urn:vignette" use="encoded"/>
   </wsdl:output>
  </wsdl:operation>
 </wsdl:binding>
 <wsdl:service name="accept">
  <wsdl:port binding="intf:acceptSoapBinding" name="accept">
   <wsdlsoap:address
location="http://localhost:8080/mytest/services/accept"/>
  </wsdl:port>
 </wsdl:service>
</wsdl:definitions>