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 Christian Schmitz <cs...@pironet-ndh.com> on 2002/06/24 12:10:24 UTC

.NET Client does not deserialize typed Array

Hallo,
last week I wrote to this user list because .Net won't deserialize
java.util.vector. The most recommend solution was to use typed arrays
instead of a vector. I tried it, but this doesn't work too. If anybody could
help, I'm going to go mad :o)

Here is the infected code extract and a description of the I tried to use
it:

This are my Java Web Service (JobInfo is a JavaBean, containing Data Types
like String, long and Date)
 
        
        public JobInfo[] getPendingJobInfoListArray() 
        {
		CreateTestJobInfo tj = new CreateTestJobInfo();
JobInfo[] JobArray = {(JobInfo)tj.getJobInfoTestObject("Pending Job Nummer
1"), (JobInfo)tj.getJobInfoTestObject("Pending Job Nummer
2"),(JobInfo)tj.getJobInfoTestObject("Pending Job Nummer 3") };
		return JobArray;       	
        } 

This is the second way I tried, because there was posted a tip to use
collection and create a Array of it. But this way Tomcat throws a
ClassCastException.

        public JobInfo[] getRunningJobInfoListArray() 
        {
        	Collection result = new ArrayList();
        	CreateTestJobInfo tj = new CreateTestJobInfo();
        	result.add( (JobInfo)tj.getJobInfoTestObject("Running Job
Nummer 1") );
        	result.add( (JobInfo)tj.getJobInfoTestObject("Running Job
Nummer 2") );
        	result.add( (JobInfo)tj.getJobInfoTestObject("Running Job
Nummer 3") );
        	return (JobInfo[]) result.toArray();		     	
        } 

In deployment descriptor I mapped the BeanSerializer from Axis to Serialize
the Object:

 <service name="WorkflowService" provider="java:RPC">
      <namespace>http://mySchema.de/</namespace>
      <typeMapping
        xmlns:ns="http://mySchema.de/xsd"
        qname="ns:JobInfo"
        type="java:com.pb.bs.workflow.webservice.JobInfo"
        serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
        deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
        encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
      />
...

I deployed the Service using axis beta2 in Tomcat 4.0.3 and created the WSDL
file of the deployed service with org.apache.axis.wsdl.Java2WSDL

Then I used the WSDL file to create a Proxy with wsdl.exe of the .NET
Framework.

And this is the error my app caught when I try to invoke the service:

System.InvalidOperationException: There is an error in XML document (5, 5).
---> System.InvalidOperationException: The specified type was not
recognized: name='JobInfo', namespace='http://mySchema.de/xsd', at
<getPendingJobInfoListArrayReturn xmlns=''>.
   at
System.Xml.Serialization.XmlSerializationReader.GetPrimitiveType(XmlQualifie
dName typeName)
   at System.Xml.Serialization.XmlSerializationReader.ReadArray()
   at
System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(Strin
g name, String ns, Boolean elementCanBeType, String& fixupReference)
   at
System.Xml.Serialization.XmlSerializationReader.ReadReferencingElement(Strin
g& fixupReference)
   at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReader1.Read36
_getPendingJobInfoListArrayResponse()
   --- End of inner exception stack trace ---


I watched the TCP Channel using tcpmon of Axis and if it helps I can post
the SOAP Message returned to client!


Christian