Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>To the best of my knowledge unfortunately the answer is no. You cannot build your own custom exceptions on the server side and expect to use them on the client side through WSE. I can't give much technical background as to why (as in why this is not allowed by WSE), but I am sure about my answer because I tested this out.</p> <p>You can use the approach described in the provided link to return a custom exception that inherits from a System.Web.Services.Protocols.SoapException, however you must capture the exception on the client side as a SoapException since you will not be able to capture it as the custom exception type: <a href="http://msdn.microsoft.com/en-us/library/ms229064.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms229064.aspx</a></p> <p>To recreate the test for your own confirmation do the following:</p> <ol> <li>Create a test exception class, call it whatever you'd like and make sure it follows the pattern described in the link I provided above (there are code samples provided).</li> <li><p>Create a web method that explicitly returns the test exception like so:</p> <pre><code>'This is in VB.Net &lt;WebMethod()&gt; _ Public Function ThrowTestSoapException() As TestSoapException Return New TestSoapException() End Function </code></pre></li> <li><p>Try to regenerate your client's WSE Library (using WseWsdl3.exe) and you should receive an error message like this one: "<em>Error: Server unavailable, please try later</em>"</p></li> </ol> <p>That is as far as I could get when trying to create my own transferable Custom Exceptions. Again the only thing I was able to do was return a Custom Exception that inherited from the SoapException class, and caught it on the client side as a SoapException. That is the same method described in the link that "CheGueVerra" pointed out <a href="http://msdn.microsoft.com/en-us/library/aa480592.aspx" rel="nofollow">above</a>.</p> <p>In response to John Saunders's comment above: Yes, if <em>possible</em> move over to WCF, WSE is indeed obsolete. Since this is work related for me and for others asking these questions, making a shift from WSE to WCF would require managerial approval - so some of us cannot make those changes easily - even if we desperately want to. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload