本文整理汇总了Python中pysimplesoap.client.SoapClient.call方法的典型用法代码示例。如果您正苦于以下问题:Python SoapClient.call方法的具体用法?Python SoapClient.call怎么用?Python SoapClient.call使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pysimplesoap.client.SoapClient
的用法示例。
在下文中一共展示了SoapClient.call方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: createOrUpdateClientEx
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def createOrUpdateClientEx(target):
client = SoapClient(location="http://aboweb.com/aboweb/ClientService?wsdl",trace=False)
client['wsse:Security'] = {
'wsse:UsernameToken': {
'wsse:Username': '[email protected]',
'wsse:Password': 'pYsIJKF18hj0SvS3TwrQV3hWzD4=',
}
}
target = SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><ges:createOrUpdateClientEx xmlns:ges="http://www.gesmag.com/">'+ repr(target) +'</ges:createOrUpdateClientEx>')
client.call('createOrUpdateClientEx',target)
xml = SimpleXMLElement(client.xml_response)
return xml
示例2: test_issue66
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def test_issue66(self):
"""Verify marshaled requests can be sent with no children"""
# fake connection (just to test xml_request):
client = SoapClient(location="https://localhost:666/",namespace='http://localhost/api',trace=False)
request = SimpleXMLElement("<ChildlessRequest/>")
try:
client.call('ChildlessRequest', request)
except:
open("issue66.xml", "wb").write(client.xml_request)
self.assert_("""<ChildlessRequest""" in client.xml_request,
"<ChildlessRequest not in request!")
self.assert_("""</ChildlessRequest>""" in client.xml_request,
"</ChildlessRequest> not in request!")
示例3: _send_ax
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def _send_ax():
client = SoapClient('http://uzak.audio.com.tr:88/AxIntegrations/AxService.asmx', action='http://tempuri.org/', namespace='http://tempuri.org/', ns='tem')
files = os.listdir(AX_QUEUE_FOLDER)
for name in files:
try:
path = os.path.join(AX_QUEUE_FOLDER, name)
with open(path, 'r') as infile:
data = json.load(infile)
#data = dict([(k.encode('utf8'), v.encode('utf8')) for k, v in data.items()])
bilgi = Bilgi.objects.get(pk=int(name))
if bilgi.ax_code:
raise Exception('Teklif %s already has an ax_code: %s, no duplicate allowed. %s' % (name, bilgi.ax_code, bilgi.tarih))
resp = client.call('AddWebQuotationForm', **data)
ax_code = str(resp.AddWebQuotationFormResult)
bilgi.ax_code = ax_code
bilgi.save()
except Exception as e:
if isinstance(e, SoapFault) and e.faultcode == 'soap:Server':
body = "%s\n\nRequest:\n\n%s\n\n\nResponse:\n\n%s\n" % (unicode(e).encode('utf8'), client.xml_request, client.xml_response)
subject = 'Web Teklif Axapta Server Hatasi'
audiomail('[email protected]', ['[email protected] '], subject, body)
audiomail('[email protected]', ['[email protected]'], subject, body)
logging.exception('hello')
else:
os.unlink(path)
示例4: test_issue89
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def test_issue89(self):
"""Setting attributes for request tag."""
# fake connection (just to test xml_request):
client = SoapClient(
location="https://localhost:666/",
namespace='http://localhost/api'
)
request = SimpleXMLElement(
"""<?xml version="1.0" encoding="UTF-8"?><test a="b"><a>3</a></test>"""
) # manually make request msg
try:
client.call('test', request)
except:
open("issue89.xml", "wb").write(client.xml_request)
self.assert_('<test a="b" xmlns="http://localhost/api">' in client.xml_request.decode(),
"attribute not in request!")
示例5: send_msg_to_bpel
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def send_msg_to_bpel(self, callback_method_id, msg):
"""
To send a SOAP message to BPEL
:param address:
:param namespace:
:param method:
:param params:
:param result_names:
:return:
"""
rospy.loginfo("===== Prepare a SOAP client =====")
rospy.loginfo("Address: %s" % self.callback_bpel_method_map[callback_method_id]['address'])
rospy.loginfo("NS: %s" % self.callback_bpel_method_map[callback_method_id]['namespace'])
rospy.loginfo("=================================")
callback_method = self.callback_bpel_method_map[callback_method_id]
client = SoapClient(
location = callback_method['address'], # "http://localhost:8080/ode/processes/A2B"
namespace = callback_method['namespace'], # "http://smartylab.co.kr/bpel/a2b"
soap_ns='soap')
rospy.loginfo("Sending the message to BPEL... %s(%s)" % (callback_method['name'], msg))
# response = client.call(method, **(simplejson.loads(params)))
param_dict = dict()
param_dict[callback_method['param']] = msg
response = client.call(callback_method['name'], **param_dict)
rospy.loginfo("The message is sent.")
示例6: test_issue47_raw
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def test_issue47_raw(self):
"Same example (clarizen), with raw headers (no wsdl)!"
client = SoapClient(location="https://api.clarizen.com/v1.0/Clarizen.svc", namespace='http://clarizen.com/api', trace=False)
headers = SimpleXMLElement("<Headers/>", namespace="http://clarizen.com/api", prefix="ns1")
session = headers.add_child("Session")
session['xmlns'] = "http://clarizen.com/api"
session.marshall('ID', '1234')
client.location = "https://api.clarizen.com/v1.0/Clarizen.svc"
client.action = "http://clarizen.com/api/IClarizen/Logout"
try:
client.call("Logout", headers=headers)
except:
open("issue47_raw.xml", "wb").write(client.xml_request)
self.assert_("""<soap:Header><ns1:Session xmlns="http://clarizen.com/api"><ID>1234</ID></ns1:Session></soap:Header>""" in client.xml_request,
"Session header not in request!")
示例7: test_issue35_raw
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def test_issue35_raw(self):
url = 'http://wennekers.epcc.ed.ac.uk:8080/axis/services/MetadataCatalogue'
client = SoapClient(location=url,action="", trace=False)
response = client.call("doEnsembleURIQuery", ("queryFormat", "Xpath"), ("queryString", "/markovChain"), ("startIndex", 0), ("maxResults", -1))
self.assertEqual(str(response.statusCode), "MDC_INVALID_REQUEST")
#print str(response.queryTime)
self.assertEqual(int(response.totalResults), 0)
self.assertEqual(int(response.startIndex), 0)
self.assertEqual(int(response.numberOfResults), 0)
for result in response.results:
print str(result)
示例8: getClient
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def getClient(codeClient):
client = SoapClient(location="http://aboweb.com/aboweb/ClientService?wsdl",trace=False)
client['wsse:Security'] = {
'wsse:UsernameToken': {
'wsse:Username': '[email protected]',
'wsse:Password': 'pYsIJKF18hj0SvS3TwrQV3hWzD4=',
# 'wsse:Password': 'tRPTUOP+QQYzVcxYZeQXsiTJ+dw=',
}
}
params = SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><ges:getClient xmlns:ges="http://www.gesmag.com/"><codeClient>'+codeClient+'</codeClient></ges:getClient>');
result = client.call("getClient",params)
xml = SimpleXMLElement(client.xml_response)
return xml.children().children().children()
示例9: authenticateByEmail
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def authenticateByEmail(username,password):
# wsdl = "http://dev.aboweb.com/aboweb/ClientService?wsdl"
client = SoapClient(location = "http://aboweb.com/aboweb/ClientService",trace=False)
client['wsse:Security'] = {
'wsse:UsernameToken': {
'wsse:Username': '[email protected]',
# 'wsse:Password': 'tRPTUOP+QQYzVcxYZeQXsiTJ+dw=',
'wsse:Password': 'pYsIJKF18hj0SvS3TwrQV3hWzD4=',
}
}
params = SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><ges:authenticateByEmail xmlns:ges="http://www.gesmag.com/"><email>'+username+'</email><encryptedPassword>'+ b64encode(sha1(password).digest()) +'</encryptedPassword></ges:authenticateByEmail>')
response = client.call("authenticateByEmail",params)
xml = SimpleXMLElement(client.xml_response)
return str(xml('result'))
示例10: getAbonnements
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def getAbonnements(codeClient):
# return xml containing a list of user abonnements
clientAbonnement = SoapClient(location ="http://aboweb.com/aboweb/AbonnementService",trace=False)
clientAbonnement['wsse:Security'] = {
'wsse:UsernameToken': {
'wsse:Username': '[email protected]',
# 'wsse:Password': 'tRPTUOP+QQYzVcxYZeQXsiTJ+dw=',
'wsse:Password': 'pYsIJKF18hj0SvS3TwrQV3hWzD4=',
}
}
params = SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><ges:getAbonnements xmlns:ges="http://www.gesmag.com/"><codeClient>%s</codeClient><offset>0</offset></ges:getAbonnements>' % codeClient)
result = clientAbonnement.call("getAbonnements",params)
xml = SimpleXMLElement(clientAbonnement.xml_response)
return xml
示例11: submit_problem
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def submit_problem(url, params):
p = SimpleXMLElement("<submitProblem></submitProblem>")
for k, v in params.items():
child = p.add_child(k, v)
child.add_attribute("xsi:type", "xsd:string")
client = SoapClient(
location = url,
action = '',
soap_ns = 'soapenv',
namespace = 'http://www.decision-deck.org/2009/XMCDA-2.0.0',
trace = False)
sp = client.call('submitProblem', p)
reply = sp.submitProblemResponse
return str(reply.ticket)
示例12: request_solution
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def request_solution(url, ticket_id, timeout=0):
client = SoapClient(
location = url,
action = '',
soap_ns = 'soapenv',
namespace = 'http://www.decision-deck.org/2009/XMCDA-2.0.0',
trace = False)
start = time.time()
while True:
rs = client.call('requestSolution', ticket=ticket_id)
reply = rs.requestSolutionResponse
if getattr(reply,'service-status') != 1:
break
time.sleep(0.5)
if timeout and time.time()>start+timeout:
return None
return reply
示例13: doRemedyAction
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
def doRemedyAction(self, method, msg):
'''
This just send an error report to BPEL
:param method: Method name of BPEL for error reporting
:param msg: An error message
:return:
'''
# settings of address and namespace of BPEL
address = "http://localhost:8080/ode/processes/CommTestBP"
namespace = "kr.co.smartylab"
# Prepare a SOAP client to send a message to BPEL
client = SoapClient(
location = address,
namespace = namespace,
soap_ns= 'soap')
method = "reportRuntimeFault"
rospy.loginfo("Sending the message to BPEL... %s(%s)" % (method, msg))
param_dict = dict()
param_dict["error_message"] = msg
response = client.call(method, **param_dict)
rospy.loginfo("The message is sent.")
示例14: OCStudyWsService
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
class OCStudyWsService():
"""SOAP web services to OpenClinica
Study metadata, studies and study sites
"""
def __init__(self, studyLocation, proxyStr, proxyUsr, proxyPass, isTrace):
"""Default Constructor
"""
self._logger = logging.getLogger(__name__)
logging.config.fileConfig("logging.ini", disable_existing_loggers=False)
proxies = None
if proxyStr:
proxies = pysimplesoap.client.parse_proxy(proxyStr)
self._logger.info("OC Study SOAP services with proxies: " + str(proxies))
self._logger.info("OC Study SOAP services with auth: " + str(proxyUsr))
if proxies:
self.client = SoapClient(location=studyLocation,
namespace=STUDYNAMESPACE,
action=STUDYACTION,
soap_ns='soapenv',
ns="v1",
trace=isTrace,
proxy=proxies,
username=proxyUsr,
password=proxyPass)
else:
self.client = SoapClient(location=studyLocation,
namespace=STUDYNAMESPACE,
action=STUDYACTION,
soap_ns='soapenv',
ns="v1",
trace=isTrace,
username=proxyUsr,
password=proxyPass)
self._logger.info("OC Study SOAP services sucesfully initialised.")
## ## ######## ######## ## ## ####### ######## ######
### ### ## ## ## ## ## ## ## ## ## ##
#### #### ## ## ## ## ## ## ## ## ##
## ### ## ###### ## ######### ## ## ## ## ######
## ## ## ## ## ## ## ## ## ## ##
## ## ## ## ## ## ## ## ## ## ## ##
## ## ######## ## ## ## ####### ######## ######
def wsse(self, userName, passwordHash):
"""
"""
self.client['wsse:Security'] = {
'wsse:UsernameToken': {
'wsse:Username': userName,
'wsse:Password': passwordHash,
}
}
def getMetadata(self, study):
"""Get XML ODM metadata for specified study
"""
result = ""
query = """<?xml version="1.0" encoding="UTF-8"?>
<getMetadataRequest>
<v1:studyMetadata xmlns:v1="http://openclinica.org/ws/study/v1">
<bean:identifier xmlns:bean="http://openclinica.org/ws/beans">""" + study.identifier.encode("utf-8") + """</bean:identifier>
</v1:studyMetadata>
</getMetadataRequest>"""
params = SimpleXMLElement(query)
response = self.client.call('getMetadataRequest', params)
metadata = (str(response.odm))
# Result of WS call
result = str(response.result)
return result, metadata
def listAll(self):
"""Get hierarchical list of studies together with their study sites
"""
result = ""
studies = []
params = SimpleXMLElement("""<?xml version="1.0" encoding="UTF-8"?>
<listAllRequest />""")
response = self.client.call('listAllRequest', params)
documentTree = ET.ElementTree((ET.fromstring(str(response.as_xml()))))
# Locate Study data in XML file via XPath
for study in documentTree.iterfind('.//study:study', namespaces=nsmaps):
identifier = ""
oid = ""
name = ""
sites = []
for element in study:
print element.tag
#.........这里部分代码省略.........
示例15: DeviceControl_IRCC
# 需要导入模块: from pysimplesoap.client import SoapClient [as 别名]
# 或者: from pysimplesoap.client.SoapClient import call [as 别名]
class DeviceControl_IRCC(SupportBase):
"""DeviceControl IRCC
:ivar boolean force: Force functions to be supported
"""
def __init__(self, force=False, trace=False):
SupportBase.__init__(self, force=force)
self.trace = trace
self._device = None
self._deviceInfo = None
#: ( string ) - IRCC Version
self.version = None
self._controlUrl = None
self._client = None
#: (`{actionName: {argumentName: argumentDirection}}`) - Available Actions
self.actionInfo = {}
#: (boolean) - Has this control service been setup?
self.available = False
def _setup(self, device, descriptionUrl, controlUrl):
"""Setup the IRCC control service. (*PRIVATE*)
:ivar device.Device device: Connected Device
:ivar string descriptionUrl: IRCC Service Description URL
:ivar string controlUrl: IRCC Service Control URL
"""
self._device = device
self._deviceInfo = device.deviceInfo
self.version = self._deviceInfo.irccVersion
self._controlUrl = controlUrl
self._parseDescription(descriptionUrl)
self.available = True
def _load(self):
if self._device.unr.remoteCommands is None:
if not self._device.unr.isFunctionSupported(self._device.unr.getRemoteCommandList):
print "'getRemoteCommandList' not supported"
raise NotSupportedError()
self._device.unr.getRemoteCommandList()
if self._client is None and self._device.unr.remoteCommands:
self._client = SoapClient(
location=self._controlUrl,
action=SONY_UPNP_URN_IRCC,
namespace=SONY_UPNP_URN_IRCC,
soap_ns='soap', ns=False
)
@check_support
def sendIRCC(self, codeName):
"""Send Remote Command
:param codeName: Command Name
:type codeName: string
:raises: :class:`pyircc.spec.InvalidArgumentError`, NotImplementedError
"""
if self.trace:
print ">>> sendIRCC", codeName
if codeName is None:
raise InvalidArgumentError()
if self.version == '1.0' or self.force:
self._load()
if not self._device.unr.remoteCommands.has_key(codeName):
raise InvalidArgumentError()
command = self._device.unr.remoteCommands[codeName]
if command.type == UNR_RemoteCommand.TYPE_IRCC:
try:
self._client.call('X_SendIRCC', IRCCCode=command.value)
return
except SoapFault, e:
if e.faultcode == 's:Client' and e.faultstring == 'UPnPError':
raise InvalidArgumentError()
if self.trace:
print e.faultcode, e.faultstring
raise NotImplementedError()
else:
http_get(command.value, self._device.unr._getActionHeaders())
return
raise NotSupportedError()