[vbox-dev] How to get the return codes when call a webservice method?

DavidW wyx1999 at hotmail.com
Mon Jun 7 20:07:37 GMT 2010


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: vbox-dev-bounces at virtualbox.org
[mailto:vbox-dev-bounces at virtualbox.org] On Behalf Of DavidW
Sent: Monday, May 31, 2010 1:32 PM
To: vbox-dev at virtualbox.org
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.

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.virtualbox.org/pipermail/vbox-dev/attachments/20100607/5bf3fd73/attachment.html>


More information about the vbox-dev mailing list