conflicting Content-Type headers

stella - September 21, 2009 - 14:14
Project:SOAP Server
Version:6.x-1.x-dev
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed
Description

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

AttachmentSize
soap_server_xml_content_type_header.patch432 bytes

#1

ilo - November 6, 2009 - 13:48
Status:needs review» reviewed & tested by the community

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

stella - November 6, 2009 - 15:37

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

ilo - November 6, 2009 - 19:47
Status:reviewed & tested by the community» needs review

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.

AttachmentSize
583506_soap_server_headers.patch 538 bytes

#4

ilo - November 10, 2009 - 23:02
Status:needs review» fixed

Committed to DRUPAL-6--1.

Thanks stella for the report and the detective task :)

#5

System Message - November 24, 2009 - 23:10
Status:fixed» closed

Automatically closed -- issue fixed for 2 weeks with no activity.

 
 

Drupal is a registered trademark of Dries Buytaert.