WEb Service

web services India
  • 14 years ago

    Hi Developers,

              I need ur help .  I am creating  form in  windows control  library. On that I've called a web service by adding reference. It is working very fine. If I drag that windows control library dll (it means by adding this dll into form a a tool)into a windows aplication in the sense, The design of the form appears good in FORM, But the problem is The wes service is not working here, It creates the error "UNABLE TO CONNET REMOTE SERVER". This is my problem. Is ther any other method to call the websevice by using coding not by adding reference

    Thanks in Advance.

    Raju

                  

  • 14 years ago

    Hi Raju,

    There is another way of calling a web service without adding a reference. But you need to create a proxy object to call that web service. Here's a sample I take from MSDN Library (Communicating with Web Services Asynchronously)

    public class PrimeFactorizer : System.Web.Services.Protocols.SoapHttpClientProtocol {
            public PrimeFactorizer(string strURL) { this.URL = strURL; }
            public long[] Factorize(long factorizableNum) {
                object[] results = this.Invoke("Factorize", new object[] {
                            factorizableNum});
                return ((long[])(results[0]));
            }
           
            public System.IAsyncResult BeginFactorize(long factorizableNum, System.AsyncCallback callback, object asyncState) {
                return this.BeginInvoke("Factorize", new object[] {
                            factorizableNum}, callback, asyncState);
            }
           
            public long[] EndFactorize(System.IAsyncResult asyncResult) {
                object[] results = this.EndInvoke(asyncResult);
                return ((long[])(results[0]));
            }
        }


















    Note that if you created your own web service, it is best to use WSDL.EXE from Visual Studio to generate the proxy object.

    Your c

  • 14 years ago

    sorry, my previous posting was truncated:

    Note that if you created your own web service, it is best to use WSDL.EXE from Visual Studio to generate the proxy object.

    Your c

Post a reply

Enter your message below

Sign in or Join us (it's free).

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“XML is like violence - if it's not working for you, you're not using enough of it.”