0
파이썬 SOAP 요청에 문제가 있습니다. 필자는 지금까지 두 개의 python SOAP 클라이언트 라이브러리 인 SUDS와 pysimplesoap을 테스트했습니다.Python SOAP 클라이언트 중첩 요청
from suds.client import Client
from pysimplesoap.client import SoapClient, SoapFault
# suds example
url = "http://www.webservicex.net/geoipservice.asmx?WSDL"
client = Client(url, cache=None)
print client.service.GetGeoIP((ip))
# pysimplesoap example
client = SoapClient(wsdl="http://www.webservicex.net/geoipservice.asmx?WSDL")
# call the remote method
response = client.GetGeoIP(("10.0.1.152"))
print response
잘 작동 모두를 나에게 예상되는 응답 제공 : 모두 다음과 같은 예를 들어 잘 작동
-<soap:Envelope>
-<soap:Body>
-<GetGeoIP>
<IPAddress>("10.0.1.152")</IPAddress>
</GetGeoIP>
</soap:Body>
</soap:Envelope>
: 사용자 인터페이스 SOAP 테스트와
{'GetGeoIPResult': {'ReturnCodeDetails': 'Success', 'IP': '10.0.1.152', 'ReturnCode': 1, 'CountryName': 'Reserved', 'CountryCode': 'ZZZ'}}
를 요청 다음과 같습니다 programm에
이제 문제는 SOAP를 통해 다른 WS에 연락해야하지만 작동하지 않는다는 것입니다. UI가 SOAP 프로그램으로는 (키와 토큰 비어있을 수 있습니다) 작품과 같습니다
-<soap:Envelope>
-<soap:Body>
-<getNews>
-<shrequest>
<data>{'account_number':202VA7, 'track_nr':1757345939}</data>
<function>getnewsdata</function>
<keys/>
<token/>
</shrequest>
</getNews>
</soap:Body>
</soap:Envelope>
하지만 내 코드가 작동하지 않습니다
url = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
client = Client(url, cache=None)
data = "{'account_number':202VA7, 'track_nr':1757345939}"
function = "getnewsdata"
keys = ""
token = ""
shrequest = [data,function,keys,token]
response = client.service.getNews(shrequest)
print response
를 내가 얻을 :
ValueError('Invalid Args Structure. Errors: %s' % errors)
ValueError: Invalid Args Structure. Errors:
어떻게 내 요청을 올바르게 중첩해야합니까?
: 202VA7'에'{ 'ACCOUNT_NUMBER': '202VA7'' – thefourtheye
응답을 주셔서 감사합니다,하지만 데이터를하지 않는 전체 문자열을, 때문에 문제. UI 프로그램에서 사용하는 매개 변수와 동일한 매개 변수이기 때문에 잘 작동합니다. – gulden