Highlighted
DanielKovacs
New Member.
1139 views

HPNA Python SOAP

Hi,

I would like to connect to HPNA via SOAP from Python. The only possible way I can use is to use a SOAP module (suds) and use the supplied wsdl file. 

What I have so far:

credentials = dict(username="user",password="pass")
t = HTTPAuthenticated(**credentials)
client = Client(url="blabvla.wsdl",location="https://hpnaserver.company:443",transport=t)

login_params = client.factory.create("loginInputParams")
login_params.username = "user"
login_params.password="pass"

client.service.login(parameters=login_parameters)

 

When I execute these, the script connects to the server and it send the SOAP message, however, the server only sends back the HPNA login HTML, and so the script dies as it's not a SOAP response. What should I do differently? Should I connect to a different port?

 

Thanks,
Daniel

Tags (2)
0 Likes
2 Replies
DanielKovacs
New Member.

Re: HPNA Python SOAP

Hi,

 

Just found the solution: the location must be: https://server:443/soap

0 Likes
EJ
New Member.

Re: HPNA Python SOAP

#To complete this example.  Hopefully this helps somebody.

#API doc https://softwaresupport.softwaregrp.com/doc/KM01908343?fileName=NA_10.11_cli_reference.html

credentials = dict(username="user",password="pass")
t = HTTPAuthenticated(**credentials)
client = Client(url="blabvla.wsdl",location="https://hpnaserver.company:443/soap",transport=t)

login_params = client.factory.create("loginInputParams")
login_params.username = "user"
login_params.password="pass"

session_output = client.service.login(parameters=login_parameters)

#grab the session ID from the session output.  You need to present this for every call going forward

session_id = (str(session_output.Text))

#Refer to the API CLI doc for required parameters for each command.  The below 'show_device' routine requires a 'host' argument unless you want to see all devices.  Include key/value pairs in the param_dict for your session ID and also the hostname.  

param_dict = dict()
param_dict['sessionid'] = session_id
param_dict['host'] = 'my_hostname'

output = client.service.show_device(parameters = param_dict)

print (output)

 

0 Likes
The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.