3

I've generated a WCF client service proxy from a WSDL file, which calls a third-party java web service. Now I need to configure the binding and proxy to call a web method.

However, I only have the below SOAP information, a username and password, and a client certificate. How can I work out what I need to do?

Are there any "reverse this to configuration" apps, or websites that teach the skills required?

I think I am after, "this part of the message, translates to this configuration". Can anyone help?

For the same project, I asked this question, so if anyone knows what to ask the third party for, that would also be of help (I'd describe this as "communication information", but I don't think that specific enough).

    <env:Envelope xmlns:env=http://schemas.xmlsoap.org/soap/envelope/xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:ns0="http://etis.ford.com/services/fsa/1.0" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <env:Header>
        <wsse:Security xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd" env:mustUnderstand="1">
        <wsse:BinarySecurityToken EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-messagesecurity-1.0#Base64Binary" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3" wsu:Id="token-2-1172677451503-9243153">MIICDTCC……..k/j8lARlQ==</wsse:BinarySecurityToken>
        <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#">
        <ds:SignedInfo>
        <ds:CanonicalizationMethod Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
        <ds:SignatureMethod Algorithm="http://www.w3.org/2000/09/xmldsig#rsa-sha1"/>
        <ds:Reference URI="#element-1-1172677451465-2619907">
        <ds:Transforms>
            <ds:Transform Algorithm="http://www.w3.org/2001/10/xml-exc-c14n#"/>
        </ds:Transforms>
        <ds:DigestMethod Algorithm="http://www.w3.org/2000/09/xmldsig#sha1"/>
        <ds:DigestValue>k_REDACTED_=</ds:DigestValue>
        </ds:Reference>
        </ds:SignedInfo>
        <ds:SignatureValue>k_REDACTED_=</ds:SignatureValue>
        <ds:KeyInfo>
        <wsse:SecurityTokenReference wsu:Id="reference-3-1172…..1504-94…25">
        <wsse:Reference URI="#token-2-117…..51503-9…3" ValueType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-x509-token-profile-1.0#X509v3"/></wsse:SecurityTokenReference>
        </ds:KeyInfo>
        </ds:Signature>
        </wsse:Security>
    </env:Header>
    <env:Body xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"wsu:Id="element-1-1172677451465-2619907">
        <ns0:list>
            <String_1>k_REDACTED_</String_1>
        </ns0:list>
    </env:Body>
    </env:Envelope>

The following was generated to my app.config. It doesn't have an exception, but the response I get (in correctly formed XML) contains objects with "nothing" - the actual response looks like a mirror of what I sent.

<bindings>
    <basicHttpBinding>
        <binding name="MyBinding" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00" allowCookies="false"
            bypassProxyOnLocal="false" hostNameComparisonMode="StrongWildcard"
            maxBufferSize="65536" maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" transferMode="Buffered"
            useDefaultWebProxy="true">
            <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
                maxBytesPerRead="4096" maxNameTableCharCount="16384" />
            <security mode="None">
                <transport clientCredentialType="None" proxyCredentialType="None"
                    realm="" />
                <message clientCredentialType="UserName" algorithmSuite="Default" />
            </security>
        </binding>
    </basicHttpBinding>
</bindings>
<client>
    <endpoint address="http://myurl"
        binding="basicHttpBinding" bindingConfiguration="MyBinding"
        contract="wsServiceProxy.ServiceName" name="MyServicePort" />
</client>

Request:

POST http://www.thehost.com/
Content-Type: text/xml; charset=utf-8
VsDebuggerCausalityData: uIDPo2dteAUjcNNDmQ28Qhsz8KcAAAAARUELWtvXc06cOf2eOs23AWKlzgCLFBNImUOop7Ho+PoACQAA
SOAPAction: ""
Host: www.thehost.com
Content-Length: 299
Expect: 100-continue
Connection: Keep-Alive

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
    <s:Body xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
        <list xmlns="http://thehost.com">
            <String_1 xmlns="">MyString</String_1>
        </list>
    </s:Body>
</s:Envelope>

Response:

