BalaKrishnan웃
BalaKrishnan웃

Reputation: 4557

WCF service In JAVA

I already created WPF(C#) apps

1) Server 2) Client

both has it's own TCP endpoints

Server Contract

public interface IServer
{
    //Client calls this to register it self in server.
    [OperationContract]
    void RegisterClient(string hostName, string domainName);
    //To submit the resut back to server.
    [OperationContract]
    void SubmitResult(Result result);            
    //heart beat check, to check the client is alive.
    bool ConnectionTest();
}

Client Contract

interface IClient
{
    //Heart beat check, to check the server is alive.
    [OperationContract()]
    bool IsAvailable();        
    [OperationContract()]
    void dosomething(string projects);
}

Both the server and client are working fine. This there is any way i can create a Client app in java with above client Contract which will interact with WPF(C#) server?

I think java supports tcp and SOAP, is there is any WCF Equivalent framework in JAVA(a console app)?

i am new to java i don't know where to begin with.

Upvotes: 2

Views: 607

Answers (1)

Emmanuel DURIN
Emmanuel DURIN

Reputation: 4913

Binding choice

NetTcpBinding is a binary Microsoft technology.

In order to call the Net service with Java, you should favour:

  • basicHttpBinding (SOAP 1.1)
  • wsHttpBinding (SOAP 1.2)

Metadata

Don't forget to expose Metadata Exchange in order for your WSDL to be called

Metadata Endpoint :

<services>
  <service name="BillingService.BillingService">
    <endpoint address="mex" binding="mexHttpBinding" contract="IMetadataExchange" />
    ...
</service>

Metadata Behavior :

<serviceBehaviors>
  <behavior>
    <serviceMetadata httpGetEnabled="True" httpsGetEnabled="True"/>
      ...
  </behavior>
</serviceBehaviors>

Generation of the proxy in java :

Then use wsimport.exe from %JavaRoot%\bin

C:\Program Files\Java\jdk1.8.0_25\bin>wsimport.exe -s e:\temp\javaws http://localhost:8733/Design_Time_Addresses/BillingService/?wsdl

Regards

Upvotes: 1

Related Questions