cxf动态调用webService接口异常 20
采用cxf动态方式调用webservice接口,首先写了一个方法,主要代码如下:DynamicClientFactorydcf=DynamicClientFactory....
采用cxf动态方式调用webservice接口,首先写了一个方法,主要代码如下:
DynamicClientFactory dcf = DynamicClientFactory.newInstance (); Client client = dcf.createClient(url); //返回对象数组 Object[] objects = new Object[0]; try { //调用接口方法 objects = client.invoke ("HelloWorld"); } catch (Exception e) { e.printStackTrace (); } return objects[0].toString ();
然后:
单独写一个main方法,调用该方法可以执行成功,并返回结果。
在项目里(基于webwork)action调用,则在Client client = dcf.createClient(url);一行出现错误,创建失败。
异常主要内容为:
org.apache.cxf.service.factory.ServiceConstructionException: Failed to create servic
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:80)at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:292)
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.NullPointerException at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:240) at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:191) at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:78)
Caused by: java.lang.NullPointerException at com.caucho.xml.QAttributedNode.getAttributeNodeNS(QAttributedNode.java:146) at org.apache.cxf.staxutils.StaxUtils.isDeclared(StaxUtils.java:980) at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:231)
是什么原因,希望知道的朋友能帮忙解答,或者能给出自己的意见,谢谢! 展开
DynamicClientFactory dcf = DynamicClientFactory.newInstance (); Client client = dcf.createClient(url); //返回对象数组 Object[] objects = new Object[0]; try { //调用接口方法 objects = client.invoke ("HelloWorld"); } catch (Exception e) { e.printStackTrace (); } return objects[0].toString ();
然后:
单独写一个main方法,调用该方法可以执行成功,并返回结果。
在项目里(基于webwork)action调用,则在Client client = dcf.createClient(url);一行出现错误,创建失败。
异常主要内容为:
org.apache.cxf.service.factory.ServiceConstructionException: Failed to create servic
at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:80)at org.apache.cxf.endpoint.dynamic.DynamicClientFactory.createClient(DynamicClientFactory.java:292)
Caused by: javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: java.lang.NullPointerException at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:240) at org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:191) at org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:78)
Caused by: java.lang.NullPointerException at com.caucho.xml.QAttributedNode.getAttributeNodeNS(QAttributedNode.java:146) at org.apache.cxf.staxutils.StaxUtils.isDeclared(StaxUtils.java:980) at org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:231)
是什么原因,希望知道的朋友能帮忙解答,或者能给出自己的意见,谢谢! 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询