HTTP/1.1 200 OK
Date: Thu, 24 Oct 2013 14:17:20 GMT
Server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/1.0.0a mod_jk/1.2.31
X-Powered-By: Servlet 2.5; JBoss-5.0/JBossWeb-2.1
VsDebuggerCausalityData: uIDPo2dteAUjcNNDmQ28Qhsz8KcAAAAARUELWtvXc06cOf2eOs23AWKlzgCLFBNImUOop7Ho+PoACQAA
SOAPAction: ""
host: www.thehost.com
Expect: 100-continue
connection: Keep-Alive, Keep-Alive
Content-Length: 299
Keep-Alive: timeout=2, max=100
Content-Type: text/xml;charset=utf-8

<s:Envelope xmlns:s='http://schemas.xmlsoap.org/soap/envelope/'>
    <s:Body xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
        <list xmlns='http://thehost.com'>
            <String_1 xmlns=''>MyString</String_1>
        </list>
    </s:Body>
</s:Envelope>
Community
  • 1
  • 1
Mr Shoubs
  • 14,629
  • 17
  • 68
  • 107
  • 1
    How did you create the proxy? I'm surprised that creating the proxy did not also create the binding configuration. – John Saunders Oct 24 '13 at 11:26
  • I was given a WSDL file that I added as a service reference – Mr Shoubs Oct 24 '13 at 13:44
  • I've pasted it, but I don't think it is working correctly as the response is a mirror of what I sent. This seems to serialise to an instantiated object (different to the one in the response) that has no properties set. – Mr Shoubs Oct 24 '13 at 14:24
  • 1
    I expect you would have received a 400 or 500 response if there had been a serious problem with the request. Check with the service author to see what the issue is - I don't think there's a binding issue. – John Saunders Oct 24 '13 at 14:58
  • I will, but that is easier said than done with these big companies and the amount of bureaucracy involved. Going back to the question - how can I tell if this binding is correct for the SOAP I have? – Mr Shoubs Oct 24 '13 at 17:07
  • I think the fact that you got a 200 response implies that the binding is correct. – John Saunders Oct 24 '13 at 18:40
  • I guess I will find out when I have an answer to my other question :) – Mr Shoubs Oct 25 '13 at 12:13
  • What you posted is not a WSDL - at least not any WSDL I'm familiar with. It looks like the schema for the message. Second, the format of that schema is SOAP 1.1, so BasicHttpBinding **is** the correct one. I agree with @JohnSaunders - check with the vendor. I know the big ones can be a pain, but there are any number of things that could be the issue and it could very well be on their end. – Tim Oct 25 '13 at 15:34
  • The answer to your original question is of course NO. You are asking if you can determine the transport used to transmit the content of an envelop. – Aron Oct 27 '13 at 16:13
  • @Tim, correct, that isn't the WSDL. This is the message - but I can't test the binding until I sort out my other question first. – Mr Shoubs Oct 28 '13 at 09:39
  • I finally got to the bottom of this (through much guess work): see http://stackoverflow.com/q/20399257/198048 and http://stackoverflow.com/q/20349062/198048 – Mr Shoubs Dec 05 '13 at 17:28

1 Answers1

2

Use this custom binding:

<customBinding>
        <binding name="NewBinding0">
            <textMessageEncoding messageVersion="Soap11" />
            <security authenticationMode="MutualCertificate" includeTimestamp="false"
                messageSecurityVersion="WSSecurity10WSTrustFebruary2005WSSecureConversationFebruary2005WSSecurityPolicy11BasicSecurityProfile10">
                <secureConversationBootstrap />
            </security>
            <httpTransport />
        </binding>
</customBinding>

make sure to decorate your contract to sign only:

[System.ServiceModel.ServiceContractAttribute(ConfigurationName=..., ProtectionLevel=System.Net.Security.ProtectionLevel.Sign)]

you will need to configure a service certificate in addition to a client certificate. You (probably) don't have such certificate which is ok, just configure any dummy certificate there (even same one as client).

See this link for more possible error resolution with this scenario.

Yaron Naveh
  • 23,560
  • 32
  • 103
  • 158
  • I've used certificates before without an issue, we have our own too. If you have a look at my other question (http://stackoverflow.com/q/19431827/198048) you will see the third party doesn't give me a lot to go on. I can't test this until I have that problem solved. – Mr Shoubs Oct 28 '13 at 09:53
  • 1
    reference.cs. this is the file of the proxy reference. http://webservices20.blogspot.co.il/2008/10/who-moved-my-service-reference.html – Yaron Naveh Nov 29 '13 at 17:27