java2db

How to call C# .Net WCF web service in java SOAP client ( Visual Studio 2013 )



WCF (Windows Communication Foundation ) tool is  used to implement and deploy a service-oriented architecture (SOA) . It uses WSDL to communicate with the WCF client over SOAP. In this article , we explained step by step process to call C# .Net WCF web service in java SOAP client.

 

call C# .Net WCF web service in java SOAP client  Steps to create  C# .Net WCF web service :

call C# .Net WCF web service in java SOAP client  Step 1 :

Create a C# .Net  project in visual studio  . For that , go to File -> New -> Project.

call C# .Net WCF web service in java SOAP client  If you want , you can create a Web Site .

 

 

call C# .Net WCF web service in java SOAP client

 

 

 Step 2 :

Select WCF sub menu from the Visual C# ( left side ). Select WCF Service Application from the right side. Give any name for your project . In our example, the name is FirstWCFServiceExe .

call C# .Net WCF web service in java SOAP client

So, the project will creare in the Solution Explorer .

 

 

 Step 3 :

Add a new Item to the project like below (Right click on the project , select Add -> New Item).

call C# .Net WCF web service in java SOAP client
 Step 4 :

From the New Item window , select Web -> WCF Service . Give any name to the service .
call C# .Net WCF web service in java SOAP client

 

 

 

 Step 5 :

So  the New Item added to the project.

call C# .Net WCF web service in java SOAP client

 

 

 Step 6 :

Copy the below code to FirstService.svc.cs and IFirstService.cs  files .

FirstService.svc.cs

 

IFirstService.cs

 

 

 

 Step 7 :

Build the project  (Ctrl+F7) .

 

 

 Step 8 :

After successful build , the below window will appear . Copy the below URL .
call C# .Net WCF web service in java SOAP client

 

 

 Step 9 :

Add ?wsdl to the URL  http://localhost:49179/FirstService.svc

Now the full URL is http://localhost:49179/FirstService.svc?wsdl .
Paste the URL in the web browser . Finally , you will get the WSDL file.

 
call C# .Net WCF web service in java SOAP client
So, we have the WSDL file URL to call C# .Net WCF web service in java SOAP client.

 

 

 

 Steps to call C# .Net WCF web service in java SOAP client :

 Step 1 :

Create a Java Web or Stand alone project in Eclipse or NetBeans Ide .

 

 

 Step 2 :

The SOAP client file creation we explained  here (using metro) in detail. Or use File -> New -> Other -> Web ervices -> Web Service Client . Pass the WSDL URL  and click finish.

You will get the org.tempuri client folder with auto generated java files .

 

 

 

 Step 3 :

Create a separate package (Ex :javaClientForCotNetWCFService ) . In that package create a java class (In our example it is JavaClient.java).

 

 

 Step 4 :

Copy the below code to JavaClient.java file.

 

 

 Step 5 :

Run the java file as a stand alone java application . Finally, we will get the below output .

 

So , successfully we did call C# .Net WCF web service in java SOAP client.




Related Posts :
How to Connect to Oracle from Liferay portlet ( Java Liferay and Oracle integration )
How to Connect Liferay 7 to PostgreSQL ( Java Liferay portlet and PostgreSQL integration )
How to call PHP RESTful web service in java client
How to call java SOAP web service in php ( php web service client )
Solution to SSLHandshakeException (skip the certificate for Java and LDAP bind)
Java RESTful web service example in maven using JAX-RS
RESTful web service example in java using JAX-RS
Create a java web service from WSDL (Top down approach) in Eclipse
   [will not be published]



^ <