Call .NET web service from Java

Discussion in 'Java' started by John Straumann, May 3, 2008.

  1. 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.
     
    John Straumann, May 3, 2008
    #1
    1. Advertising

  2. John Straumann

    Arne Vajhøj Guest

    John Straumann wrote:
    > 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
     
    Arne Vajhøj, May 3, 2008
    #2
    1. Advertising

  3. 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.


    "Arne Vajhøj" <> wrote in message
    news:481bac9b$0$90272$...
    > John Straumann wrote:
    >> 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
     
    John Straumann, May 3, 2008
    #3
  4. John Straumann

    Arne Vajhøj Guest

    John Straumann wrote:
    > 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
     
    Arne Vajhøj, May 3, 2008
    #4
  5. Thanks for the help folks.

    John.

    "Lew" <> wrote in message
    news:...
    > John Straumann wrote:
    >>> 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.

    >
    > Arne Vajhøj wrote:
    >> 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.
    >
    > --
    > Lew
     
    John Straumann, May 5, 2008
    #5
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bill sandner
    Replies:
    1
    Views:
    903
    iksrazal
    Jul 1, 2004
  2. Michael Averstegge
    Replies:
    0
    Views:
    4,321
    Michael Averstegge
    Jan 10, 2006
  3. Not Me
    Replies:
    1
    Views:
    3,227
    Not Me
    Jun 5, 2007
  4. RJ
    Replies:
    4
    Views:
    820
    Brock Allen
    Sep 22, 2005
  5. Redhot
    Replies:
    0
    Views:
    784
    Redhot
    Jul 18, 2009
Loading...

Share This Page