SoapException....setting the "code" property....

D

Doug

I'm trying to set the "code" property on a generated SOAP exception based on
what happened in the webservice....basicly if the client sends in bad data I
need to indicate in the SoapException that it was the "clients" fault not
the server (this will help with debugging)....so I have the following method
that I call and create a SoapException object which I return to the
client...When I inspect the SoapException at the client the
SoapException.Code.Name = "Server" but I raised it as "Client" in the
webservice!!!....

GetSoapException(byval uri as string, webServiceNamespace as string,ErrorMsg
as String,ErrorNumber as string
ErrorSource as string, oFaultCode as
MyEnumSoapFault)
dim oSoapFault as XmlQualifiedName
Dim oSoapEx as SoapException

try
If oFaultCode = MyEnumSoapFault.Client then
oFaultCode = SoapException.ClientFaultCode <----This is what is
being sent into the constructor!!
Else
oFaultCode = SoapException.ServerFaultCode
End if
....other stuff here...creating the node etc...
mynode = new xmlDocument.createnode(....blah..blah

oSoapEx = new
SoapException(ErrorMessage,oFaultCode,Context.Request.Url.AbsoluteUri,mynode
)
Return oSoapEX


....Now in my client when I look at the SoapException...the Code.Name
property is still = "Server" How do I get it to be "Client"????..(basicly
indicating that something that the client sent to the server is incorrect)
 
D

Doug

One more thing...I can get this to work if I leave the namespace on the
WebServiceAttribute to the default... http://tempuri.org

But if I change the namespace on the webservice to http://myserver/helpme
then the detail element under the soapexception when it reaches the client
is empty....

any thoughts?
thanks
Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,764
Messages
2,569,565
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top