Trying to access this soap webservice using python requests : http://bsestarmfdemo.bseindia.com/MFUploadService/MFUploadService.svc?WSDL
Here is my request :
import requests
url="http://bsestarmfdemo.bseindia.com/MFUploadService/MFUploadService.svc?WSDL"
#headers = {'content-type': 'application/soap+xml'}
headers = {'content-type': 'application/soap+xml'}
body = """<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:tem="http://tempuri.org/">
<soap:Header/>
<soap:Body>
<tem:getPassword>
<!--Optional:-->
<tem:UserId>1003201</tem:UserId>
<!--Optional:-->
<tem:MemberId>10032</tem:MemberId>
<!--Optional:-->
<tem:Password>xxxxxxxx</tem:Password>
<!--Optional:-->
<tem:PassKey>xxxxxx123</tem:PassKey>
</tem:getPassword>
</soap:Body>
</soap:Envelope>"""
response = requests.post(url,data=body,headers=headers)
print (response.content)
This the response :
b'
Sendera:ActionNotSupported
The message with Action \'\' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).'
If I understand correctly, I probably need to set the action in the request, but can't figure out how to do that. I'm entirely new to soap in python, please suggest how to fix this. Thanks!
Just add the SOAPAction onto the header, for example:
headers = {'Content-type': 'text/xml;charset=UTF-8',
'SOAPAction': 'http://google.com/ISearchService/Find'
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With