PHP-client 采用我的 WCF 服务的 WSDL。有两种方法(例如) - GetEntityTypeList() 和 GetPermissions(...)。PHP 客户端发送两个 SOAP 请求。
对于 GetEntityTypeList():
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.mywork.com/BusinessEntity" xmlns:ns2="http://www.mywork.com">
<SOAP-ENV:Header>
<ApplicationServer>
<SessionId>25872680517</SessionId>
</ApplicationServer>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:GetEntityTypeList/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
对于 GetPermissions(...):
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.mywork.com/BusinessEntity" xmlns:ns2="http://www.mywork.com">
<SOAP-ENV:Header>
<ApplicationServer>
<SessionId>25872680517</SessionId>
</ApplicationServer>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:GetPermissions>
<ns1:type>1</ns1:type>
<ns1:id>1</ns1:id>
</ns1:GetPermissions>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
然后 WCF-server 像这样捕获第一个请求:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://www.mywork.com/BusinessEntity" xmlns:ns2="http://www.mywork.com">
<SOAP-ENV:Header>
<ApplicationServer xmlns="http://www.mywork.com/">
<SessionId>25872680517</SessionId>
</ApplicationServer>
<To SOAP-ENV:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://10.128.240.23:55564/BusinessEntityServer/IEntityType</To>
<Action SOAP-ENV:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://www.mywork.com/BusinessEntity/IEntityType/GetEntityTypeList</Action>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<ns1:GetEntityTypeList />
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
如您所见,还有两个额外的块 - To和Action。第一个请求工作正常。但是第二个请求没有到达服务器。PHP-client 捕获异常:
由于 EndpointDispatcher 的 ContractFilter 不匹配,接收方无法处理带有 Action ' http://www.mywork.com/BusinessEntity/IPermissionEx/GetPermissions ' 的消息。这可能是因为合约不匹配(发送方和接收方之间的操作不匹配)或发送方和接收方之间的绑定/安全不匹配。检查发送方和接收方是否具有相同的合同和相同的绑定(包括安全要求,例如消息、传输、无)。
为什么?
如有必要,我将显示 WSDL。