Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP error 415: content type error #79

Open
packnologyusa opened this issue Sep 8, 2021 · 1 comment
Open

HTTP error 415: content type error #79

packnologyusa opened this issue Sep 8, 2021 · 1 comment

Comments

@packnologyusa
Copy link

Hi, I get the following errors when calling a locally hosted WCF service. Hope you can help. When I use Postman to call the service I have to add content-type application/soap+xml to the headers, so I'm guessing that's the problem. How do I get suds to use that header?

Traceback (most recent call last):
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\transport\http.py", line 78, in send
fp = self.u2open(u2request)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\transport\http.py", line 119, in u2open
return url.open(u2request, timeout=tm)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 640, in http_response
response = self.parent.error(
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 502, in _call_chain
result = func(*args)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 415: Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\client.py", line 652, in send
reply = transport.send(request)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\transport\http.py", line 178, in send
return HttpTransport.send(self, request)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\transport\http.py", line 86, in send
raise TransportError(e.msg, e.code, e.fp)
suds.transport.TransportError: Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\Users...\OneDrive - Packnology, Inc\Development\Projects\Packwise\AWS Greengrass\test.py", line 6, in
result = client.service.GetMachineRodsPM()
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\client.py", line 559, in call
return client.invoke(args, kwargs)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\client.py", line 618, in invoke
result = self.send(soapenv)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\client.py", line 664, in send
result = self.failed(binding, e)
File "C:\Users...\AppData\Local\Programs\Python\Python38-32\lib\site-packages\suds\client.py", line 726, in failed
raise Exception((status, reason))
Exception: (415, "Cannot process the message because the content type 'text/xml; charset=utf-8' was not the expected type 'application/soap+xml; charset=utf-8'.")

@cackharot
Copy link
Owner

@packnology https://suds-py3.readthedocs.io/en/latest/#options client object supports header to pass extra headers maybe you can try that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants