Intel® Business Client Software Development
Support for Intel® vPro™ software development and technologies associated with Intel vPro platforms.

Sending WSMAN request to Web Browser

Cindy_Q_
Beginner
763 Views

Hi,

Our team has recently had to switch from using SOAP requests to WS-Man. And I'm a little stuck on getting it to work, so I'm hoping someone can shed some light. 

Using OpenWSMan, I was able to invoke a RequestPowerStateChange, so I thought I could take the XML request and send it to the webservice to make it work the same way. Sadly that has not been the case. 

MY_XML_REQUEST:

<?xml version="1.0" encoding="UTF-8"?>
<s:Envelope xmlns:s="http://www.w3.org/2003/05/soap-envelope" xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" xmlns:wsman="http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd" xmlns:n1="http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService">
<s:Header>
  <wsa:Action s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService/RequestPowerStateChange</wsa:Action>
  <wsa:To s:mustUnderstand="true">http://some_hostname:16992/wsman</wsa:To>
  <wsman:ResourceURI s:mustUnderstand="true">http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PowerManagementService</wsman:ResourceURI>
  <wsa:MessageID s:mustUnderstand="true">uuid:fc6f2bc3-498e-45f6-84e0-5f7b2665903e</wsa:MessageID>
  <wsa:ReplyTo><wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address></wsa:ReplyTo>
  <wsman:SelectorSet>
    <wsman:Selector Name="Name">Intel(r) AMT Power Management Service</wsman:Selector>
    <wsman:Selector Name="SystemName">Intel(r) AMT</wsman:Selector>
    <wsman:Selector Name="CreationClassName">CIM_PowerManagementService</wsman:Selector>
    <wsman:Selector Name="SystemCreationClassName">CIM_ComputerSystem</wsman:Selector>
  </wsman:SelectorSet>
</s:Header>
<s:Body>
  <n1:RequestPowerStateChange_INPUT>
    <n1:PowerState>2</n1:PowerState>
    <n1:ManagedElement>
      <wsa:Address>http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous</wsa:Address>
      <wsa:ReferenceParameters>
        <wsman:ResourceURI>http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_ComputerSystem</wsman:ResourceURI>
        <wsman:SelectorSet>
          <wsman:Selector Name="Name">ManagedSystem</wsman:Selector>
          <wsman:Selector Name="CreationClassName">CIM_ComputerSystem</wsman:Selector>
        </wsman:SelectorSet>
      </wsa:ReferenceParameters>
    </n1:ManagedElement>
  </n1:RequestPowerStateChange_INPUT>
</s:Body>
</s:Envelope>

Sending to Webservice using Python:

url = 'http://some_hostname:16992/wsman'
passwdmgr = urllib2.HTTPPasswordMgrWithDefaultRealm()
passwdmg.add_password(None, url, 'admin', 'secret')
authhandler = urllib2.HTTPDigestAuthHandler(passwdmgr)
urllib2.install_opener(urllib2.build_opener(authhandler))
headers = {
  'Content-Type': 'application/soap+xml'
}
request = urllib2.Request(url, MY_XML_REQUEST)
urllib2.urlopen(request)

 

Is this not even possible, or do I need to use a WSMan Client like OpenWSMAN? Any help would be greatly appreciated

0 Kudos
2 Replies
Colleen_C_Intel
Employee
763 Views

Please see the article Developing WSman solutions for Intel AMT. It explains why we use a client.

0 Kudos
Cindy_Q_
Beginner
763 Views

Sweet, thank you, just wanted to make sure I wasn't going down a rabbit hole with trying to get this request to work. I can use the client and make a Python subprocess call either way.

0 Kudos
Reply