.net 调用 cxf接口报错,求大神帮忙参考下,100分求助

苦逼de小Coder 2014-08-04 10:13:44
我在服务引用中添加了接口,然后调用接口中的方法,报错如下
用户代码未处理 System.ServiceModel.ProtocolException
HResult=-2146233087
Message=响应消息的内容类型 multipart/related; type="application/xop+xml"; boundary="----=_Part_0_4315167.1407191370328"; start="<root.message@cxf.apache.org>"; start-info="text/xml" 与绑定(text/xml; charset=utf-8)的内容类型不匹配。如果使用自定义编码器,请确保正确实现 IsContentTypeSupported 方法。响应的前 627 个字节为:“
------=_Part_0_4315167.1407191370328
Content-Type: application/xop+xml; charset=UTF-8; type="text/xml";
Content-Transfer-Encoding: binary
Content-ID: <root.message@cxf.apache.org>

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><ns1:GetCkxxResponse xmlns:ns1="http://server.webservice.yuyue.dongcheng.asop.com/"><return>2014年08月05日,已预约到 09:24:00,已预约到 13:12:00,1,1,星期二</return><return>2014年08月06日,已预约到 09:06:00,已预约到 13:00:00,1,1,星期三</return></ns1:GetCkxxResponse></soap:Body></soap:Envelope>
------=_Part_0_4315167.1407191370328--”。
Source=mscorlib
StackTrace:
Server stack trace:
在 System.ServiceModel.Channels.HttpChannelUtilities.ValidateRequestReplyResponse(HttpWebRequest request, HttpWebResponse response, HttpChannelFactory`1 factory, WebException responseException, ChannelBinding channelBinding)
在 System.ServiceModel.Channels.HttpChannelFactory`1.HttpRequestChannel.HttpChannelRequest.WaitForReply(TimeSpan timeout)
在 System.ServiceModel.Channels.RequestChannel.Request(Message message, TimeSpan timeout)
在 System.ServiceModel.Dispatcher.RequestChannelBinder.Request(Message message, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)
在 System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)
在 System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)
Exception rethrown at [0]:
在 System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)
在 System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)
在 Handler.SocialServiceReference.WebReviewService.GetCkxx(GetCkxx request)
在 Handler.SocialServiceReference.WebReviewServiceClient.Handler.SocialServiceReference.WebReviewService.GetCkxx(GetCkxx request) 位置 E:\xxx
在 Handler.SocialServiceReference.WebReviewServiceClient.GetCkxx(Int64 arg0, Int64 arg1) 位置 E:\xxx
在 Handler.test.HelloWorld() 位置 E:\xxx
...全文
478 16 打赏 收藏 转发到动态 举报
写回复
用AI写文章
16 条回复
切换为时间正序
请发表友善的回复…
发表回复
ClueeZhuo 2014-09-19
  • 打赏
  • 举报
回复
我也遇到了类似的问题。怎么解决的?
苦逼de小Coder 2014-08-07
  • 打赏
  • 举报
回复
为什么没人啊,没人碰到过这种问题吗?
苦逼de小Coder 2014-08-06
  • 打赏
  • 举报
回复
求关注啊。问题还是没有解决
苦逼de小Coder 2014-08-05
  • 打赏
  • 举报
回复
还是没人能帮上忙吗?
苦逼de小Coder 2014-08-04
  • 打赏
  • 举报
回复
<?xml version="1.0" encoding="UTF-8" ?>
苦逼de小Coder 2014-08-04
  • 打赏
  • 举报
回复
引用 9 楼 sunny906 的回复:
1、text/xml与绑定text/xml; charset=utf-8的内容类型不匹配,看看webservice返回的content-type是什么 2、客户端是不是两多个配置文件 3、看看这篇博文http://www.cnblogs.com/jams742003/archive/2008/10/30/1322761.html
1、content-type 是 字符串数组 2、客户端不是多个配置文件 3、方法试过了,还是一样的错误
sunny906 2014-08-04
  • 打赏
  • 举报
回复
1、text/xml与绑定text/xml; charset=utf-8的内容类型不匹配,看看webservice返回的content-type是什么 2、客户端是不是两多个配置文件 3、看看这篇博文http://www.cnblogs.com/jams742003/archive/2008/10/30/1322761.html
苦逼de小Coder 2014-08-04
  • 打赏
  • 举报
回复
引用 6 楼 sunny906 的回复:
服务端的问题,你在服务端的方法里加上try..catch捕获异常,或者把异常写到日志里面,然后看看是什么问题
cxf接口服务器那边我伸不上手,那边是老接口,不允许动的
苦逼de小Coder 2014-08-04
  • 打赏
  • 举报
回复
引用 6 楼 sunny906 的回复:
服务端的问题,你在服务端的方法里加上try..catch捕获异常,或者把异常写到日志里面,然后看看是什么问题
首层就是我捕获的异常说明啊。
sunny906 2014-08-04
  • 打赏
  • 举报
回复
服务端的问题,你在服务端的方法里加上try..catch捕获异常,或者把异常写到日志里面,然后看看是什么问题
苦逼de小Coder 2014-08-04
  • 打赏
  • 举报
回复
引用 4 楼 sunny906 的回复:
用java写个客户端看能不能正常调用HelloWorld()
HelloWorld 是我用.net写的调用接口,我是用我写的这个接口调用cxf的接口 cxf这个接口,我让开发者那边测试了,他们用Java调用没有问题
sunny906 2014-08-04
  • 打赏
  • 举报
回复
用java写个客户端看能不能正常调用HelloWorld()
苦逼de小Coder 2014-08-04
  • 打赏
  • 举报
回复
引用 2 楼 sunny906 的回复:
添加服务引用的时候,webservice的地址能不能正常打开,里面的方法能不能正确显示,或java的客户端能不能正常调用HelloWorld()
添加服务引用的时候里面的方法可以正确显示
sunny906 2014-08-04
  • 打赏
  • 举报
回复
添加服务引用的时候,webservice的地址能不能正常打开,里面的方法能不能正确显示,或java的客户端能不能正常调用HelloWorld()
苦逼de小Coder 2014-08-04
  • 打赏
  • 举报
回复
不要沉啊。麻烦来大神解救下我吧

12,162

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 Web Services
社区管理员
  • Web Services社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