multiple WS-I filters on NNMi 10.20 SOAP
up vote
0
down vote
favorite
I would like to apply multiple WS-I filters on NNMi 10.20 SOAP , I Use Zeep Python library :
from requests.auth import HTTPBasicAuth # or HTTPDigestAuth, or OAuth1
from requests import Session
from zeep import Client
from zeep.transports import Transport
user = 'admin'
password = 'secret'
url = 'http://domaine.fr/NodeBeanService/NodeBean?wsdl'
node_id= "144077343434"
session = Session()
session.auth = HTTPBasicAuth(user, password)
client = Client(url, transport=Transport(session=session))
factory = client.type_factory('ns3')
constraint = factory.constraint(name="includeCustomAttributes", value=1)
condition = factory.condition(name="id", operator="EQ", value=node_id)
filterr = factory.expression(operator="AND", subFilters=[constraint, condition])
node_infos = client.service.getNodes(filterr)
I get this error :
Fault: java.lang.IllegalArgumentException: prefix ns1 is not bound to a namespace
what is the solution please.
thanks in advance.
python soap zeep
add a comment |
up vote
0
down vote
favorite
I would like to apply multiple WS-I filters on NNMi 10.20 SOAP , I Use Zeep Python library :
from requests.auth import HTTPBasicAuth # or HTTPDigestAuth, or OAuth1
from requests import Session
from zeep import Client
from zeep.transports import Transport
user = 'admin'
password = 'secret'
url = 'http://domaine.fr/NodeBeanService/NodeBean?wsdl'
node_id= "144077343434"
session = Session()
session.auth = HTTPBasicAuth(user, password)
client = Client(url, transport=Transport(session=session))
factory = client.type_factory('ns3')
constraint = factory.constraint(name="includeCustomAttributes", value=1)
condition = factory.condition(name="id", operator="EQ", value=node_id)
filterr = factory.expression(operator="AND", subFilters=[constraint, condition])
node_infos = client.service.getNodes(filterr)
I get this error :
Fault: java.lang.IllegalArgumentException: prefix ns1 is not bound to a namespace
what is the solution please.
thanks in advance.
python soap zeep
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I would like to apply multiple WS-I filters on NNMi 10.20 SOAP , I Use Zeep Python library :
from requests.auth import HTTPBasicAuth # or HTTPDigestAuth, or OAuth1
from requests import Session
from zeep import Client
from zeep.transports import Transport
user = 'admin'
password = 'secret'
url = 'http://domaine.fr/NodeBeanService/NodeBean?wsdl'
node_id= "144077343434"
session = Session()
session.auth = HTTPBasicAuth(user, password)
client = Client(url, transport=Transport(session=session))
factory = client.type_factory('ns3')
constraint = factory.constraint(name="includeCustomAttributes", value=1)
condition = factory.condition(name="id", operator="EQ", value=node_id)
filterr = factory.expression(operator="AND", subFilters=[constraint, condition])
node_infos = client.service.getNodes(filterr)
I get this error :
Fault: java.lang.IllegalArgumentException: prefix ns1 is not bound to a namespace
what is the solution please.
thanks in advance.
python soap zeep
I would like to apply multiple WS-I filters on NNMi 10.20 SOAP , I Use Zeep Python library :
from requests.auth import HTTPBasicAuth # or HTTPDigestAuth, or OAuth1
from requests import Session
from zeep import Client
from zeep.transports import Transport
user = 'admin'
password = 'secret'
url = 'http://domaine.fr/NodeBeanService/NodeBean?wsdl'
node_id= "144077343434"
session = Session()
session.auth = HTTPBasicAuth(user, password)
client = Client(url, transport=Transport(session=session))
factory = client.type_factory('ns3')
constraint = factory.constraint(name="includeCustomAttributes", value=1)
condition = factory.condition(name="id", operator="EQ", value=node_id)
filterr = factory.expression(operator="AND", subFilters=[constraint, condition])
node_infos = client.service.getNodes(filterr)
I get this error :
Fault: java.lang.IllegalArgumentException: prefix ns1 is not bound to a namespace
what is the solution please.
thanks in advance.
python soap zeep
python soap zeep
edited Nov 20 at 8:58
asked Nov 20 at 8:51
Yacine Bs
1029
1029
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
this is the request in XML,
I used SOAPUI to send it
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<ns1:getNodes xmlns:ns1="http://node.sdk.nms.ov.hp.com/">
<arg0 xsi:type="ns3:expression" xmlns:ns3="http://filter.sdk.nms.ov.hp.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<operator>AND</operator>
<subFilters xsi:type="ns3:condition">
<name>id</name>
<operator>EQ</operator>
<value>34345454656</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>true</value>
</subFilters>
</arg0>
</ns1:getNodes>
</env:Body>
</env:Envelope>
you can use requests to do it
from lxml import etree
import requests
from config import config, urls
def prepare_xml_request(deviceId, includeCustomAttributes="true"):
return """
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
etc ......
<name>id</name>
<operator>EQ</operator>
<value>{0}</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>{1}</value>
</subFilters>
</env:Envelope>
""".format(deviceId, includeCustomAttributes)
def parse_response(resp_file):
tree = etree.parse(resp_file)
root = tree.getroot()
customAttributes = {}
hostname = ""
for customAttribut in root.iter("customAttributes"):
att =
for element in customAttribut.iter("*"):
if element.tag != 'customAttributes':
att.append(element.text)
customAttributes[att[0]] = att[1]
for longName in root.iter("longName"):
hostname = longName.text
return (hostname, customAttributes)
def get_infos_node(node_id):
xml_req = prepare_xml_request(node_id)
resp = requests.post(urls.get('Node'), data=xml_req, auth=(config.get('username'), config.get('password'))).text
f = open('node_resp.xml', mode='w', encoding='utf-8')
f.write(resp)
f.close()
# parser le resp et recuper le hostname et les customattributes
(hostname, customAttributes) = parse_response('node_resp.xml')
# return hostname, customAttributes
return (hostname, customAttributes)
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389284%2fmultiple-ws-i-filters-on-nnmi-10-20-soap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
this is the request in XML,
I used SOAPUI to send it
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<ns1:getNodes xmlns:ns1="http://node.sdk.nms.ov.hp.com/">
<arg0 xsi:type="ns3:expression" xmlns:ns3="http://filter.sdk.nms.ov.hp.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<operator>AND</operator>
<subFilters xsi:type="ns3:condition">
<name>id</name>
<operator>EQ</operator>
<value>34345454656</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>true</value>
</subFilters>
</arg0>
</ns1:getNodes>
</env:Body>
</env:Envelope>
you can use requests to do it
from lxml import etree
import requests
from config import config, urls
def prepare_xml_request(deviceId, includeCustomAttributes="true"):
return """
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
etc ......
<name>id</name>
<operator>EQ</operator>
<value>{0}</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>{1}</value>
</subFilters>
</env:Envelope>
""".format(deviceId, includeCustomAttributes)
def parse_response(resp_file):
tree = etree.parse(resp_file)
root = tree.getroot()
customAttributes = {}
hostname = ""
for customAttribut in root.iter("customAttributes"):
att =
for element in customAttribut.iter("*"):
if element.tag != 'customAttributes':
att.append(element.text)
customAttributes[att[0]] = att[1]
for longName in root.iter("longName"):
hostname = longName.text
return (hostname, customAttributes)
def get_infos_node(node_id):
xml_req = prepare_xml_request(node_id)
resp = requests.post(urls.get('Node'), data=xml_req, auth=(config.get('username'), config.get('password'))).text
f = open('node_resp.xml', mode='w', encoding='utf-8')
f.write(resp)
f.close()
# parser le resp et recuper le hostname et les customattributes
(hostname, customAttributes) = parse_response('node_resp.xml')
# return hostname, customAttributes
return (hostname, customAttributes)
add a comment |
up vote
0
down vote
this is the request in XML,
I used SOAPUI to send it
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<ns1:getNodes xmlns:ns1="http://node.sdk.nms.ov.hp.com/">
<arg0 xsi:type="ns3:expression" xmlns:ns3="http://filter.sdk.nms.ov.hp.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<operator>AND</operator>
<subFilters xsi:type="ns3:condition">
<name>id</name>
<operator>EQ</operator>
<value>34345454656</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>true</value>
</subFilters>
</arg0>
</ns1:getNodes>
</env:Body>
</env:Envelope>
you can use requests to do it
from lxml import etree
import requests
from config import config, urls
def prepare_xml_request(deviceId, includeCustomAttributes="true"):
return """
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
etc ......
<name>id</name>
<operator>EQ</operator>
<value>{0}</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>{1}</value>
</subFilters>
</env:Envelope>
""".format(deviceId, includeCustomAttributes)
def parse_response(resp_file):
tree = etree.parse(resp_file)
root = tree.getroot()
customAttributes = {}
hostname = ""
for customAttribut in root.iter("customAttributes"):
att =
for element in customAttribut.iter("*"):
if element.tag != 'customAttributes':
att.append(element.text)
customAttributes[att[0]] = att[1]
for longName in root.iter("longName"):
hostname = longName.text
return (hostname, customAttributes)
def get_infos_node(node_id):
xml_req = prepare_xml_request(node_id)
resp = requests.post(urls.get('Node'), data=xml_req, auth=(config.get('username'), config.get('password'))).text
f = open('node_resp.xml', mode='w', encoding='utf-8')
f.write(resp)
f.close()
# parser le resp et recuper le hostname et les customattributes
(hostname, customAttributes) = parse_response('node_resp.xml')
# return hostname, customAttributes
return (hostname, customAttributes)
add a comment |
up vote
0
down vote
up vote
0
down vote
this is the request in XML,
I used SOAPUI to send it
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<ns1:getNodes xmlns:ns1="http://node.sdk.nms.ov.hp.com/">
<arg0 xsi:type="ns3:expression" xmlns:ns3="http://filter.sdk.nms.ov.hp.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<operator>AND</operator>
<subFilters xsi:type="ns3:condition">
<name>id</name>
<operator>EQ</operator>
<value>34345454656</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>true</value>
</subFilters>
</arg0>
</ns1:getNodes>
</env:Body>
</env:Envelope>
you can use requests to do it
from lxml import etree
import requests
from config import config, urls
def prepare_xml_request(deviceId, includeCustomAttributes="true"):
return """
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
etc ......
<name>id</name>
<operator>EQ</operator>
<value>{0}</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>{1}</value>
</subFilters>
</env:Envelope>
""".format(deviceId, includeCustomAttributes)
def parse_response(resp_file):
tree = etree.parse(resp_file)
root = tree.getroot()
customAttributes = {}
hostname = ""
for customAttribut in root.iter("customAttributes"):
att =
for element in customAttribut.iter("*"):
if element.tag != 'customAttributes':
att.append(element.text)
customAttributes[att[0]] = att[1]
for longName in root.iter("longName"):
hostname = longName.text
return (hostname, customAttributes)
def get_infos_node(node_id):
xml_req = prepare_xml_request(node_id)
resp = requests.post(urls.get('Node'), data=xml_req, auth=(config.get('username'), config.get('password'))).text
f = open('node_resp.xml', mode='w', encoding='utf-8')
f.write(resp)
f.close()
# parser le resp et recuper le hostname et les customattributes
(hostname, customAttributes) = parse_response('node_resp.xml')
# return hostname, customAttributes
return (hostname, customAttributes)
this is the request in XML,
I used SOAPUI to send it
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body>
<ns1:getNodes xmlns:ns1="http://node.sdk.nms.ov.hp.com/">
<arg0 xsi:type="ns3:expression" xmlns:ns3="http://filter.sdk.nms.ov.hp.com/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<operator>AND</operator>
<subFilters xsi:type="ns3:condition">
<name>id</name>
<operator>EQ</operator>
<value>34345454656</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>true</value>
</subFilters>
</arg0>
</ns1:getNodes>
</env:Body>
</env:Envelope>
you can use requests to do it
from lxml import etree
import requests
from config import config, urls
def prepare_xml_request(deviceId, includeCustomAttributes="true"):
return """
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
etc ......
<name>id</name>
<operator>EQ</operator>
<value>{0}</value>
</subFilters>
<subFilters xsi:type="ns3:constraint">
<name>includeCustomAttributes</name>
<value>{1}</value>
</subFilters>
</env:Envelope>
""".format(deviceId, includeCustomAttributes)
def parse_response(resp_file):
tree = etree.parse(resp_file)
root = tree.getroot()
customAttributes = {}
hostname = ""
for customAttribut in root.iter("customAttributes"):
att =
for element in customAttribut.iter("*"):
if element.tag != 'customAttributes':
att.append(element.text)
customAttributes[att[0]] = att[1]
for longName in root.iter("longName"):
hostname = longName.text
return (hostname, customAttributes)
def get_infos_node(node_id):
xml_req = prepare_xml_request(node_id)
resp = requests.post(urls.get('Node'), data=xml_req, auth=(config.get('username'), config.get('password'))).text
f = open('node_resp.xml', mode='w', encoding='utf-8')
f.write(resp)
f.close()
# parser le resp et recuper le hostname et les customattributes
(hostname, customAttributes) = parse_response('node_resp.xml')
# return hostname, customAttributes
return (hostname, customAttributes)
answered Nov 26 at 15:10
Yacine Bs
1029
1029
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53389284%2fmultiple-ws-i-filters-on-nnmi-10-20-soap%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown