Webservice问题汇总


报错:
Unable to sendViaPost to url[http://192.168.11.79:9001/Service.svc]
org.apache.axis2.AxisFault: Transport error: 415 Error: Cannot process the message because the content type ‘application/soap+xml; charset=UTF-8’ was not the expected type ‘text/xml; charset=utf-8’.
at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.handleResponse(HTTPSenderImpl.java:343)
at org.apache.axis2.transport.http.impl.httpclient3.HTTPSenderImpl.sendViaPost(HTTPSenderImpl.java:213)
at org.apache.axis2.transport.http.HTTPSender.send(HTTPSender.java:121)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.writeMessageWithCommons(CommonsHTTPTransportSender.java:403)
at org.apache.axis2.transport.http.CommonsHTTPTransportSender.invoke(CommonsHTTPTransportSender.java:234)
at org.apache.axis2.engine.AxisEngine.send(AxisEngine.java:431)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:399)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:225)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:150)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:533)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:509)

解析:SOAP v1.1 uses text/xml while SOAP v1.2 uses application/soap+xml.

解决:将v1.2换成v1.1

如果是相反的报错:Cannot process the message because the content type ‘application/soap+xml; charset=UTF-8’ was not the expected type ‘text/xml; charset=utf-8’.
则将v1.1改为v1.2


报错:
由于 ContractFilter 在 EndpointDispatcher 不匹配,因此 Action 为“”的消息无法在接收方处理。这可能是由于协定不匹配(发送方和接收方 Action 不匹配)或发送方和接收方绑定/安全不匹配。请检查发送方和接收方是否具有相同的协定和绑定(包括安全要求,如 Message、Transport、None)。

解析:用的SOAP1.1,在调用服务时必须在http的请求头加上:SOAPAction的值;

解决:options.setAction(“目标的TargetNameSpace”+“调用的方法名”);


  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值