I have figured it out, capture WebException, and get the SOAP error from its
ResponseStream
.. try{
..
}catch (WebException ee)
{
try
{
Stream baseStream = ee.Response.GetResponseStream();
StreamReader sr = new StreamReader(baseStream);
string result = sr.ReadToEnd();
sr.Close();
int s = result.IndexOf(" <SOAP-ENV:Fault>");
int e = result.LastIndexOf(" </SOAP-ENV:Fault>");
if (s > 0 && e > 0)
result = result.Substring(s + 16, e - s - 16);
}
catch(Exception e2)
{
response = e2.Message;
}
}
From: [email protected]
[mailto:[email protected]] On Behalf Of DavidW
Sent: Monday, May 31, 2010 1:32 PM
To: [email protected]
Subject: [vbox-dev] How to get the return codes when call a webservice
method?
For example, when I do openRemoteSession on IVirtualBox, how should I get
the error codes returned? I am using HttpRequest in .NET, I found when error
happens, I only get a 550 http error.
See also: openExistingSession
If this method fails, the following error codes may be reported:
_ E_UNEXPECTED: Virtual machine not registered.
_ E_INVALIDARG: Invalid session type type.
_ VBOX_E_OBJECT_NOT_FOUND: No machine matching machineId
_ VBOX_E_INVALID_OBJECT_STATE: Session already open or being
_ VBOX_E_IPRT_ERROR: Launching process for machine failed.
_ VBOX_E_VM_ERROR: Failed to assign machine to session.
_______________________________________________
vbox-dev mailing list
[email protected]
http://vbox.innotek.de/mailman/listinfo/vbox-dev