UserBean only contains Strings. 

The WEB Service runs to completion on the server when its invoked. But I
get the cast exception on the client. In this case it's a Java client
that was generated with WSDL2Java.

It actually fails in the SoapBindingStub on the invoke. 

                java.lang.Object _resp = _call.invoke(new
java.lang.Object[] {});

Details from the Axis fault


java.lang.ClassCastException: [Ljava.lang.Object;
    at
org.apache.axis.message.SOAPFaultBuilder.createFault(SOAPFaultBuilder.ja
va:262)
    at
org.apache.axis.message.SOAPFaultBuilder.endElement(SOAPFaultBuilder.jav
a:169)
    at
org.apache.axis.encoding.DeserializationContextImpl.endElement(Deseriali
zationContextImpl.java:1092)
    at
org.apache.xerces.parsers.AbstractSAXParser.endElement(AbstractSAXParser
.java:559)
    at
org.apache.xerces.impl.XMLNamespaceBinder.handleEndElement(XMLNamespaceB
inder.java:853)
    at
org.apache.xerces.impl.XMLNamespaceBinder.endElement(XMLNamespaceBinder.
java:643)
    at
org.apache.xerces.impl.dtd.XMLDTDValidator.handleEndElement(XMLDTDValida
tor.java:2978)
    at
org.apache.xerces.impl.dtd.XMLDTDValidator.endElement(XMLDTDValidator.ja
va:918)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.handleEndElement(X
MLDocumentFragmentScannerImpl.java:1145)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanEndElement(XML
DocumentFragmentScannerImpl.java:988)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDis
patcher.dispatch(XMLDocumentFragmentScannerImpl.java:1446)
    at
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDo
cumentFragmentScannerImpl.java:333)
    at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardPars
erConfiguration.java:529)
    at
org.apache.xerces.parsers.StandardParserConfiguration.parse(StandardPars
erConfiguration.java:585)
    at org.apache.xerces.parsers.XMLParser.parse(XMLParser.java:147)
    at
org.apache.xerces.parsers.AbstractSAXParser.parse(AbstractSAXParser.java
:1148)
    at javax.xml.parsers.SAXParser.parse(SAXParser.java:345)
    at
org.apache.axis.encoding.DeserializationContextImpl.parse(Deserializatio
nContextImpl.java:257)
    at org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:584)
    at org.apache.axis.Message.getSOAPEnvelope(Message.java:448)
    at org.apache.axis.client.Call.invokeEngine(Call.java:2719)
    at org.apache.axis.client.Call.invoke(Call.java:2682)
    at org.apache.axis.client.Call.invoke(Call.java:2372)
    at org.apache.axis.client.Call.invoke(Call.java:2295)
    at org.apache.axis.client.Call.invoke(Call.java:1777)
    at
UserServiceSoapBindingStub.getListOfUsers(UserServiceSoapBindingStub.jav
a:362)
    at UserClient.testGetListOfUsers(UserClient.java:52)
    at UserClient.main(UserClient.java:27)



-----Original Message-----
From: Wille Faler [mailto:[EMAIL PROTECTED] 
Sent: Thursday, June 23, 2005 2:13 PM
To: bjmallow
Cc: [email protected]
Subject: Re: .Net and Axis interoperability

Looks ok. If it compiles and runs ok "without" Axis and SOAP it should
run ok with Axis as well.

This is of course assuming that UserBean only contains allowed
attributes as mentioned in the earlier mail, or at least only beans
which in turn only contain allowed attributes.

Keep that link I sent you handy, it's quite useful, I still refer to it
from time to time. :)

regards
Wille

On 6/23/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> Wille
> 
> Thank you for the response. Another question if I may. Below is the 
> code where I used to be returning a Vector. I changed it to return an 
> array of UserBean objects. I remember trying this before but got a 
> class cast exception. Should this work?
> 
> Thanks
> Brad
> 
>     public UserBean[] getListOfUsers()
>         throws RemoteException
>     {
>         final String methodName = "getListOfUsers";
> 
>         mLogger.entering(className,methodName);
>         Vector vectorUserBean = new Vector();
>         try
>         {
>           while
>                 {
>                         code to get each employee and create a 
> UserBean object and it to the
>                         vectorUserBean
>                 }
> 
>           } catch ....
> 
> 
>         return (UserBean[])vectorUserBean.toArray();
>         }
> 
> 
> -----Original Message-----
> From: Wille Faler [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, June 22, 2005 9:39 AM
> To: [email protected]
> Subject: Re: .Net and Axis interoperability
> 
> Are you using a Vector-class to keep your employee-objects?
> That is a big no-no in Web Services if you don't want your service to 
> only be accessible to other Java Axis-clients.
> You should avoid using any Java-proprietary Collections, Hashmaps etc 
> and prefer using Arrays.
> The rule basically is: only use javabean objects or arrays of javabean

> objects that consist of "SOAP-native" datatypes.
> A list of possible types are found at:
> http://ws.apache.org/axis/java/user-guide.html#HowYourJavaTypesMapToSO
> AP
> XMLTypes
> 
> regards
> Wille Faler
> 
> On 6/22/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
> >
> >
> > I created an Axis WEB service (RPC) and am returning a custom class 
> > (Employee information). One of the methods I expose is
getListOfUsers.
> 
> > The method returns an array of Vector that contains Employee
objects.
> > My Java client works correctly. We have written a c# client to 
> > access the same service. However in the c# environment we are 
> > getting a cast exception. We let .Net create the initial client by 
> > pointing to the
> wsdl URL.
> >
> > Was wondering if anyone new how this should be cast.
> >
> > Brad
>

Reply via email to