Call .NET web service from Java

J

John Straumann

Hi all:

Does anyone out there have any experience with connecting to a .NET web
service from a Java Application and/or servlet? Can anyone point me at a
tutorial or a good example?

Thanks!

John.
 
A

Arne Vajhøj

John said:
Does anyone out there have any experience with connecting to a .NET web
service from a Java Application and/or servlet? Can anyone point me at a
tutorial or a good example?

Use a toolkit that can generate a stub from the WSDL file.

Like Axis WSDL2Java or JDK 1.6 wsimport.

Run and just call the stub code.

Very simple and easy.

Arne
 
J

John Straumann

Hi Arne:

Thanks for the reply. I used the tool and it generated a bunch of Java code
files and classes. Is there a tutorial somewhere that shows how to use the
generated files? It has been a while since I have worked with Java and I am
not sure. I don't see how the generated Java maps to the .NET web service
call that I usually work with.

John.
 
A

Arne Vajhøj

John said:
Thanks for the reply. I used the tool and it generated a bunch of Java
code files and classes. Is there a tutorial somewhere that shows how to
use the generated files? It has been a while since I have worked with
Java and I am not sure. I don't see how the generated Java maps to the
.NET web service call that I usually work with.

I usually find it rather self explaining when browsing the
generated code.

Example:

..NET web service

public class SimpleTest : WebService
{
[WebMethod]
public int AddOne(int v)

called from Java with Axis generated stub:

SimpleTestLocator stl = new SimpleTestLocator();
SimpleTestSoap sts = stl.getSimpleTestSoap();
System.out.println(sts.addOne(2));

Arne
 
J

John Straumann

Thanks for the help folks.

John.

Lew said:
I usually find it rather self explaining when browsing the
generated code.

Example:

..NET web service

public class SimpleTest : WebService
{
[WebMethod]
public int AddOne(int v)

called from Java with Axis generated stub:

SimpleTestLocator stl = new SimpleTestLocator();
SimpleTestSoap sts = stl.getSimpleTestSoap();
System.out.println(sts.addOne(2));

Or even,

SimpleTest sts = stl.getSimpleTestSoap();

etc.

The exact flavor of the calls depends on the web-service framework you
choose. Generally the Java code declares an interface type with the same
name as the web service, and an implementing type such as Arne's
'SimpleTestSoap' class. If you crack open the implementing class's source,
you find all the messy details of setting up a proxy object, mapping Java
types to XML namespaces and tags, and so forth.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,900
Latest member
Nell636132

Latest Threads

Top