3 Replies Latest reply on May 12, 2005 9:00 AM by Bruce Scharlau

    .NET calling WebService

    Jason Taylor Newbie

      Ok, I have created a simple "Hello World" type of Web Service that takes a single String argument in and returns a simple String response out. I have deployed it and it is using document/literal (wrapped).

      I have also written a small .NET console app that calls the Web Service developed and deployed under JBoss 4.0.2. I have verified that my .NET app (C#) calls the method (called getGreeting) because I put a println out when the method was called.

      However, I am not getting a string result. I print to the console the result of the call and get blank response when I print the return value. There are no exceptions thrown on either the Java/JBoss side or .NET side.

      Anyone else having these problems?

      Thanks

      Jason Taylor

        • 1. Re: .NET calling WebService
          Georg Hallingstrom Newbie

          Hello,

          I have had similar problems earlier. The problem I had came from using a MS tool that used the .Net 1.0 version. Confirm that you are using at least a .Net 1.1 version.

          Also, there has been some discussions regarding interoperability with .Net earlier in this forum, here are some links:

          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=63158
          http://www.jboss.org/index.html?module=bb&op=viewtopic&t=62229


          Best regards,

          Georg

          • 2. Re: .NET calling WebService
            Bruce Scharlau Newbie

            Jason,

            assuming that you are using the .NET SDK 1.1 Framework, then you can use the wsdl.exe tool under C:/program files/microsoft.net/sdk/v.1.1/bin to generate the appropriate c# classes, which you then need to make use of. You can find out more in the sdk help files too, but you basically point it at the wsdl file, and away it goes. I'm on the wrong computer just now to post the example, but you end up doing some convaluted bits to call the generated classes. I'll post an example tomorrow.

            Bruce

            • 3. Re: .NET calling WebService
              Bruce Scharlau Newbie

              Hi,

              here's the example as mentioned. It calls a basic hello world service, which returns a Person object with their name and age.

              First, use wsdl.exe, which I call from a bat file, and which generates the appropriate cs file for me, which I then use in the client.

              \..\..\Progra~1\Microsoft.NET\SDK\v1.1\Bin\wsdl /out:ws4eeProxy.cs http://localhost:8080/simple-ws4ee/exactpath/jse?wsdl


              Second, the client cs file, which you can see makes use of the generated objects.
              using System;

              namespace ws4ee
              {
              class MainClass
              {
              public static void Main(string[] args)
              {
              Console.WriteLine("ws4ee doc lit from jboss!");
              HelloService ap = new ws4ee.HelloService();

              Person p = new Person();
              string s = "bill";
              getHelloWorld ghw = new getHelloWorld();
              ghw.String_1 = s;
              getHelloWorldResponse ghwr = new getHelloWorldResponse();
              ghwr = (getHelloWorldResponse)ap.getHelloWorld(ghw);
              p = ghwr.result;
              Console.WriteLine(p.age + " " + p.name);
              }
              }
              }



              That's all there is to it, and you then have your returned object to do with as you please.