2016-11-16 60 views
1

我有一個本地開發框,我已經配置了Python。 另一臺服務器位於不同的網絡上。 SOA Web服務位於那裏。他們揭露了一項申請。如何從Python調用SOA Web服務上的方法?

應用程序中有執行多個操作的方法。像getAssetDetails(),getPhonenumberByContact()等。現在我想通過發送和接收XML來使用我本地使用python的這些方法。我真的需要訪問這些方法嗎?

我知道一些腳本,但初學者到這個領域。非常感謝。

回答

0
# Use Python 2.7 (64/32) depends on your system type 
# System 64, Python 64, suds 64 OR System 32, Python 32, suds 32 
# Install SUDS, pip install suds or download and install 
from suds.client import Client 

xml_request = '''your request xml''' 
def yourfunctionname(_xml_request): 
    url = 'http://wsdl_url?wsdl' 
    client = Client(url) 
    xml = Raw(_xml_main) 
    responsedata = (client.service.yourMethodName(__inject={'msg': xml})) 
    return respdata 

getData=yourfunctionname(xml_request) 
for i in getData: 
    print(i)