• 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,换成其他的都不行,

  • 相关阅读:
    【转】编译原理4种文法类型
    Gamma校正与线性空间
    【翻译】CEDEC2014 CAPCOM 照相机正确的照片真实的制作工作流
    【翻译】CEDEC2013 BANDAI NAMCO 了解游戏格斗动画中的身体运动结构和原理
    UnrealEngine4 PBR Shading Model 概述
    【翻译】Kinect v2程序设计(C++-) AudioBeam篇
    【翻译】Kinect Studio是? 三月 SDK Update的新机能
    【翻译】Kinect v2程序设计(C++) Body 篇
    【翻译】Kinect v2程序设计(C++) BodyIndex篇
    【翻译】Kinect v2程序设计(C++) Depth编
  • 原文地址:https://www.cnblogs.com/oymx/p/5311175.html
Copyright © 2020-2023  润新知