It is probablly user error but...here is the problem. In my client code, I
am accessing a webservice. In the outbound request I need to insert some
values in the security header.
Following the apache sample in converting from a JAX-WS to CXF enpoint
sample:
create your service
get the port from the service
call ClientProxy.getClient(port);
add interceptors
client code is already generated and the client app does work without
attempting to map to a cxf endpoint. When I attempt to map to a CXf
endpoint a class cast exception is thrown.
QName name = new QName("<my namespace>", "workItemQuery");
URL url = new
URL("file:///C:/work/ibpm/ibpm-ws-client/src/main/resources/META-INF/ibpm-ws-client/wsdl/workItemQueryService.wsdl");
WorkItemQuery workItemQuery = new WorkItemQuery(url,name);
WorkItemQueryService port =
workItemQuery.getPort(WorkItemQueryService.class);
((BindingProvider)port).getRequestContext()
.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,"http://<my
server>/workItemQueryService");
Client cxfClient = ClientProxy.getClient(port); Throws ClassCastException
//return workItemQueryService.getWorkItems(workItemFilter).getItem();
return port.getWorkItems(workItemFilter).getItem();
ERROR HomeAction - Error getting work items
java.lang.ClassCastException: com.sun.xml.ws.client.sei.SEIStub
at org.apache.cxf.frontend.ClientProxy.getClient(ClientProxy.java:87)
at
com.nintendo.ibpm.ws.sample.action.HomeAction.getWorkItems(HomeAction.java:61)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at ognl.OgnlRuntime.invokeMethod(OgnlRuntime.java:517)
at ognl.OgnlRuntime.getMethodValue(OgnlRuntime.java:931)
at
ognl.ObjectPropertyAccessor.getPossibleProperty(ObjectPropertyAccessor.java:53)
at
ognl.ObjectPropertyAccessor.getProperty(ObjectPropertyAccessor.java:121)
at
com.opensymphony.xwork2.util.OgnlValueStack$ObjectAccessor.getProperty(OgnlValueStack.java:58)
at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643)
at
com.opensymphony.xwork2.util.CompoundRootAccessor.getProperty(CompoundRootAccessor.java:101)
at ognl.OgnlRuntime.getProperty(OgnlRuntime.java:1643)
at ognl.ASTProperty.getValueBody(ASTProperty.java:92)
at ognl.SimpleNode.evaluateGetValueBody(SimpleNode.java:170)
at ognl.SimpleNode.getValue(SimpleNode.java:210)
at ognl.Ognl.getValue(Ognl.java:333)
at ognl.Ognl.getValue(Ognl.java:310)
at com.opensymphony.xwork2.util.OgnlUtil.getValue(OgnlUtil.java:190)
at
com.opensymphony.xwork2.util.OgnlValueStack.findValue(OgnlValueStack.java:208)
at
org.apache.struts2.dispatcher.StrutsRequestWrapper.getAttribute(StrutsRequestWrapper.java:80)
at
org.apache.jasper.runtime.PageContextImpl.doGetAttribute(PageContextImpl.java:298)
at
org.apache.jasper.runtime.PageContextImpl.getAttribute(PageContextImpl.java:284)
at org.displaytag.util.LookupUtil.getBeanValue(LookupUtil.java:100)
at
org.displaytag.tags.TemplateTag.evaluateExpression(TemplateTag.java:84)
at org.displaytag.tags.TableTag.initParameters(TableTag.java:847)
at org.displaytag.tags.TableTag.doStartTag(TableTag.java:722)
at
org.apache.jsp.WEB_002dINF.pages.home_jsp._jspx_meth_display_table_0(org.apache.jsp.WEB_002dINF.pages.home_jsp:169)
at
org.apache.jsp.WEB_002dINF.pages.home_jsp._jspService(org.apache.jsp.WEB_002dINF.pages.home_jsp:105)
My Service class :
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.5-b03-
* Generated source version: 2.1
*
*/
@WebServiceClient(name = "workItemQuery", targetNamespace = "<my
namespace>", wsdlLocation = "/services/workItemQueryService?wsdl")
public class WorkItemQuery
extends Service
{
.....
}
My Enpoint/Port:
/**
* This class was generated by the JAX-WS RI.
* JAX-WS RI 2.1.5-b03-
* Generated source version: 2.1
*
*/
@WebService(name = "WorkItemQueryService", targetNamespace =
"http://ws.ibpm.nintendo.com/")
@SOAPBinding(style = SOAPBinding.Style.RPC)
@XmlSeeAlso({
ObjectFactory.class
})
public interface WorkItemQueryService {
/**
*
* @param workItemId
* @return
* returns com.nintendo.ibpm.ws.client.WorkItemModel
*/
@WebMethod
@WebResult(partName = "return")
public WorkItemModel getForId(
@WebParam(name = "workItemId", partName = "workItemId")
long workItemId);
/**
*
* @param workItemFilter
* @return
* returns com.nintendo.ibpm.ws.client.WorkItemModelArray
*/
@WebMethod
@WebResult(partName = "return")
public WorkItemModelArray getWorkItems(
@WebParam(name = "workItemFilter", partName = "workItemFilter")
WorkItemFilterModel workItemFilter);
}
any help is greatly appreciated.
Thanks
Dean
--
View this message in context:
http://www.nabble.com/Bug-in-converting-from-JAX-WS-to-Cxf-endpoint--tp21736831p21736831.html
Sent from the cxf-user mailing list archive at Nabble.com.