Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / May 2005

Tip: Looking for answers? Try searching our database.

How to handle invalid web service namespace error

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Ajay Choudhary - 11 May 2005 17:12 GMT
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);

}
Chad Z. Hower aka Kudzu - 11 May 2005 17:28 GMT
> 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.

Where do you want to handle it, client side or server side?

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
     "Programming is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu
Ajay Choudhary - 11 May 2005 17:48 GMT
On the server side I would like to throw my own exception to clients with my
information in it.

>> If the client tries to access a web service with invalid namespace, it
>> gets a SOAP exception as invalid SOAPAction.
[quoted text clipped - 10 lines]
>
> Blog: http://blogs.atozed.com/kudzu 
Chad Z. Hower aka Kudzu - 11 May 2005 18:16 GMT
> On the server side I would like to throw my own exception to clients
> with my information in it.

Im not sure of anyway offhand. But the webservices classes (both serve and
client) are very flexible. You'll need to dig around a bit and see if you can
hook in at the lower level.

If you cant - you could set up a redirect using a HTTP handler or ASHX, and
then preparse. If its ok, issue a HTTP redirect to send them to the real
webservice, else return the error.

--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
     "Programming is an art form that fights back"

Blog: http://blogs.atozed.com/kudzu

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.