So, after hammering on it a while, I found the problem.

I was doing client.invoke(operation, Object[]) with a QName for the operation.  
I needed to pass it the BindingOperationInfo for my operation.  I'm guessing 
with the QName it was matching a different endpoint.

Now I just have one problem left.



The result from client.invoke() is an object of type String.

I expect it to be of type 
client.getEndpoint().getEndpointInfo().getBinding().getOperations().iterator().next().getOperationInfo().getOutput().getMessageParts().get(0).getTypeClass()

How do I tell client.invoke to send me back an object of the class that matches 
the getTypeClass() for the message part of the output?

Thanks,
Kevin



________________________________
From: Kevin McClusky <[email protected]>
To: "[email protected]" <[email protected]>
Sent: Thursday, May 12, 2011 3:23 PM
Subject: <class> cannot be cast to java.lang.String

Hi,

I think I'm doing something wrong with a dynamic client, but I'm not sure 
what.  I'm getting a problem when trying to invoke a dynamic client.

java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: 
net.webservicex.GetQuote cannot be cast to java.lang.String


I'm creating a JaxWsDynamicClientFactory, then doing a createClient(url, 
service, classloader, port) to get the client.

From the client, I'm evaluating this:

client.getEndpoint().getEndpointInfo().getBinding().getOperations().iterator().next().getOperationInfo().getInput().getMessageParts().get(0).getTypeClass()
which gives me a net.webservicex.GetQuote Class.

I'm creating an instance of that class, setting the values, and then doing:

client.invoke(operation, instanceOfThatClass);


if I pass in a string as the second argument, it works.  If I pass in the class 
that getTypeClass() gives me, it gives me the error above.

The wsdl is here:

http://www.webservicex.net/stockquote.asmx?WSDL

The port I'm using is the "StockQuoteSoap" port, which validates in soapUI's 
WSI-BP validator.

Any help would be greatly appreciated.

Thank you,
Kevin

Reply via email to