I'm setting up a soap request. I get it so fare that the xml is perfect, but the problem is the header. My SOAP-service wants in the header "text/xml; charset=utf-8" but savon makes "soap+xml; charset=utf-8" of it. When I try to change the header, it ignores my code.
Here's my code:
client = Savon::Client.new do
wsdl.document = "someservice.svc?wsdl"
http.auth.basic user, password
http.headers["Content-Type"] = "text/xml; charset=utf-8"
http.headers["Content-Encoding"] = "gzip"
end
response = client.request :ser, "ACKUserServiceReadRequest" do |soap|
soap.version = 2
soap.namespaces.merge!({
"xmlns:ser" => "http://schemas.microsoft.com/dynamics/2008/01/services",
"xmlns:ent" => "http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKeyList",
"xmlns:ent1" => "http://schemas.microsoft.com/dynamics/2006/02/documents/EntityKey",
"xmlns:env" => "http://schemas.xmlsoap.org/soap/envelope/"
})
soap.body = "<ent:EntityKeyList><ent1:EntityKey><ent1:KeyData><ent1:KeyField><ent1:Field>NetworkAlias</ent1:Field><ent1:Value>MichaelA</ent1:Value></ent1:KeyField></ent1:KeyData></ent1:EntityKey></ent:EntityKeyList>"
endWhen I execute he adds the content-encoding but doesn't change the content-length. This output I get: SOAPAction: "ACKUserServiceReadRequest", Content-Type: application/soap+xml;charset=UTF-8, Content-Length: 734, Content-Encoding: gzip