-
webService cxf client错误0
在测试webService时候,遇到下面问题,找了半天没找到合适的解决办法
警告: Interceptor for {http://www.hzsun.com/}ThirdWebservice#{http://www.hzsun.com/}GetAccClass has thrown exception, unwinding now org.apache.cxf.interceptor.Fault: Response was of unexpected text/html ContentType. Incoming portion of HTML stream: <html> <head> <title>Runtime Error</title> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>Runtime Error</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. <br><br> <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration></pre></code> </td> </tr> </table> <br> <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration></pre></code> </td> </tr> </table> <br> </body> </html> at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:84) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:781) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1630) 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.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) at com.sun.proxy.$Proxy39.getAccClass(Unknown Source) at com.hzsun.client.Client.main(Client.java:87) Exception in thread "main" javax.xml.ws.soap.SOAPFaultException: Response was of unexpected text/html ContentType. Incoming portion of HTML stream: <html> <head> <title>Runtime Error</title> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>Runtime Error</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. <br><br> <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration></pre></code> </td> </tr> </table> <br> <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration></pre></code> </td> </tr> </table> <br> </body> </html> at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:159) at com.sun.proxy.$Proxy39.getAccClass(Unknown Source) at com.hzsun.client.Client.main(Client.java:87) Caused by: org.apache.cxf.interceptor.Fault: Response was of unexpected text/html ContentType. Incoming portion of HTML stream: <html> <head> <title>Runtime Error</title> <style> body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } </style> </head> <body bgcolor="white"> <span><H1>Server Error in '/' Application.<hr width=100% size=1 color=silver></H1> <h2> <i>Runtime Error</i> </h2></span> <font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "> <b> Description: </b>An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. <br><br> <b>Details:</b> To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="Off"/> </system.web> </configuration></pre></code> </td> </tr> </table> <br> <b>Notes:</b> The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.<br><br> <table width=100% bgcolor="#ffffcc"> <tr> <td> <code><pre> <!-- Web.Config Configuration File --> <configuration> <system.web> <customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/> </system.web> </configuration></pre></code> </td> </tr> </table> <br> </body> </html> at org.apache.cxf.interceptor.StaxInInterceptor.handleMessage(StaxInInterceptor.java:84) at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:307) at org.apache.cxf.endpoint.ClientImpl.onMessage(ClientImpl.java:781) at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.handleResponseInternal(HTTPConduit.java:1630) 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.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
2014年5月22日 10:55
4个答案 按时间排序 按投票排序
-
应该是发生了500之类的错误。把返回信息的HTML部分保存,使用浏览器打开,里面的建议是:
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>
如果你的服务端使用的是IIS,不妨看看这个,获取有帮助:
http://social.msdn.microsoft.com/Forums/en-US/ac33925b-35ec-4120-8201-751281a73324/customerrors-tag-should-have-its-mode-attribute-set-to-off?forum=clr2014年5月23日 11:25
-
你是打印输出html标签吗,如果是,首先是你的打印没错,但是紧接着报错了,然后你去检查你的代码打印后面是什么
如果说你是直接调用,然后输入html标签,正常的cxf应该是xml标签,估计你是在解析xml出错,因为他根本不是xml标签,你可以仅仅调用,先不解析,把调用结果输出,然后在一步步测试2014年5月22日 15:45
-
应该是服务器出错了,webservice返回的应该是xml内容,但是它却收到了html的内容,所以应该是服务器没有正确地响应你的请求。当然也有另外一种可能性,就是你的请求本身是不合法的。
2014年5月22日 11:51
-
webservice调用有webservice的规范,不管接口返回是否符合逻辑的结果,正确的都应该相应的是xml格式的内容,但是你这里是意外地都到了html的内容...找找你的调用是什么导致他响应html而不是接口对于的xml吧
2014年5月22日 11:36
相关推荐
### WebService CXF与Servlet集成详解 #### 一、项目准备与搭建 ##### 1. 创建Web Project - **项目命名**:首先,在开发环境中创建一个新的Web项目,并将其命名为`cxf_bigdata`。 ##### 2. 目录结构 - 项目的...
【CXF:构建Web服务的全面指南】 CXF(CXF: XFire Community eXtended)是一个开源的Java框架,用于构建和部署Web服务。它提供了强大的支持,包括SOAP、RESTful API、WS-*规范等多种协议和服务模型。CXF不仅简化了...
2. **CXF客户端**:`CxfClient`可能包含了服务调用的代码,CXF提供了动态代理或JAXB绑定的方式来创建客户端,调用服务端的方法。通过设置服务地址和端口,客户端可以与服务端进行同步通信。 3. **CXF与Spring集成**...
这个示例项目`CXFClient`很可能包含了上述步骤的代码实现,你可以通过阅读和分析代码来深入理解CXF和Spring如何协同工作,创建和消费Web服务。这将帮助你更好地理解和应用这两种强大工具在实际项目中的集成技巧。 ...
SpringBoot整合CXF是将流行的Java Web服务框架CXF与SpringBoot轻量级框架结合,以便更方便地创建和消费Web服务。这个项目提供了一个很好的示例,通过详细注释帮助开发者理解如何在SpringBoot应用中发布和调用Web服务...
WebService CXF是一个强大的开源框架,用于创建和消费Web服务。它允许开发者基于WSDL(Web Service Description Language)文件快速地生成服务端和客户端代码,极大地简化了Web服务的开发流程。在本篇中,我们将深入...
**创建Webservice CXF客户端的步骤如下:** **服务端项目准备:** 1. **引入Webservice库:** 首先,你需要下载Apache CXF的库。例如,你可以获取apache-cxf-2.7.6.zip,并将其解压缩。将解压后的`lib`目录中的...
使用spring集成cxf,在两个web project里发布及调用webservice server端使用spring+springmvc+mybatis+cxf,client端使用struts2+spring+hibernate+cxf 两个工程均为myeclipse project,包含所有除myeclipse自带以外...
【WebService CXF Demo基本使用】 在IT行业中,Web服务是一种重要的技术,用于系统间的数据交换和功能调用。其中,Apache CXF是一个流行的开源框架,它简化了WebService的开发、部署和使用。本教程将深入讲解如何...
10. **测试和调试**:CXF提供了多种测试工具,如CXF的WS Client和WSDL测试工具,方便开发者进行服务的本地测试和远程调用。 这个项目实例涵盖了Web服务开发的核心概念和技术,对于学习和理解如何在实际项目中使用...
你可以使用Spring的`jaxws:endpoint`或`jaxrs:server`标签来声明服务端点,`jaxws:client`或`jaxrs:client`标签来声明客户端。 3. **服务实现**:编写Web服务接口和实现类。接口通常遵循某种Web服务规范,如SOAP的...
【标题】"webservice cxf示例工程集成spring"揭示了这个项目的核心是关于Web服务(Web Service)的实现,采用Apache CXF框架,并且整合了Spring框架进行更高效的管理和控制。Apache CXF是一个开源的Java框架,它使得...
2. **CXF架构**:CXF包含多个组件,如Frontend Client API、JAX-WS、JAX-RS、Data Binding、Transport和Protocol处理等。这些组件协同工作,处理Web服务的请求、响应,以及数据的序列化和反序列化。 3. **JAX-WS...
在这个“cxf的webservice的客户端代码”主题中,我们将深入探讨如何使用CXF框架来构建一个能够与Web服务交互的客户端。 首先,创建CXF Web服务客户端的核心在于理解服务代理的生成。CXF提供了WSDL2Java工具,可以从...
`WebService_Client`是服务调用端,包含客户端配置和调用代码,用于消费服务发布端提供的接口。 这个示例项目为初学者提供了理解SpringBoot和CXF整合的起点,同时也展示了如何在实际项目中实施安全控制。通过学习和...
CXF是Apache软件基金会的一个项目,它的全称是“Client eXtended Framework”,其目标是简化Web服务的开发过程,同时提供高性能和灵活性。 这个"WebService CXF demo"是一个示例项目,用于展示如何使用CXF框架创建...
在这个案例中,"cxf_demo02_client"可能包含了客户端的代码示例。 6. **配置文件**:CXF的配置文件(如cxf.xml或spring配置文件)用于配置服务端点、数据绑定、安全设置等,是控制Web服务行为的关键。 7. **测试与...
【标题】"webservice client (springmvc +mybatis+mysql +cxf )" 是一个基于SpringMVC、MyBatis、MySQL数据库以及Apache CXF框架构建的Web服务客户端项目。这个项目整合了多种技术,用于创建能够消费Web服务的客户端...
在给定的压缩包文件中,"WebService_Server"可能包含了SpringBoot与CXF集成的服务器端代码示例,而"Webservice_Client"则可能包含CXF客户端调用服务的示例代码。这两个部分可以作为学习和实践SpringBoot发布和消费...