I have written web service example program using jboss as 7.0.2 Final profile. I want to add MAINTAIN_SESSION_PROPERTY to the client, but while casting to BindingProvider it generate the following exception
org.apache.cxf.calculator.CalculatorServiceSoapBindingStub cannot be cast to javax.xml.ws.BindingProvider
-----1 Port: org.apache.cxf.calculator.CalculatorServiceSoapBindingStub@110c424
Exception in thread "main" java.lang.ClassCastException: org.apache.cxf.calculator.CalculatorServiceSoapBindingStub cannot be cast to javax.xml.ws.BindingProvider
Joined: May 24, 2011
I think you should check if your Apache CXF version supports JAX-WS. Somewhere the JAX-RPC and JAX-WS are getting mixed.
Joined: Feb 16, 2012
I am using Jboss AS 7.0.2-Final version with eclipse juno for generating web service and it client
Hi Nilesh, did you get any solution of this problem?? I am stuck in the same issue.. Please help..
Joined: Feb 16, 2012
Sandy Ghosh wrote:Hi Nilesh, did you get any solution of this problem?? I am stuck in the same issue.. Please help..
Note: Kindly don't use eclipse based Web Service client tools.
1. download the apache cxf from http://cxf.apache.org/download.html 2. Set path variable for apache cxf.
3. open command prompt and go to your the wsdl file location.
4. run the following command to generate the client code for web service.
wsdl2java -frontend jaxws21 CalculatorWS.wsdl
above command generate the java client code for apache cxf based web service.
Use the generated client code in your project for writing web service client.
Below i have metioned how instantiate port and set the session property
public CalculatorWS port;
Service service = Service.create(new URL(""http://localhost:8080/CalculatorWS?wsdl"), new QName("http://apache.org/cxf/calculator", "CalculatorService");
port = service.getPort(new QName("http://apache.org/cxf/calculator", "CalculatorPort");, CalculatorWS.class);
((BindingProvider)port).getRequestContext().put("javax.xml.ws.client.connectionTimeout","18000000"); //60*1000*60*5 =5 hours
((BindingProvider) port).getRequestContext().put("javax.xml.ws.client.receiveTimeout", "3600000"); //30*1000*60 - 30 minute - Duration Defines Web Service Response Time
How to handle below error: javax.xml.ws.WebServiceException: com.sun.xml.wss.impl.XWSSecurityRuntimeException: WSS1601: Security Requirements not met - Transport binding configured in policy but incoming message was not SSL enabled