Does Apache CXF library work on a WAS CE server?

403 Views Asked by At

I am using CXF to help me call certain web services. I am able to get my code to run locally, but when I deploy my war I am having issues. After looking through the logs I believe WAS CE uses axis2 as its web service engine. Is this what is causing my issues? Does the CXF library not work on WAS CE servers?

Edit: Here is my code. The issue seems to be with x509 authentication. I have been able to call a different web service that only requires Basic preemptive authentication without a problem.

    URL wsdlURL = new URL(endpoint);

    /*WSOrganization ss = new WSOrganization(wsdlURL, SERVICE_NAME);
    port = ss.getWSOrganizationSoap();*/

    JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
    factory.setAddress(endpoint);
    factory.setServiceClass(WSSoap.class);
    port = (WSSoap) factory.create();

    Client client = ClientProxy.getClient(port);
    Endpoint cxfEndpoint = client.getEndpoint();


    Map<String,Object> outProps = new HashMap<String,Object>();

    WSS4JOutInterceptor wssOut = new WSS4JOutInterceptor(outProps);

    outProps.put(WSHandlerConstants.ACTION, "Signature");
    outProps.put(WSHandlerConstants.USER, "alias");
    outProps.put(WSHandlerConstants.SIG_KEY_ID, "DirectReference");
    outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, 
        PWDCallbackHandler.class.getName());
    outProps.put(WSHandlerConstants.SIG_PROP_FILE, "crypto.properties");

    cxfEndpoint.getOutInterceptors().add(wssOut);

Logs are gving me this error:

javax.xml.ws.soap.SOAPFaultException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. 
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:156)
at $Proxy96.findCode(Unknown Source)
... 6 more
Caused by: 
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted. 
at org.w3c.dom.DOMException.<init>(Unknown Source)
at org.apache.axiom.om.impl.dom.ParentNode.insertBefore(ParentNode.java:164)
at org.apache.axiom.om.impl.dom.NodeImpl.appendChild(NodeImpl.java:238)
at org.apache.axis2.saaj.SOAPPartImpl.appendChild(SOAPPartImpl.java:986)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.setChild(W3CDOMStreamWriter.java:114)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.newChild(W3CDOMStreamWriter.java:104)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:132)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:122)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:81)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:61)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:263)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:519)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:449)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:352)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:304)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:88)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
... 7 more
0

There are 0 best solutions below