I need to send a XML string to a SOAP server but Delphi (6) encode the XML
string which is not good. I have no control on the server so I must send
string. Is this possible to do with Delphi SOAP? Maybe used another datatype
for string?
Thanks.
I don't think that what you want to do is possible in
Delphi Soap.
You can do it it IndySoap - but it's not easy. There
is many problems relating to mixing DOM's, object ownership,
character sets, and schema declarations.
Grahame
Normally I would expect the server to handle the encoding. The server is
using an AXIS implementation and expects document/literal encoding which
Delphi probably cannot handle even when I set the soDocument flag - Delphi
simply encodes the content anyway. I could be wrong about the reason bit
without the workaround it wouldn't work.
I made changes to the HTTPRIO source to push the modified SoapRequest string
back into the request. My changes looked like this: (is there a better
way?)
procedure TRIO.DoBeforeExecute(const MethodName: string; Request: TStream);
var
StrStrm: TStringStream;
ReqW: WideString;
s : String;
begin
if Assigned(FOnBeforeExecute) then
begin
{ Ideally we would change the signature of this event to take a Stream.
The change to stream was necessary for attachment and encoding
support.
And it makes the event consistent.... However, for the sake of
backward compatibility.... }
StrStrm := TStringStream.Create('');
try
StrStrm.CopyFrom(Request, 0);
Request.Position := 0;
ReqW := StrStrm.DataString;
FOnBeforeExecute(MethodName, ReqW);
// my changes start here.....................
s := ReqW ;
Request.Size := Length(s);
Request.Seek(0,0);
Request.Write( PChar(s)^, Length(s));
Request.Seek(0,0);
Request.Position := 0;
finally
StrStrm.Free;
end;
{ NOTE: We ignore the var WideString passed in... ???? }
end;
end;
In my calling code, I call the service and pass "XML" as the parameter...
something like:
lookupservice := HTTPRIO1 as lookupservicesoap;
memo1.Lines.text := lookupservice.ProcessNameListMessage( 'XML' ) ;
then in the before execute I used replace the "XML" with the actual
parameter, thus avoiding the encoding....
SoapRequest := AnsiReplaceText( SoapRequest, 'XML', XmlNodesListString );
Thanks,
AJ
"Hank Scheck" <nos...@icc.com> wrote in message
news:3ffc1084$1...@newsgroups.borland.com...