Here is the WSDL I'm using: http://sprws.sprich.com/sprws/StockCheck.php?wsdl Using SoapUI the input looks like this:
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:stoc="http://sprws.sprich.com/sprws/StockCheck.php?wsdl">
<soapenv:Header/>
<soapenv:Body>
<stoc:StockCheck soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<input xsi:type="stoc:StockCheckInputs">
<!--You may enter the following 10 items in any order-->
<GroupCode xsi:type="xsd:string">[Removed]</GroupCode>
<UserID xsi:type="xsd:string">[Removed]</UserID>
<Password xsi:type="xsd:string">[Removed]</Password>
<Action xsi:type="xsd:string">F</Action>
<CustNumber xsi:type="xsd:string"></CustNumber>
<DcNumber xsi:type="xsd:string"></DcNumber>
<ItemNumber xsi:type="xsd:string">HAM105007CT</ItemNumber>
<SortBy xsi:type="xsd:string">A</SortBy>
<MinInFullPacks xsi:type="xsd:string"></MinInFullPacks>
<AvailableOnly xsi:type="xsd:string">Y</AvailableOnly>
</input>
</stoc:StockCheck>
</soapenv:Body>
</soapenv:Envelope>
How do I recreate this in Python?
So far I have:
from zeep import Client
from zeep import xsd
client = Client(wsdl='http://sprws.sprich.com/sprws/StockCheck.php?wsdl')
result = client.service.StockCheck(GroupCode='[Removed]', UserID='[Removed]', Password='[Removed]', ItemNumber='HAM105007CT', Action='F', SortBy='A')
print(result)
I want to get the stock for a specific item number, but have no idea of the syntax to use to submit my request.
I get an ERR_CONNECTION_TIMED_OUT error when trying to open the WSDL, but based on the comment you posted, the operation method looks like this:
StockCheck(input: ns0:StockCheckInputs) -> return: ns0:StockCheckRsults
But you are trying to make a call like this:
client.service.StockCheck(GroupCode='[Removed]', UserID='[Removed]', Password='[Removed]', ItemNumber='HAM105007CT', Action='F', SortBy='A')
All of those parameters need to be wrapped inside an object of type ns0:StockCheckInputs
for the call to work.
And also, the service and the WSDL need to be accessible, in case I'm not the only one who can't open that address.