How to handle invalid web service namespace error

Discussion in 'ASP .Net Web Services' started by Ajay Choudhary, May 10, 2005.

  1. Hi,

    If the client tries to access a web service with invalid namespace, it gets
    a SOAP exception as invalid SOAPAction.
    The invalid namespace will happen because the proxies on the client side
    were generated before the namespace on the server side was updated.
    I would like to handle this myself and throw a SOAP exception with more
    information in it.
    How can I do that?

    Thanks,
    Ajay

    Serve Code - The namespace is updated from "1111" to "2222".
    [WebService(Namespace=http://NoServerWithThisName/Services/SayHello/2222)]

    public class SayHello : System.Web.Services.WebService

    {

    [WebMethod]

    public string HelloWorld()

    {

    return "Hello World from "+Environment.UserName;

    }

    }

    Client Proxy Code - Notice the "1111"

    [System.Web.Services.WebServiceBindingAttribute(Name="SayHelloSoap",
    Namespace=http://NoServerWithThisName/Services/SayHello/1111)]

    public class SayHello : System.Web.Services.Protocols.SoapHttpClientProtocol
    {

    ....

    }

    Client Code -

    try

    {

    SayHello s = new SayHello();

    MessageBox.Show(s.HelloWorld());

    }

    catch(Exception ex)

    {

    MessageBox.Show(ex.Message);

    }
    Ajay Choudhary, May 10, 2005
    #1
    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. Èý¹â
    Replies:
    1
    Views:
    559
    William F. Robertson, Jr.
    Jul 29, 2003
  2. Replies:
    0
    Views:
    5,113
  3. Patrick.O.Ige
    Replies:
    1
    Views:
    1,944
    Patrick.O.Ige
    Jul 2, 2006
  4. Grant Edwards

    subprocess "handle is invalid" error

    Grant Edwards, Apr 18, 2007, in forum: Python
    Replies:
    5
    Views:
    897
    Daniel Serodio
    Jan 10, 2008
  5. =?Utf-8?B?am1ncm8=?=
    Replies:
    2
    Views:
    2,040
    =?Utf-8?B?am1ncm8=?=
    Jun 15, 2007
Loading...

Share This Page