且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

通过Java客户端连接到WCF服务

更新时间:2022-10-25 10:59:34

您可以使用Java消耗Web服务有不同框架,以使您的工作更容易,如 AXIS 并的阿帕奇CXF



请看下面就同一


$ b文章更多的指针$ b

消费与Java 服务p>

I have WCF service which has 2 endpoints: wsHttpBinding and basicHttpBinding. I can connect to each endpoint via C# client.

My Wcf Service configuration

  <service behaviorConfiguration="App.ServiceBehavior"
          name="MyService">
        <endpoint address="/ws" binding="wsHttpBinding" bindingConfiguration="httpBindingForWs"
           contract="Namespace.IMyService">
          <identity>
            <dns value="127.0.0.1" />
          </identity>
        </endpoint>
        <endpoint address="/basic" binding="basicHttpBinding" bindingConfiguration="httpBindingForBasic"
            contract="Namespace.IMyService">
          <identity>
            <dns value="127.0.0.1" />
          </identity>
        </endpoint>
        <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
        <host>
          <baseAddresses>
            <add baseAddress="http://127.0.0.1:12000/MyService" />
          </baseAddresses>
        </host>
      </service>

I can generate wsdl in Java. Can you show me sample code, how can I consume basicHttpBinding in Java?

you can consume the webservice using Java there are different frameworks to make your job easier, like AXIS and Apache CXF

Look at following article for more pointers on same

Consuming WCF services with Java