简体   繁体   中英

Should I use basicHttpBinding or WsHttpBinding for creating a secure Java Client?

I've spent hours today trying to get a very simple WCF Service and a Java Client to communicate with each other. I've only been successful on getting the Service and Client to communicate using a basicHttpBinding with no security enabled.

I would like to have the contents encrypted over the wire. I've tried using the basicHttpBinding config of this:

  <basicHttpBinding>
    <binding name="bindingConfig">
      <security mode="Transport">
        <transport clientCredentialType="Windows" />
      </security>
    </binding>
  </basicHttpBinding>

This now pretty much causes tons of problems because when my service is hosted on IIS I get certificate errors when trying to test the WCF service locally (VS2012 using WCF Test Client), browsing to the WSDL with any browser, and when using Svcutil/wsimport utilities to generate clients.

What I don't understand is when I was using WsHttpBinding and using Transport/Windows security I never had certificate issues, why is that?

What is the easiest way for me to implement what I am after anyone have thoughts?

WCF and Java compatibility is a little bit complicated.

First of all, which framework do you use in Java ?

Secondly, on the WCF side, you should better use a custom binding instead of a wsHttpBinding. You can easily convert your binding using this tool . With your binding it will give :

<customBinding>
  <binding name="NewBinding0">
    <textMessageEncoding MessageVersion="Soap11" />
    <httpsTransport authenticationScheme="Negotiate" />
  </binding>
</customBinding>

Now you just have to configure the Java side or adapt the WCF configuration, to enable SOAP12, instead of SOAP11. Let me know if it works.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM