У меня также проблемы с SOAP. Я пытаюсь реализовать интерфейс с использованием Python с SUDS.
Я пытаюсь создать приложение, которое проверяет подлинность и выполняет поиск LexisNexis на python. Так что, если кто-нибудь знает, было ли это уже реализовано, это тоже было бы здорово. Я поискал довольно много предложений и нашел этот сайт: 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>
Извините за то, что я новичок в SUDS, это мой первый раз, и API LexisNexis довольно грубый.
Огромное спасибо