Skip to main content

Cannot be cast to com.sun.xml.ws.developer.WSBindingProvider

1 reply [Last post]
fmaredia
Offline
Joined: 2013-06-03
Points: 0

I want to know if anyone figured out how to resolve this issue. I've searched on google and have not found the solution to this problem. Can anyone help me? I'm running my java program on JDK 6 and I added jaxws-rt-2.2.7.jar to my project library. When I searched for "WSBindingProvider" type on eclipse, it found the type in 2 places. One was found in jaxws-rt-2.27 jar and the other one was found in jdk160_18. Is this my problem? If so, how can I fix it?

Here's my code

URL wsdlLocation = new URL(url);
QName portName = new QName(namespace,serviceName);
UsedCarWSX_Service ws = new UsedCarWSX_Service(wsdlLocation,portName);
UsedCarWSX usedCarWSX = ws.getUsedCarWSX();

//---------Populate the UserCredentials-------
UserCredentials uc = new UserCredentials();
uc.setUserid(username);
uc.setPassword(password);
uc.setProducttype("W");
javax.xml.ws.Holder ucHolder=new Holder(uc);

String vin = vin;
BBValues vinValues = null;
CurrentVINValues cvv = null;
cvv = new CurrentVINValues();
cvv.setBFillDrilldown(true);
cvv.setBReturnAddDeducts(false);
cvv.setBReturnMileage(true);
cvv.setIAverageAddDeductAdj(0);
cvv.setICleanAddDeductAdj(0);
cvv.setIExtraCleanAddDeductAdj(0);
cvv.setIMileage(0);
cvv.setIRoughAddDeductAdj(0);
cvv.setSCountryCode("U");
cvv.setSFrequencyCode("W");
cvv.setSVIN(vin);

// ---------- Call the web service --------------
CurrentVINValuesResponse cvr = usedCarWSX.getCurrentVINValues(cvv, ucHolder);

WSBindingProvider bp=(WSBindingProvider)usedCarWSX;
List hl=bp.getInboundHeaders();
UserCredentials incomingUC = parseResponseHeader((Header)hl.get(0));

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jungicz
Offline
Joined: 2004-08-17
Points: 0

is it possible that one of the WSBindingProvider instances is from com.sun.xml.internal.ws.developer package? That would mean you did not set up endorsed for running your project on JDK 6 (https://jax-ws.java.net/2.2.7/docs/ch02.html#running-on-top-of-jdk-6)