• Post Reply Bookmark Topic Watch Topic
  • New Topic

Can't cast ServiceClient to WSBindingProvider

 
Maxim Che
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello!

So I have this web service(based on axis2) which is supposed to act as a client to other web service. But when trying to cast my servicePort (docManClient) to WSBindingProvider I get ClassCastException error:

com.sun.proxy.$Proxy283 cannot be cast to com.sun.xml.internal.ws.developer.WSBindingProvider

What confuses me is that this code works ok when execution from simple java application, but when execution from web service it fails. Also I've noticed that when executed from simple java application docManClient is a SEIStub object but when this code is executed inside my axis2 webservice, docManClient is JAXWSProxyHandler. I don't know if that helps or what should I do.

How can I fix or analyse deeply this classcast exception? Is there a way to avoid casting it to WSBindingProvider and set headers with JAXWSProxyHandler?

Thanks in advance.

 
Maxim Che
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For those who found this topic and facing the same problem. My solution was to use javax.xml.ws.BindingProvider class instead of com.sun.xml.internal.ws.developer.WSBindingProvider. This way casting went well.

One good man from a different forum suggested not to use packages from JDK(com.sun.* или com.oracle.*) because their methods could be deprecated or changed without notice. I guess something like that happened because I used an old WebService API manual and something could change.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!