我使用gSOAP实现了一个SOAP服务器,启用了WS-Discovery,由.Net客户端使用。我没有成功让客户发现服务器,我找不到任何关于如何使其工作的示例或任何文档。
测试.Net客户端在与启用了WS-Discovery的.Net服务器通信时正常工作,它可以看到Hello和Bye消息,并且它可以正常工作。相反,使用gSOAP中实现的服务器,我可以看到通过网络发送的Hello和Bye消息(使用wireshark或Microsoft消息分析器),但.Net客户端不会选择它们。消息似乎构造得很好,并且使用的WS-Discovery是相同的。
所以问题是,是否有人能够构建一个启用了WS-Discovery的gSOAP服务器,该服务器能够与.Net客户端进行通信?
gSOAP您好:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope" xmlns:SOAP-ENC="http://www.w3.org/2003/05/soap-encoding" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:chan="http://schemas.microsoft.com/ws/2005/02/duplex" xmlns:wsa5="http://www.w3.org/2005/08/addressing" xmlns:wsdd="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01">
<SOAP-ENV:Header>
<wsa5:MessageID>urn:uuid:556f5aba-e555-46d5-8000-002900004823</wsa5:MessageID>
<wsa5:To SOAP-ENV:mustUnderstand="true">urn:docs-oasis-open-org:ws-dd:ns:discovery:2009:01</wsa5:To>
<wsa5:Action SOAP-ENV:mustUnderstand="true">http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Hello</wsa5:Action>
<wsdd:AppSequence MessageNumber="1" InstanceId="0"/>
</SOAP-ENV:Header>
<SOAP-ENV:Body>
<wsdd:Hello>
<wsa5:EndpointReference>
<wsa5:Address>http://localhost:3000/WcfPing/mex</wsa5:Address>
</wsa5:EndpointReference>
<wsdd:Types>IMetadataExchange</wsdd:Types>
<wsdd:XAddrs>http://localhost:3000/WcfPing/mex</wsdd:XAddrs>
<wsdd:MetadataVersion>0</wsdd:MetadataVersion>
</wsdd:Hello>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
.Net Server Hello:
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:a="http://www.w3.org/2005/08/addressing">
<s:Header>
<a:Action s:mustUnderstand="1">http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01/Hello</a:Action>
<h:AppSequence InstanceId="1432154576" MessageNumber="2" xmlns:h="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01"/>
<a:MessageID>urn:uuid:921509b9-140a-4ff1-9601-b5c70261e798</a:MessageID>
<a:To s:mustUnderstand="1">urn:docs-oasis-open-org:ws-dd:ns:discovery:2009:01</a:To>
</s:Header>
<s:Body>
<Hello xmlns="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01">
<a:EndpointReference>
<a:Address>http://localhost:2000/WcfPing</a:Address>
</a:EndpointReference>
<d:Types xmlns:d="http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01" xmlns:dp0="http://tempuri.org/">dp0:IWcfPingTest</d:Types>
<XAddrs>http://localhost:2000/WcfPing</XAddrs>
<MetadataVersion>0</MetadataVersion>
</Hello>
</s:Body>
</s:Envelope>