This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js and have Paul Jensen on-line!
See this thread for details.
Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

.net java InvalidCastException  RSS feed

 
kuldeep malhotra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i am using apache axis to write web services but when .net calls my service it gives the following error.
System.InvalidCastException: Cannot assign object of type SystemWebService.d31504.organisationdetails to an object of type SystemWebService.d31504.organisationdetails[].

here is the part of my wsdl


<complexType name="OrganisationList">
<sequence>
<element name="id" nillable="true" type="xsd:string"/>
<!--<element name="arrayorganisationDetails" minOccurs="0" maxOccurs="1" nillable="true" type="tns1:arroyorganisationdetails" /> -->
<element name="arrayorganisationDetails" nillable="true" minOccurs="0" maxOccurs="1" type="tns1:ArrayOfString1"/>

</sequence>
</complexType>

<complexType name="ArrayOfString1">
<sequence>
<element minOccurs="0" maxOccurs="unbounded" name="orgstring" nillable="true" type="becta rganisationdetails" />
</sequence>
</complexType>

i am not sure is this the right place to ask my question , any one help.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

What Axis can send via SOAP with restricted Interoperability
Java Collections
Some of the Collection classes, such as Hashtable, do have serializers, but there is no formal interoperability with other SOAP implementations, and nothing in the SOAP specifications which covers complex objects. The most reliable way to send aggregate objects is to use arrays. In particular, .NET cannot handle them, though many Java SOAP implementations can marshall and unmarshall hash tables.

from Axis User's Guide

What version of axis are you using? There used to be a bug with unbounded arrays Java2WSDL generates invalid WSDL for arrays specified as public members

Seems like your not the first one with these kinds of problems (Web Services in Java Vs C#).

My guess is that the organisationsdetails type from the becta namespace is the culprit.

tool WSDL error

Clearly somewhere a single object is being assigned where an array of objects is expected. Maybe this is relevant:

Dino Chiesa [Microsoft] (VIP)
the WSDL file - how did you generate this? Is it auto-generated by AXIS?

Can you try this: Wrap the array of objects in an object.
Eg, rather than a method signature like this:

MyObject[] WebServiceMethod(RequestMessage req)

Do this:

ResponseMessage WebServiceMethod(RequestMessage req)

where
public ResponseMessage {
MyObject[] ary;
}

-Dino

from Serialization problem, VB.Net Client consuming Java Axis Web Service
and Serialization problem, using .NET client to access Java (Apache Axis) Web Service

Also take a look at axis-dev RE: Wrapped vs. Document

You may have to tweak the WSDL that you are using to generate the .NET proxy's or even modify the generated code

Hope this helps somehow.
[ October 26, 2005: Message edited by: Peer Reynders ]
 
kuldeep malhotra
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tons of thanks,
i have sorted my problem .
Actually i was doing similar things but could get sorted .
Finally this email sorted all.
http://issues.apache.org/bugzilla/show_bug.cgi?id=14152
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!