• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Can't cast ServiceClient to WSBindingProvider

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What changes did you make in the code?

i try this: https://stackoverflow.com/questions/60443175/cant-cast-serviceclient-to-wsbindingprovider
 
reply
    Bookmark Topic Watch Topic
  • New Topic