cxf客户端调用接口报错
有知道的朋友,帮忙指导指导。谢谢了!错误信息:
信息: Interceptor has thrown exception, unwinding now
org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
at org.apache.axiom.om.impl.dom.ParentNode.insertBefore(ParentNode.java:235)
at org.apache.axiom.om.impl.dom.ParentNode.insertBefore(ParentNode.java:205)
at org.apache.axiom.om.impl.dom.NodeImpl.appendChild(NodeImpl.java:199)
at org.apache.axis2.saaj.SOAPPartImpl.appendChild(SOAPPartImpl.java:948)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.newChild(W3CDOMStreamWriter.java:81)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:98)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:98)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:79)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:60)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
at $Proxy43.addEnterDGPoint(Unknown Source)
at com.pcg.cxf.CallCxfInte易做图ce.main(CallCxfInte易做图ce.java:48)
Exception in thread "main" org.w3c.dom.DOMException: HIERARCHY_REQUEST_ERR: An attempt was made to insert a node where it is not permitted.
at org.apache.axiom.om.impl.dom.ParentNode.insertBefore(ParentNode.java:235)
at org.apache.axiom.om.impl.dom.ParentNode.insertBefore(ParentNode.java:205)
at org.apache.axiom.om.impl.dom.NodeImpl.appendChild(NodeImpl.java:199)
at org.apache.axis2.saaj.SOAPPartImpl.appendChild(SOAPPartImpl.java:948)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.newChild(W3CDOMStreamWriter.java:81)
at org.apache.cxf.staxutils.W3CDOMStreamWriter.writeStartElement(W3CDOMStreamWriter.java:98)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.writeSoapEnvelopeStart(SoapOutInterceptor.java:98)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:79)
at org.apache.cxf.binding.soap.interceptor.SoapOutInterceptor.handleMessage(SoapOutInterceptor.java:60)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:220)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:466)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:299)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:251)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:73)
at org.apache.cxf.frontend.ClientProxy.invoke(ClientProxy.java:68)
at $Proxy43.addEnterDGPoint(Unknown Source)
at com.pcg.cxf.CallCxfInte易做图ce.main(CallCxfInte易做图ce.java:48)
public static void main(String[] args) {cxf 客户端 --------------------编程问答-------------------- 还是jar包冲突了的问题,自己重新搭建了一套干净的环境。然后把系统中的包一个个筛查掉。
// TODO Auto-generated method stub
Map<String, Object> outProps = new HashMap<String, Object>();
outProps.put(WSHandlerConstants.ACTION, WSHandlerConstants.USERNAME_TOKEN);
outProps.put(WSHandlerConstants.USER, "gosophiaDG");
outProps.put(WSHandlerConstants.PASSWORD_TYPE, WSConstants.PW_TEXT);
outProps.put(WSHandlerConstants.PW_CALLBACK_CLASS, ClientPasswordCallback.class.getName());
String url = "http://192.168.0.11:8080/hnCXFService/ws/DualGaugeInfoCxfService";
// JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
// factory.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
// factory.getOutInterceptors().add(new SAAJOutInterceptor());
// System.setProperty("org.apache.cxf.bus.factory", "org.apache.cxf.bus.CXFBusFactory");
ClientProxyFactoryBean factory = new ClientProxyFactoryBean();
factory.setAddress(url);
factory.setServiceClass(DualGaugeInfoCxfService.class);
DualGaugeInfoCxfService service = (DualGaugeInfoCxfService)factory.create();
ClientProxy proxy = (ClientProxy)Proxy.getInvocationHandler(service);
Client client = proxy.getClient();
client.getOutInterceptors().add(new WSS4JOutInterceptor(outProps));
client.getOutInterceptors().add(new SAAJOutInterceptor());
service.addEnterDGPoint(new Long(1), new HashMap<String,Object>());
}
补充:Java , Java相关