zoukankan      html  css  js  c++  java
  • webservice注意事项

    1、private static final QName PORT_NAME = new QName("http://server.helloworld.cxf.demo/","HelloWorldPort");

    一定要在HelloWorld后面加上Port,不然会报如下错误:

    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
    at com.sun.proxy.$Proxy35.sayHello(Unknown Source)
    at demo.cxf.helloworld.Client.main(Client.java:21)

    2、private static final QName PORT_NAME = new QName("http://server.helloworld.cxf.demo/","HelloWorldPort");

    "http://server.helloworld.cxf.demo/"默认一定是接口所在包的逆序路径,而不是实现类所在包的逆序路径,

    否则会包如下错误


    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
    at com.sun.proxy.$Proxy35.sayHello(Unknown Source)
    at demo.cxf.helloworld.Client.main(Client.java:21)
    Caused by: java.lang.NullPointerException
    at org.apache.cxf.transport.http.URLConnectionHTTPConduit.createConnection(URLConnectionHTTPConduit.java:104)
    at org.apache.cxf.transport.http.URLConnectionHTTPConduit.setupConnection(URLConnectionHTTPConduit.java:117)
    at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:497)
    at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)

    3、private static final QName PORT_NAME = new QName("http://server.helloworld.cxf.demo/","HelloWorldPort");

    "http://server.helloworld.cxf.demo/"最后一个"/"必须得要,否则会报如下错误

    Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Fault string, and possibly fault code, not set
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:161)
    at com.sun.proxy.$Proxy35.sayHello(Unknown Source)
    at demo.cxf.helloworld.Client.main(Client.java:21)
    Caused by: java.lang.NullPointerException
    at org.apache.cxf.transport.http.URLConnectionHTTPConduit.createConnection(URLConnectionHTTPConduit.java:104)
    at org.apache.cxf.transport.http.URLConnectionHTTPConduit.setupConnection(URLConnectionHTTPConduit.java:117)
    at org.apache.cxf.transport.http.HTTPConduit.prepare(HTTPConduit.java:497)
    at org.apache.cxf.interceptor.MessageSenderInterceptor.handleMessage(MessageSenderInterceptor.java:46)
    at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:308)
    at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:514)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:423)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:324)
    at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:277)
    at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
    at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:139)
    ... 2 more

    4、而private static final QName SERVICE_NAME = new QName("http://server.helloworld.cddxf.demo/","HelloWorldffgg");

    没有如此多的要求,好像怎么命名都行

    5、private static final QName PORT_NAME = new QName("http://server.helloworld.cxf.demo/","HelloWorldPort");

    “HelloWorldPort”必须是接口名+Port,换成其他的都不行,

  • 相关阅读:
    今天试了下lockerz,感觉国外的概念很先进
    十月一日,本人就结婚了,我和老婆选的婚礼主题曲,大家听听
    今天遇到了个奇怪的问题
    第一个博客,第一次随笔
    遇到一个奇葩的问题,could not load the assembly file XXX downloaded from the Web
    Log4net简单使用
    AutoWCFService心跳动态加载服务
    初学Service Broker
    新浪SAE云空间和SVN版本控制
    软件工程导论第一次作业
  • 原文地址:https://www.cnblogs.com/oymx/p/5311175.html
Copyright © 2011-2022 走看看