xmdlkz
xmdlkz
2015-06-15 15:42

httpClient 调用wcf服务 contract binding不一致

  • 请求
  • wcf
  • httpclient

用axis掉用没问题,用http调用就有问题,求大牛帮忙解决一下。
报的异常如下:
The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
最好能告诉我愿意,还有能否只改客户端就实现用httpClient调用。
后台看来一下,请消息体是一样的,请求头不一样。
附上axis的请求:

POST /BankService.svc HTTP/1.0
Content-Type: text/xml; charset=utf-8
Accept: application/soap+xml, application/dime, multipart/related, text/*
User-Agent: Axis/1.4
Host: 42.8.96.156:8080
Cache-Control: no-cache
Pragma: no-cache
SOAPAction: "http://tempuri.org/IBankService/AddRecharge"
Content-Length: 758

<?xml version="1.0" encoding="UTF-8"?>

soapenv:Body



2

0

0

2015-06-15T01:09:24.984Z

0

1



2cdc7243bddce98d461f29f97de460f83ec282516c34733a2c9a2b0296239a8b

/soapenv:Body
/soapenv:Envelope

httpClient 请求:
POST /BankService.svc HTTP/1.1
Connection: close
User-Agent: Jakarta Commons-HttpClient/3.1
Host: 42.8.96.156:8080
Transfer-Encoding: chunked
Content-Type: text/xml; charset=utf-8

2f6
<?xml version="1.0" encoding="UTF-8"?>

soapenv:Body



2

0

0

2015-06-15T01:09:24.984Z

0

1




2cdc7243bddce98d461f29f97de460f83ec282516c34733a2c9a2b0296239a8b


/soapenv:Body
/soapenv:Envelope

异常详细情况:



a:ActionNotSupported

The message with Action '' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).

/s:Fault
/s:Body
/s:Envelope

  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

0条回答