@@ -15,26 +15,27 @@ defmodule Soap.Request.Headers do
1515 "1.2" => "application/soap+xml; charset=utf-8" ,
1616 }
1717
18- @ spec build ( map ( ) , String . t ( ) , list ( ) ) :: list ( )
19- def build ( wsdl , operation , custom_headers ) do
18+ @ spec build ( map ( ) , String . t ( ) , list ( ) , String . t ( ) ) :: list ( )
19+ def build ( wsdl , operation , custom_headers , body ) do
2020 wsdl
2121 |> extract_soap_action_by_operation ( operation )
22- |> extract_headers ( custom_headers , wsdl )
22+ |> extract_headers ( custom_headers , wsdl , body )
2323 end
2424
2525 @ spec extract_soap_action_by_operation ( map ( ) , String . t ( ) ) :: String . t ( )
2626 defp extract_soap_action_by_operation ( wsdl , operation ) do
2727 Enum . find ( wsdl [ :operations ] , fn x -> x [ :name ] == operation end ) [ :soap_action ]
2828 end
2929
30- @ spec extract_headers ( String . t ( ) , list ( ) , map ( ) ) :: list ( )
31- defp extract_headers ( soap_action , [ ] , wsdl ) , do: base_headers ( soap_action , wsdl )
32- defp extract_headers ( _ , custom_headers , _ ) , do: custom_headers
30+ @ spec extract_headers ( String . t ( ) , list ( ) , map ( ) , String . t ( ) ) :: list ( )
31+ defp extract_headers ( soap_action , [ ] , wsdl , body ) , do: base_headers ( soap_action , wsdl , body )
32+ defp extract_headers ( _ , custom_headers , _ , _ ) , do: custom_headers
3333
34- @ spec base_headers ( String . t ( ) , map ( ) ) :: list ( )
35- defp base_headers ( soap_action , wsdl ) do
34+ @ spec base_headers ( String . t ( ) , map ( ) , String . t ( ) ) :: list ( )
35+ defp base_headers ( soap_action , wsdl , body ) do
3636 uri = URI . parse ( wsdl [ :endpoint ] )
3737 [
38+ { "Content-Length" , byte_size ( body ) } ,
3839 { "Content-Type" , Map . get ( @ content_types , wsdl [ :soap_version ] ) } ,
3940 { "User-Agent" , "strong-soap/3.4.0" } ,
4041 { "Accept" , "text/html,application/xhtml+xml,application/xml,text/xml;q=0.9,*/*;q=0.8" } ,
0 commit comments