I have created a C# Web service in ASP.net. I am using a IIS web server. I have successfully deployed the service by creating a .net website application.
The service takes an input parameter which is the file name and returns a string.
[WebMethod]
public string ProcessResults(string filename)
NOW I need to call the ASP.net service from Java. How do I make a reference to the web service and call a function from it. What tools do I need to download and the code to execute.
I am a beginner in web services. Any help in this matter will be appreciated.
Since you have successfully deployed the web service, now it is from Java side to call the web service. It is better to post in java forums to call web services...
samya
None
0 Points
4 Posts
Using ASP.net webservice in Java
Mar 01, 2012 01:47 PM|LINK
HI,
I have created a C# Web service in ASP.net. I am using a IIS web server. I have successfully deployed the service by creating a .net website application.
The service takes an input parameter which is the file name and returns a string.
[WebMethod]
public string ProcessResults(string filename)
NOW I need to call the ASP.net service from Java. How do I make a reference to the web service and call a function from it. What tools do I need to download and the code to execute.
I am a beginner in web services. Any help in this matter will be appreciated.
Thanks.
sreejukg
All-Star
27607 Points
4122 Posts
Re: Using ASP.net webservice in Java
Mar 01, 2012 01:53 PM|LINK
Since you have successfully deployed the web service, now it is from Java side to call the web service. It is better to post in java forums to call web services...
Any way refer this
http://www.codeproject.com/Articles/5867/How-to-consume-an-ASP-NET-webservice-from-Java-via
My Blog
vckreddyece
Member
215 Points
52 Posts
Re: Using ASP.net webservice in Java
Mar 01, 2012 02:45 PM|LINK
1) First we need proxy/stub classes and for this
a) We can use eclipse IDE web service client creation technique by giving our WSDL.
b) We can enerate stub classes by using any WSDL2Java converters
2) Use the above generated classes to invoke the service.
// setting up request
ServiceRequest dcr = new ServiceRequest();
dcr.setSourceFile("<FILE_DIR>\<FILE_NAME>.<INPUT_FILE_FORMAT>");
dcr.setDestinationFolder(("<FILE_DESTINATION_DIR>");
dcr.setDestinationFormat("<FILE_DESTINATION_FORMAT>");
//Set the service details
URL endpoint = new URL("<SERVICE_URL>");
Bindingone_IServiceStub stub = (Bindingone_IServiceStub) new ServiceLocator().getBindingone_IService(endpoint);
stub.setCredentials(user, pass);
stub.setTimeout(iTimeOut); //milliseconds
//Invoke the operation
ServiceResponse response = stub.myfunction(dcr);
Fault f = response.getFault();
if (response != null) {
//Good, handle the response
}