Consume .NET web-service in Java

Please support our C# advertiser: Intel Parallel Studio Home
Reply

Join Date: Jan 2009
Posts: 2
Reputation: pranava is an unknown quantity at this point 
Solved Threads: 0
pranava pranava is offline Offline
Newbie Poster

Consume .NET web-service in Java

 
0
  #1
Mar 5th, 2009
Make the necessary changes to the web-service project in the web.config file to make it accessible to the HTTP GET & POST calls.

This is a simple Java program illustrating how you can consume the .NET web-service in Java program.

import java.io.*;
import java.net.*;

public class WebService
{
public static void main(String[] args) throws Exception
{
URL webserviceURL = new URL(”http://localhost/MyServices/WebServi.../Service1″);
URLConnection webserviceConnection = webserviceURL.openConnection();
BufferedReader in = new BufferedReader(new InputStreamReader(webserviceConnection.getInputStream()));
String inputLine;

while ((inputLine = in.readLine()) != null)
System.out.println(inputLine);
in.close();
}

}

In response your get the proper XML data. So, now you need to parse the XML so as to get the essential data from it. As you can see that consuming your .NET web-service in Java is not a tricky thing
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC