| | |
Consume .NET web-service in Java
Please support our C# advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Jan 2009
Posts: 2
Reputation:
Solved Threads: 0
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
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
![]() |
Similar Threads
- Java web service (Java)
- Trying to consume Coldfusion Web Service using VB.NET (ASP.NET)
- Trying to consume Coldfusion Web Service using VB.NET (VB.NET)
- ASP .NET web apps/service in VS.NET won't let me name the project? (ASP.NET)
Other Threads in the C# Forum
- Previous Thread: how to change WinForm controls' text color programatically?
- Next Thread: C# POP3 Server
| Thread Tools | Search this Thread |
.net access algorithm array asp barchart bitmap box broadcast buttons c# check checkbox client column combobox control conversion csharp custom database datagrid datagridview dataset datetime degrees development display draganddrop drawing encryption enum equation event excel file form format formbox forms formupdate function gdi+ httpwebrequest image index input install java label linux list listbox mandelbrot math mouseclick mysql networking operator packaging parse path photoshop picturebox pixelinversion post powerpacks programming radians regex remote remoting reporting richtextbox robot server sleep socket sql statistics stream string table text textbox thread time timer transform treeview update usercontrol validation visualstudio webbrowser wfa windows winforms wpf xml





