我也有SOAP問題。我正在嘗試使用帶SUDS的python實現一個接口。LexisNexis SUDS SOAP請求
我想創建一個應用程序來驗證和搜索在Python中的LexisNexis。所以如果有人知道這是否已經實施,那也會很棒。我已經搜索了很多東西,並找到了這個網站:https://hkn.eecs.berkeley.edu/~dhsu/hacks.shtml,這很好,但沒有SOAP代碼。
我迄今所做的:
我知道信封應該是這樣的:
<?xml version="1.0" encoding="utf-8"?>
<soap:Body xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<Authenticate xmlns="http://authenticate.authentication.services.v1.wsapi.lexisnexis.com">
<authId>id</authId>
<password>password</password>
</Authenticate>
</soap:Body>
我可以構建它(我認爲)
from suds.sax.element import Element
authentication = Element('Authenticate')
authentication.set('xmlns','http://authenticate.authentication.services.v1.wsapi.lexisnexis.com')
authId = Element('authId').setText('authId')
password = Element('password').setText('password')
authentication.append(authId)
authentication.append(password)
print authentication
返回:
<Authenticate xmlns="http://authenticate.authentication.services.v1.wsapi.lexisnexis.com">
<authId>authId</authId>
<password>password</password>
</Authenticate>
但是,我無法讓客戶工作。我給出這樣的信息:
模式
- Authentication.xsd
目標命名空間
- http://authenticate.authentication.services.v1.wsapi.lexisnexis.com
命名空間表
我可能這樣做不對,但我曾嘗試:
client = Client('http://authenticate.authentication.services.v1.wsapi.lexisnexis.com')
和
imp = Import('http://www.w3.org/2001/XMLSchema',
location='http://www.w3.org/2001/XMLSchema.xsd')
imp.filter.add('http://security.common.services.v1.wsapi.lexisnexis.com')
wsdl_url = 'http://authenticate.authentication.services.v1.wsapi.lexisnexis.com'
client = Client(wsdl_url, doctor=ImportDoctor(imp))
但是都導致
<urlopen error [Errno 8] nodename nor servname provided, or not known>
對不起,這是我第一次和LexisNexis api是相當粗糙的新手與SUDS。
非常感謝