Search code examples
xml-rpcxenxenapp

XEN core login process


I want to know how the xml-rpc works in xen core. I want the sample xml formate sent to xen core while login from XenCenter. Can anyone help me with that? I am not willing to use API provided by xen, I think we can make a connection via traditional http post. Please help.


Solution

  • I am sharing how I make it work.

    This is the xml formate you need to provide for login in XEN SERVER. So make XML as XEN SERVER expects and make a connection and post the xml. It will return the expected response.

    <?xml version=’1.0’?> <methodCall>
      <methodName>session.login_with_password</methodName> <params>
        <param>
          <value><string>user</string></value>
        </param>
        <param>
          <value><string>passwd</string></value> </param>
        </params>
      </methodCall>
    

    it you return a XML like

    <methodResponse>
      <params>
        <param>
          <value>
            <struct>
              <member>
                <name>Status</name>
                <value>Success</value>
              </member>
              <member>
                <name>Value</name>
                <value>OpaqueRef:XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXX</value>
              </member>
            </struct>
          </value>
        </param>
      </params>
    </methodResponse>
    

    Then parse the XML to get the data and save necessary data for further use. You can have a good idea about XML formate and return type from XEN API Documentation

    Best of luck. And feel free to ask any question.