WebService之CXF注解报错(三)

news/2024/7/3 3:42:01 标签: java

WebService之CXF注解


1、具体错误如下

五月 04, 2014 11:29:28 下午 org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://service.you.com/}IServiceService from class com.you.service.IService
五月 04, 2014 11:29:29 下午 org.apache.cxf.services.IServiceService.IServicePort.IService
信息: Outbound Message
---------------------------
ID: 1
Address: http://localhost:8686/PortalService/services/test
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=[""]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:test xmlns:ns2="http://service.you.com/"><arg0><age>18</age><name>张三</name></arg0></ns2:test></soap:Body></soap:Envelope>
--------------------------------------
五月 04, 2014 11:29:30 下午 org.apache.cxf.phase.PhaseInterceptorChain doDefaultLogging
警告: Interceptor for {http://service.you.com/}IServiceService#{http://service.you.com/}test has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:137)
	at $Proxy39.test(Unknown Source)
	at com.test.service.IServiceTest.main(IServiceTest.java:50)
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '404: Not Found' when communicating with http://localhost:8686/PortalService/services/test
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1565)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1520)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1326)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:50)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:223)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:635)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	... 9 more

Exception in thread "main" javax.xml.ws.WebServiceException: Could not send Message.
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:148)
	at $Proxy39.test(Unknown Source)
	at com.test.service.IServiceTest.main(IServiceTest.java:50)
Caused by: org.apache.cxf.transport.http.HTTPException: HTTP response '404: Not Found' when communicating with http://localhost:8686/PortalService/services/test
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1565)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponse(HTTPConduit.java:1520)
	at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1326)
	at org.apache.cxf.io.CacheAndWriteOutputStream.postClose(CacheAndWriteOutputStream.java:50)
	at org.apache.cxf.io.CachedOutputStream.close(CachedOutputStream.java:223)
	at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
	at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:635)
	at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307)
	at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:502)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:411)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:314)
	at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:267)
	at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
	at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:137)
	... 2 more

2、错误原因

Webservice项目中的测试文件中的路径出现问题,原来的是这样的:

http://localhost:8686/IPservice/services/test

而项目的名称是Webservice,不是IPservice


3、解决办法

修改路径:http://localhost:8686/Webservice/services/test


4、正确运行结果

五月 05, 2014 9:54:07 下午 org.apache.cxf.wsdl.service.factory.ReflectionServiceFactoryBean buildServiceFromClass
信息: Creating Service {http://service.you.com/}IServiceService from class com.you.service.IService
五月 05, 2014 9:54:09 下午 org.apache.cxf.services.IServiceService.IServicePort.IService
信息: Outbound Message
---------------------------
ID: 1
Address: http://localhost:8686/Webservice/services/test
Encoding: UTF-8
Http-Method: POST
Content-Type: text/xml
Headers: {Accept=[*/*], SOAPAction=[""]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:test xmlns:ns2="http://service.you.com/"><arg0><age>18</age></arg0></ns2:test></soap:Body></soap:Envelope>
--------------------------------------
五月 05, 2014 9:54:10 下午 org.apache.cxf.services.IServiceService.IServicePort.IService
信息: Inbound Message
----------------------------
ID: 1
Response-Code: 200
Encoding: UTF-8
Content-Type: text/xml;charset=UTF-8
Headers: {Content-Length=[210], content-type=[text/xml;charset=UTF-8], Date=[Mon, 05 May 2014 13:54:10 GMT], Server=[Apache-Coyote/1.1]}
Payload: <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns2:testResponse xmlns:ns2="http://service.you.com/"><return>年龄:18</return></ns2:testResponse></soap:Body></soap:Envelope>
--------------------------------------
年龄:18




http://www.niftyadmin.cn/n/1306276.html

相关文章

HDU 1028 Ignatius and the Princess III(母函数)

题目&#xff1a;HDU-1028 题目链接&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid1028 题目&#xff1a; Ignatius and the Princess III Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 16806 …

IE9和JPEG-XR:第一印象

One of the new features in IE9 is the support for the JPEG-XR format, which reportedly has a better compression. Is it something we should dive into ASAP? IE9的新功能之一是对JPEG-XR格式的支持&#xff0c;据说该格式具有更好的压缩率。 我们应该尽快涉足吗&…

JavaScript实现获取table中某一列的值

JavaScript实现获取table中某一列的值 1、实现源码 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns"http://www.w3.org/1999/xhtml"> …

HDU 1085 Holding Bin-Laden Captive!(母函数)

题目&#xff1a;HDU-1085 题目链接&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid1085 题目&#xff1a; Holding Bin-Laden Captive! Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 19057 Accep…

WebService之CXF注解之一(封装类)

Teacher.java&#xff1a; /*** Title:Teacher.java* Package:com.you.model* Description:老师封装类* author:Youhaidong(游海东)* date:2014-5-5 下午11:03:13* version V1.0*/ package com.you.model;import java.io.Serializable;/*** 类功能说明* 类修改者 修改日期* 修改…

编程神书_向编程之神祈祷

编程神书Oh Almighty All-One (01), 全能的哦(01)&#xff0c; Grant me the courage to embrace and early adopt new cool technologies, the serenity to ignore distractions from new technology fads and the wisdom to tell the difference. 让我勇于接受和尽早采…

YSlow开发:自定义规则集

(This is part 3. See part one and part two.) (这是第3部分。请参见第1部分和第2部分。) There are two concepts to remember when working on your YSlow extensions and customizations: 在处理YSlow扩展和自定义项时&#xff0c;要记住两个概念&#xff1a; rules (or &q…

HDU 1171 Big Event in HDU

题目&#xff1a;HDU-1085 题目链接&#xff1a;http://acm.hdu.edu.cn/showproblem.php?pid1085 题目&#xff1a; Big Event in HDU Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 31958 Accepted Submi…