conflicting Content-Type headers
| Project: | SOAP Server |
| Version: | 6.x-1.x-dev |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed |
First of all, thanks for such a great module! I've successfully created my own SOAP webservice using the soap_server and services modules. It's all working great except for one thing, which not all soap clients are able to cope with. The problem is there is more than one "Content-Type" header created, and they have conflicting definitions.
The nuSOAP library creates a text/xml Content-Type header, however Drupal also creates a Content-Type header of type text/html in _drupal_bootstrap_full(). As the nuSOAP library doesn't use the drupal_set_header() function to set the header, the header set by Drupal during bootstrap isn't overridden by soap_server and so we end up with two different definitions. Some of the clients connecting in just look at the first Content-Type definition, which will always be text/html as that's set first during bootstrap.
The attached patch adds in a call to drupal_set_header() which allows both of the defined Content-Type lines to be of type text/xml. It doesn't prevent the header being sent twice, but it is at least one step closer and fixes the problem for all of my soap clients.
Cheers,
Stella
| Attachment | Size |
|---|---|
| soap_server_xml_content_type_header.patch | 432 bytes |

#1
Oh, I just got confused with other issue regarding soap headers, and now I realize they are totally different. Thanks stella, didn't notice the header stuff.
#2
though, i think the patch might need a bit more work, as iirc it produces the wrong content-type header on the list of services page.
#3
I didn't get that error, but I got other when requesting for the html content on services/soap (a list of services description).
Ok, limiting the header to only post requests on services/soap endpoint (clearly a soap request). Wsdl request (http://host/services/soap&wsdl) returns appropiate content type, but charset in use is: charset=ISO-8859-1 (corresponding to charset encoding of the returned xml).
Other implementation would be to check if soap_server() returns xml and only set the header there.. not sure which one applies better, because anyway we will have two content type headers.
#4
Committed to DRUPAL-6--1.
Thanks stella for the report and the detective task :)
#5
Automatically closed -- issue fixed for 2 weeks with no activity.