?
Solved

Consuming .Net Web Service from Java problem

Posted on 2008-11-03
1
Medium Priority
?
1,248 Views
Last Modified: 2013-12-17
Hi All,

I have written a simple C# web service to accept 1 string paramater and write it to a file (method attached in code snipppet).  I want to call this method from a java class and have written code to do so (attached in a code snippet).

This is kind of working.  I am able to call the method in the service successfully, however I am unable to pass the parameter.  The C# web method always recieved null as the parameter value.  Am I missing something blatant here?
C# Web Service
public string SendToMessageServer(string one)
{
     StreamWriter sw = new StreamWriter("C:\\ItWorked.TXT", true);
     sw.WriteLine(one);
     sw.Close();
     return one;
}
 
 
Java call to service
try
{
     String endpoint =  "http://localhost:1093/CSL.asmx?WSDL"; 
     Service service = new Service();
     Call call= (Call) service.createCall(); 
     call.setProperty( Call.SOAPACTION_USE_PROPERTY, new Boolean(true)); 
     call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://development.datel-group.com/SendToMessageServer"); 
     call.setTargetEndpointAddress( new java.net.URL(endpoint));
     call.setOperationName(new QName("http://localhost:1093/CSL.asmx/SendToMessageServer", "SendToMessageServer"));
     call.addParameter("one", XMLType.XSD_STRING, ParameterMode.IN);
     Object[] parms = new Object[1];
     parms[0] = "HeyNow";
     call.invoke(parms);
}
catch (Exception e) 
{ 
     System.err.println(e.toString()); 
}

Open in new window

0
Comment
Question by:mdw233
1 Comment
 
LVL 2

Accepted Solution

by:
Slava_K earned 1500 total points
ID: 22872491
You need to create a proxy in your Java code. Here is a link how to:
http://java.sun.com/developer/technicalArticles/J2EE/j2ee_ws/
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Online collaboration is quickly becoming embedded in the workplace, and its benefits are tangible. See what the current landscape looks like and what the future holds for collaboration tools and the future of work.
In order to have all security and back ups taken care of, WordPress users can sign up for services with WP Engine.
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month8 days, 11 hours left to enroll

621 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question