我想用Python发送以下请求。
背景:我正在使用Zeep程序包,除了下面的一个操作(GetPermissions)以外,其他所有其他操作都运行良好。
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://www.sq.com/R/Get">
<soapenv:Header/>
<soapenv:Body>
<get:GetPermissions>
<!--Optional:-->
<get:msg>
<!--Optional:-->
<Item>
<IsPublic>false</IsPublic>
<ReturnStratSim>true</ReturnStratSim>
</Item>
<!--Optional:-->
<CIQUserId>388153</CIQUserId>
<!--Optional:-->
<Debug>false</Debug>
<!--Optional:-->
<IncludeTestingStatus>false</IncludeTestingStatus>
</get:msg>
</get:GetPermissions>
</soapenv:Body>
</soapenv:Envelope>
尝试以下代码时:
client_Get=Client(wsdl=Getwsdl)
RequestFilterMsg={
'CIQUserId':388153,
'DEBUG':True,
'IncludeTestingStatus':True
}
response_GetPortfolioPermissions = client_Get.service.GetPortfolioPermissions(RequestFilterMsg)
print("MSG1:")
print(response_GetPortfolioPermissions)
我得到的是:-
MSG1:
{
'Items': None,
'DebugData': None,
'RequestResult': {
'ErrorResultElements': {
'ErrorResultElement': [
{
'HumanReadableMessage': 'Provided CIQUserId: 0 is invalid',
'StatusCode': 303
}
]
},
'Item': None,
'WasSuccessful': False
}
}
与通过以下请求相同:-
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:get="http://www.sq.com/R/Get">
<soapenv:Header/>
<soapenv:Body>
<get:GetPortfolioPermissions>
<!--Optional:-->
<get:msg>
</get:msg>
</get:GetPortfolioPermissions>
</soapenv:Body>
</soapenv:Envelope>