none
WCF that conforms to WS-I Basic Standard, with security but over HTTP RRS feed

  • Question

  • I have created a webservice-emulator and client from a WSDL & XSDs that a client has given me.

    It needs to confirm to "WS-I Basic Standard" so the soap header is like this:

    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
                <soap:Header>
                            <Action xmlns="http://www.w3.org/2005/08/addressing">http://ClientSpecificURL</Action>
                            <MessageID xmlns="http://www.w3.org/2005/08/addressing">urn:uuid: A GUID </MessageID>
                            <To xmlns="http://www.w3.org/2005/08/addressing">http://ClientSpecificURL</To>
                            <ReplyTo xmlns="http://www.w3.org/2005/08/addressing">
                                        <Address>http://www.w3.org/2005/08/addressing/anonymous</Address>
                            </ReplyTo>
                            <wsse:Security xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext">
                                        <wsse:UsernameToken xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext">
                                                    <wsse:Username xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext">USERNAME</wsse:Username>
                                                    <wsse:Password xmlns:wsse="http://schemas.xmlsoap.org/ws/2003/06/secext">USERNAME,DATE,CLIENT_PROVIDED_SECRET_KEY</wsse:Password>
                                        </wsse:UsernameToken>
                            </wsse:Security>
                </soap:Header>
    The namespace in the WSDL for the soap messages is:
    xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"

    This is relavant config if it's useful:

      <system.serviceModel>
          <bindings>
              <basicHttpBinding>
                <binding name="BasicHttpBinding_GCGatewayPortType" >
                  <security mode="TransportWithMessageCredential">
                    <message clientCredentialType="UserName" />
                  </security>
                </binding>             
              </basicHttpBinding>
          </bindings>
          <client>
              <endpoint address="http://localhost/Emulator.svc"
                  binding="basicHttpBinding" contract="Namespace.Service"   />
    
          </client>
    
        <diagnostics>
          <messageLogging logEntireMessage="true"
                                      logMalformedMessages="true"
                                      logMessagesAtServiceLevel="true"
                                      logMessagesAtTransportLevel="true"
                                      maxMessagesToLog="500"/>
        </diagnostics>
      </system.serviceModel>

    Does anyone have a definitive answer?


    • Edited by Mr_dominic Thursday, October 6, 2016 1:22 PM mentione dlinks which have been removed
    Thursday, October 6, 2016 1:21 PM

Answers

  • You are probably missing the WS -Address headers. So try using wsHttpBinding binding instead

    <system.serviceModel>
          <bindings>
              <wsHttpBinding>
                <binding >
                  <security mode="TransportWithMessageCredential">
                    <message clientCredentialType="UserName" />
                  </security>
                </binding>             
              </wsHttpBinding>
          </bindings>
          <client>
              <endpoint address="http://localhost/Emulator.svc"
                  binding="wsHttpBinding" contract="Namespace.Service"   />
    
          </client>
    
        <diagnostics>
          <messageLogging logEntireMessage="true"
                                      logMalformedMessages="true"
                                      logMessagesAtServiceLevel="true"
                                      logMessagesAtTransportLevel="true"
                                      maxMessagesToLog="500"/>
        </diagnostics>
      </system.serviceModel>
    Also, posting the actual soap headers will be useful for fine tuning the config settings further, if this doesn't work. Also auto generating the proxy by adding service reference using the wsdl for the emulator, if one exists,  will create the appropriate bindings automatically for you.




    Thursday, October 6, 2016 10:50 PM