Toch maar eens de code doorgestapt - het zit binnen de Indy code. In SOAPHTTPTrans staat het volgende codeblok (vanaf regel 658):
Code:
if FBindingType = btMIME then
begin
ContentHeader := Format(ContentHeaderMIME, [FMimeBoundary]);
ContentHeader := Format(ContentTypeTemplate, [ContentHeader]);
HttpAddRequestHeaders(Request, PChar(MIMEVersion), Length(MIMEVersion), HTTP_ADDREQ_FLAG_ADD);
{ SOAPAction header }
{ NOTE: It's not really clear whether this should be sent in the case
of MIME Binding. Investigate interoperability ?? }
if not (soNoSOAPActionHeader in FInvokeOptions) then
begin
ActionHeader:= GetSOAPActionHeader;
HttpAddRequestHeaders(Request, PChar(ActionHeader), Length(ActionHeader), HTTP_ADDREQ_FLAG_ADD);
end;
end else { Assume btSOAP }
begin
{ SOAPAction header }
if not (soNoSOAPActionHeader in FInvokeOptions) then
begin
ActionHeader:= GetSOAPActionHeader;
HttpAddRequestHeaders(Request, PChar(ActionHeader), Length(ActionHeader), HTTP_ADDREQ_FLAG_ADD);
end;
if UseUTF8InHeader then
ContentHeader := Format(ContentTypeTemplate, [ContentTypeUTF8])
else
ContentHeader := Format(ContentTypeTemplate, [ContentTypeNoUTF8]);
end;
FBindingType <> MIME, en UseUTF8InHeader = true, dus:
Code:
ContentHeader := Format(ContentTypeTemplate, [ContentTypeUTF8])
Dat is in SOAPConst.pas gedefinieerd als:
Code:
ContentTypeUTF8 = 'text/xml; charset="utf-8"'; { Do not localize }
Let wel - dit is Indy10 onder Delphi2007....
In de laatste Delphi-versie 10.2 (Tokyo) is dat in elk geval verbeterd:
Code:
function THTTPReqResp.GetSOAPActionHeader: string;
begin
if (SoapAction = '') then
Result := SHTTPSoapAction + ':'
else if (SoapAction = '""') then
Result := SHTTPSoapAction + ': ""'
else
Result := SHTTPSoapAction + ': ' + '"' + SoapAction + '"';
end;
function THTTPReqResp.GetContentType: string;
begin
Result := '';
if not (wnoSOAP12 in GetWebNodeOptions) then
begin
if UseUTF8InHeader then
Result := ContentTypeUTF8
else
Result := ContentTypeNoUTF8;
end
else
begin
if UseUTF8InHeader then
Result := Format(ContentTypeWithActionNoLabelFmt, [ContentType12UTF8, GetSOAPAction])
else
Result := Format(ContentTypeWithActionNoLabelFmt, [ContentType12NoUTF8, GetSOAPAction]);
end;
end;
en
Code:
ContentType12UTF8 = 'application/soap+xml; charset=utf-8'; { Do not localize }
ContentType12NoUTF8 = 'application/soap+xml'; { Do not localize }
het ziet er dus naar uit dat de ene remote applicatie wel met text/xml overweg kan (SOAP 1.0, SOAP 1.1) maar de ander niet (SOAP 1.2)….
De beste oplossing is uiteraard over te gaan naar de nieuwe Delphi versie - dat wordt al aan gewerkt maar dat is een op zichzelf staand project, gezien de impact die dat op de code heeft....In de tussentijd moet dit binnen de Indy code worden opgelost....
(Ander issue: de remote applicatie verwacht "soap-xml" - maar Indy geeft "soap+xml". Wat is correct?)
Bookmarks