1

I am currently trying to call a JAX-WS from a Weblogic 12c and Java 7 environment. I've generated the client stubs using the weblogic client generator plugin from maven, specifically:

<b>groupId:com.oracle.weblogic</b><br>
<b>artifactId:weblogic-maven-plugin</b>

client jars seem to generate fine. I am able to generate the client stub in java, but when the actual API is called through the stub that will send the SOAP message to the service, I get the following strange exception:

<b>com.sun.xml.ws.client.ClientTransportException: HTTP transport error: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
com.sun.xml.ws.client.ClientTransportException: HTTP transport error: java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
 at com.sun.xml.ws.transport.http.client.HttpClientTransport.getOutput(HttpClientTransport.java:131)
 at com.sun.xml.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:219)
 at com.sun.xml.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:143)
 at com.sun.xml.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:138)
 at com.sun.xml.ws.api.pipe.Fiber.__doRun(Fiber.java:892)
 at com.sun.xml.ws.api.pipe.Fiber._doRun(Fiber.java:841)
 at com.sun.xml.ws.api.pipe.Fiber.doRun(Fiber.java:804)
 at com.sun.xml.ws.api.pipe.Fiber.runSync(Fiber.java:706)
 at com.sun.xml.ws.client.Stub.process(Stub.java:385)
 at com.sun.xml.ws.client.sei.SEIStub.doProcess(SEIStub.java:189)
 at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:119)
 at com.sun.xml.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:102)
 at com.sun.xml.ws.client.sei.SEIStub.invoke(SEIStub.java:172)
 at $Proxy130.getSearchResults(Unknown Source)
 at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
 at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
 at java.lang.reflect.Method.invoke(Method.java:601)
 at weblogic.wsee.jaxws.spi.ClientInstanceInvocationHandler.invoke(ClientInstanceInvocationHandler.java:84)</b>

I saw this same question being posted under a glassfish setup Here

But with no solution.

Now i've tried SOAP UI, the service responds fine from here, i've tried using weblogic 11g, and same error is produced. I am logging the actual SOAP message that is going out before the exception is produced, and the xml is accurate and works when run from SOAP UI.

What could be causing this?

Thanks

asked Feb 19, 2014 at 17:31

2 Answers 2

2

It took me couple of hours to fix the problem. I was using the wrong BindingProviderProperties interface.

The BindingProviderProperties interface exists in two different packages. (for different Java/JAX-WS versions)

If you are getting ClassCastException most probably you need import different package in your soap service class.

change

import com.sun.xml.ws.client.BindingProviderProperties;

to

import com.sun.xml.internal.ws.client.BindingProviderProperties;
answered Dec 11, 2014 at 5:13
Sign up to request clarification or add additional context in comments.

3 Comments

This definitely send me in the right direction. I was setting BindingProviderProperties for timeouts using string-values, rather than integer-values (e.g. "5000" versus 5000). Thanks!
@MartinDevillers Thank you! I had the same problem with Long values, had to cast return value of Duration.toMillis() to Integer.
If you change the package of the property, the error goes away because internally the implementation use the other property. The correct thing to do to avoid the problem and to really set a timeout is to pass the property value as int.
2

The problem is that you're setting timeout properties using String value, however internally the class HttpClientTransport in createHttpConnection() method is expecting an integer for this property:

...
Integer reqTimeout = (Integer)context.invocationProperties.get(BindingProviderProperties.REQUEST_TIMEOUT);
if (reqTimeout != null) {
 httpConnection.setReadTimeout(reqTimeout);
}
...

Then if you're passing the property as String, it throws the ClassCastException. So I suppose you've something like:

String timeoutInMillis = "30000";
dispatcher.getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, timeoutInMillis);
dispatcher.getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, timeoutInMillis);

Instead of you must set the property value as int for example using Integer.valueOf(String value):

String timeoutInMillis = "30000";
dispatcher.getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, Integer.valueOf(timeoutInMillis));
dispatcher.getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, Integer.valueOf(timeoutInMillis));

Or alternatively you can also define the timeout as int:

int timeoutInMillis = 30000;
dispatcher.getRequestContext().put(BindingProviderProperties.REQUEST_TIMEOUT, timeoutInMillis);
dispatcher.getRequestContext().put(BindingProviderProperties.CONNECT_TIMEOUT, timeoutInMillis);
answered May 14, 2019 at 12:22

Comments

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.