0

I have implemented a SOAP server using gSOAP with WS-Discovery enabled that is used by a .Net client. I have not been successful in having the client to discover the server, nowhere I've found any example or any documentation on how to make it work.

The test .Net client works properly when communicating with a .Net server with WS-Discovery enabled, it can see both Hello and Bye messages and it works just fine. Instead with the server implemented in gSOAP I can see the Hello and Bye messages being sent through the network (using wireshark or Microsoft message analyser) but the .Net client does not pick them. The messages seem well constructed and the WS-Discovery being used is the same.

So the question is, has anyone been able to build a gSOAP server with WS-Discovery enabled that is able to communicate with a .Net client?

gSOAP Hello:

<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>
Pedro
  • 451
  • 4
  • 5
  • I've added the full SOAP message being sent. The namespaces seem correct, unless I'm missing something. – Pedro May 20 '15 at 19:56
  • It seems the ws-addressing information sent with your gSOAP code is wrong, http://docs.oasis-open.org/ws-dd/discovery/1.1/os/wsdd-discovery-1.1-spec-os.html chapter 4.1 specify that `/s:Envelope/s:Header/a:To` should be `urn:docs-oasis-open-org:ws-dd:ns:discovery:2009:01`. Did you use `SOAP_WSDD_ADHOC` mode calling `soap_wsdd_Hello` ? – mpromonet May 20 '15 at 20:20
  • @mpromonet after your comment I went to check why was it wrong the To element and verified that gsoap seemed to have a bug. It has been fixed in the latest version. I updated to the latest version and ran my code to produce the hello message. I've updated the post above, there's no more scopes which I wasn't using anyway. The messages now look the same and I still do not get a .Net client to see the hello message. – Pedro Jun 03 '15 at 20:04

0 Answers0