Permalink
Browse files

revert SOAP response MIME type to "text/xml"

Some Microsoft tools don't handle "application/xml" as the MIME type for
SOAP responses. Revert the change from "text/xml" made in commit 15454bc.

Also perform some minor cleanup in yaws_soap_lib and yaws_soap12_lib.
  • Loading branch information...
1 parent ea6c5b1 commit 9e6c9e174d7ff1b3b089ea69cdf00fd74e29aea7 @vinoski vinoski committed Jun 1, 2012
Showing with 12 additions and 15 deletions.
  1. +1 −1 src/yaws_rpc.erl
  2. +9 −10 src/yaws_soap12_lib.erl
  3. +2 −4 src/yaws_soap_lib.erl
View
2 src/yaws_rpc.erl
@@ -355,7 +355,7 @@ send(_Args, StatusCode, Payload, AddOnData, RpcType) ->
{header, {content_length, lists:flatlength(Payload)}}] ++ AddOnData.
content_hdr(json, Payload) -> {content, "application/json", Payload};
-content_hdr(_, Payload) -> {content, "application/xml", Payload}.
+content_hdr(_, Payload) -> {content, "text/xml", Payload}.
%% FIXME would like to add charset info here !!
encode_handler_payload({Xml,[]}, _ID, soap_dime) ->
View
19 src/yaws_soap12_lib.erl
@@ -522,17 +522,16 @@ inets_request(URL, Action, Request, Options, Headers, ContentType) ->
ibrowse_request(URL, Action, Request, Options, Headers, ContentType) ->
case start_ibrowse() of
ok ->
- case Action of
- undefined ->
- NewHeaders = [{"Content-Type", ContentType} | Headers];
- _ ->
- NewHeaders = [{"Content-Type", ContentType}, {"SOAPAction", Action} | Headers]
- end,
- NewOptions = Options,
- %%[{content_type, "text/xml; encoding=utf-8"} | Options],
- case ibrowse:send_req(URL, NewHeaders, post, Request, NewOptions) of
+ NewHeaders = [{"Content-Type", ContentType} |
+ case Action of
+ undefined ->
+ Headers;
+ _ ->
+ [{"SOAPAction", Action} | Headers]
+ end],
+ case ibrowse:send_req(URL, NewHeaders, post, Request, Options) of
{ok, Status, ResponseHeaders, ResponseBody} ->
- {ok, list_to_integer(Status), ResponseHeaders,ResponseBody};
+ {ok, list_to_integer(Status), ResponseHeaders, ResponseBody};
{error, Reason} ->
{error, Reason}
end;
View
6 src/yaws_soap_lib.erl
@@ -471,11 +471,9 @@ ibrowse_request(URL, SoapAction, Request, Options, Headers, ContentType) ->
ok ->
NewHeaders = [{"Content-Type", ContentType},
{"SOAPAction", SoapAction} | Headers],
- NewOptions = Options,
- %%[{content_type, "text/xml; encoding=utf-8"} | Options],
- case ibrowse:send_req(URL, NewHeaders, post, Request, NewOptions) of
+ case ibrowse:send_req(URL, NewHeaders, post, Request, Options) of
{ok, Status, ResponseHeaders, ResponseBody} ->
- {ok, list_to_integer(Status), ResponseHeaders,ResponseBody};
+ {ok, list_to_integer(Status), ResponseHeaders, ResponseBody};
{error, Reason} ->
{error, Reason}
end;

0 comments on commit 9e6c9e1

Please sign in to comment.