Latest approach to calling a .NET C# Web Service with a java program

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Deepan
    New Member
    • Dec 2013
    • 4

    #1

    Latest approach to calling a .NET C# Web Service with a java program

    I know how to call a method written in a .NET C# Web Service(SOAP Service) using a c# application. But how to do it with a .NET C# Web Service and a java application. I have found a link regarding this. But it seems a bit outdated. So someone please suggest me a latest approach. As I am quite new to programming please give me a Hello World code example. Thanks in advance.

    Following is the link that I found:
    Netbeans and Apache Tomcat are used in this example to make a JSP client with the help of Apache SOAP toolkit ( Assumption here is that you are bit familiar with JSP and NetBeans. Also, Apache Xerc…
  • rajujrk
    New Member
    • Aug 2008
    • 107

    #2
    Use Axis2 Client to call your webservices.

    The Axis2 client API is very convenient and it has cool features like asynchronous web service utilization, multiple transport selection, and so on. Once you run the samples you will understand the basics of the Axis2 client API. To understand the rest of the API you need to write complex code.

    Example Code:

    Code:
     public static void clientInvokeExample() {
        try {
          String endpoint = "http://host_or_ip:8080/service_or_action";
     
          Service   service = new Service();
          Call      call    = (Call)service.createCall();
     
          call.setTargetEndpointAddress(new URL(endpoint));
          call.setOperationName(new QName("urn:xmethods-delayed-quotes", "getQuote"));
     
          String symbol = "TCS";
          Float ret = (Float)call.invoke(new Object[] { symbol } );
     
          System.out.println("Results (clientInvokeExample):");
          System.out.println("   symbol = " + symbol);
          System.out.println("   return = " + ret);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }

    Thanks
    Raju

    Comment

    Working...