public Object fromXML()

in src/com/vmware/vim25/ws/XmlGenDom.java [56:116]


  public Object fromXML(String returnType, InputStream is) throws RemoteException
  {
    Element root = null;
    try 
    {
      SAXReader reader = new SAXReader();
      Document doc = reader.read(is);
      root = doc.getRootElement();
    } 
    catch (Exception e1) 
    {
      throw new RemoteException("VI SDK invoke exception:" + e1);
    }
    finally
    {
      if(is!=null) 
        try { is.close(); } catch(IOException ioe) {}
    }
    
    Element body = (Element) root.elements().get(0);
    Element resp = (Element) body.elements().get(0);
    
    if(resp.getName().indexOf("Fault")!=-1)
    {
      SoapFaultException sfe = null;
      try 
      {
        sfe = parseSoapFault(resp);
      } 
      catch (Exception e) 
      {
        throw new RemoteException("Exception in WSClient.invoke:", e);
      }
      if(sfe!=null && sfe.detail!=null)
      {
        throw (RemoteException) sfe.detail;
      }
      else
      {
        throw sfe;
      }
    }
    else
    {
      if(returnType!=null)
      {
        try 
        {
          return fromXML(returnType, resp);
        } 
        catch (Exception e) 
        {
          throw new RemoteException("Exception in WSClient.invoke:", e);
        }
      }
      else
      {
        return null;
      }
    }
  }