如何配置soap lite客户端以通过wshttpbinding使用WCF服务?
我有一个使用 wcf 服务的soap lite 客户端。我在 basichttpbinding 上测试了所有内容,它工作正常。当我将绑定切换到 wshttpbinding:
<endpoint binding="wsHttpBinding" bindingConfiguration="customWsBinding"
contract="LogisticServiceLibrary.ILogisticService" />
并将soap lite 版本更改为使用 1.2:
$client = SOAP::Lite
->proxy($endpoint)
->soapversion('1.2');
时,它会给出一个错误,下面是 SOAPUI 的输出:
2011 年 11 月 30 日星期三 18:36:14 美国东部时间:调试:>> “邮政/物流服务
HTTP/1.1[\r][\n]" 2011 年 11 月 30 日星期三 18:36:14 EST 2011:DEBUG:>> "TE:
deflate,gzip;q=0.3[\r][\n]" 2011 年 11 月 30 日星期三 18:36:14 EST 2011:DEBUG:>>
“连接:TE,关闭[\r][\n]” 2011 年 11 月 30 日星期三 18:36:14 EST 2011:调试:>>
“接受:text/xml[\r][\n]” 2011 年 11 月 30 日星期三 18:36:14 EST 2011:调试:>>
“接受:multipart/*[\r][\n]” 11 月 30 日星期三 18:36:14 EST 2011:DEBUG:>>
“接受:application/soap[\r][\n]” 美国东部时间 11 月 30 日星期三 18:36:14
2011:调试:>> “用户代理:SOAP::Lite/Perl/0.712[\r][\n]”11 月 30 日星期三
2011 年东部时间 18:36:14:调试:>> “内容长度:49496[\r][\n]”11 月 30 日星期三
2011 年东部时间 18:36:14:调试:>> “内容类型:application/soap+xml;
charset=utf-8[\r][\n]" 2011 年 11 月 30 日星期三 18:36:14 EST 2011:DEBUG:>>
“SOAPAction:http://tempuri.org/ILogisticService/IssueOrder[\r][\n]”
2011 年 11 月 30 日星期三 18:36:14 美国东部时间:调试:>> “主机:本地主机:8008[\r][\n]”
2011 年 11 月 30 日星期三 18:36:14 美国东部时间:调试:>> “[\r][\n]” 11 月 30 日星期三 18:36:14
EST 2011:调试:>> ” xmlns:namesp1="http://namespaces.soaplite.com/perl"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
肥皂:encodingStyle =“http://schemas.xmlsoap.org/soap/encoding/”
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"> xmlns="http://tempuri.org/"> xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns=""
xmlns:a="http://schemas.datacontract.org/2004/07/LogisticServiceLibrary"
2011 年 11 月 30 日星期三 18:36:14 美国东部时间:调试:<< “HTTP/1.1 400 错误
请求[\r][\n]" 11 月 30 日星期三 18:36:14 EST 2011:DEBUG:<< "HTTP/1.1 400
错误请求[\r][\n]" 2011 年 11 月 30 日星期三 18:36:14 EST 2011:DEBUG:<<
“内容长度:0[\r][\n]” 2011 年 11 月 30 日星期三 18:36:14 EST 2011:DEBUG:<<
“服务器:Microsoft-HTTPAPI/1.0[\r][\n]” 美国东部时间 11 月 30 日星期三 18:36:14
2011:调试:<< “日期:2011 年 11 月 30 日星期三 23:36:14 GMT[\r][\n]”11 月 30 日星期三
18:36:14 EST 2011:调试:<< “[\r][\n]”
显示 400 Bad Request...知道发生了什么吗?
I have a soap lite client consuming a wcf service. I tested everything on basichttpbinding and it works fine. When I switch the binding to wshttpbinding:
<endpoint binding="wsHttpBinding" bindingConfiguration="customWsBinding"
contract="LogisticServiceLibrary.ILogisticService" />
and changed the soap lite version to use 1.2:
$client = SOAP::Lite
->proxy($endpoint)
->soapversion('1.2');
then it gives me an error and below is the output from SOAPUI:
Wed Nov 30 18:36:14 EST 2011:DEBUG:>> "POST /LogisticService
HTTP/1.1[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:>> "TE:
deflate,gzip;q=0.3[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:>>
"Connection: TE, close[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:>>
"Accept: text/xml[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:>>
"Accept: multipart/*[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:>>
"Accept: application/soap[\r][\n]" Wed Nov 30 18:36:14 EST
2011:DEBUG:>> "User-Agent: SOAP::Lite/Perl/0.712[\r][\n]" Wed Nov 30
18:36:14 EST 2011:DEBUG:>> "Content-Length: 49496[\r][\n]" Wed Nov 30
18:36:14 EST 2011:DEBUG:>> "Content-Type: application/soap+xml;
charset=utf-8[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:>>
"SOAPAction: http://tempuri.org/ILogisticService/IssueOrder[\r][\n]"
Wed Nov 30 18:36:14 EST 2011:DEBUG:>> "Host: localhost:8008[\r][\n]"
Wed Nov 30 18:36:14 EST 2011:DEBUG:>> "[\r][\n]" Wed Nov 30 18:36:14
EST 2011:DEBUG:>> "
xmlns:namesp1="http://namespaces.soaplite.com/perl"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
xmlns="http://tempuri.org/">
xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns=""
xmlns:a="http://schemas.datacontract.org/2004/07/LogisticServiceLibrary"
Wed Nov 30 18:36:14 EST 2011:DEBUG:<< "HTTP/1.1 400 Bad
Request[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:<< "HTTP/1.1 400
Bad Request[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:<<
"Content-Length: 0[\r][\n]" Wed Nov 30 18:36:14 EST 2011:DEBUG:<<
"Server: Microsoft-HTTPAPI/1.0[\r][\n]" Wed Nov 30 18:36:14 EST
2011:DEBUG:<< "Date: Wed, 30 Nov 2011 23:36:14 GMT[\r][\n]" Wed Nov 30
18:36:14 EST 2011:DEBUG:<< "[\r][\n]"
It says 400 Bad Request... Any idea what's going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 WSHttpBinding 要求客户端使用 SOAP 1.2,并且还了解 ws-addressing、ws-reliablemessaging、ws-security、ws-policy 和 ws-policyassertion。我怀疑 SOAP::Lite 是否理解其中的任何内容,因此使用“Lite”命名法。
BasicHttpBinding
非常基本,就像 SOAP::Lite :)Using
WSHttpBinding
requires that the client speak SOAP 1.2 and also understand ws-addressing, ws-reliablemessaging, ws-security, ws-policy and ws-policyassertion. I doubt SOAP::Lite understands any of that, hence the "Lite" nomenclature.BasicHttpBinding
is pretty basic, just like SOAP::Lite :)