juniordevjim
juniordevjim

Reputation: 47

How can i copy the content of an XML document to a Soaprequest object in Delphi?

I want to copy the content of an XML document into a Soaprequest.How can i do this ?

procedure TForm4.Httprio2BeforeExecute(const MethodName: string;
  SOAPRequest: TStream);
  var FS: TFileStream;
  txmlheadtype1 : txmlheadtype;
    //oXML :TXMLDocument;
    xml : TStringlist;
    xml1 : TXMLDocument;
begin
end;

Upvotes: 0

Views: 143

Answers (1)

fpiette
fpiette

Reputation: 12292

Something like that (Out of my head, not tested at all):

procedure TMainForm.Httprio2BeforeExecute(
    const MethodName: string;
    SOAPRequest : TStream);
var
    XmlDoc : TXMLDocument;
const
    SomeFilename = 'MyDoc.xml';
begin
    XmlDoc := TXMLDocument.Create(nil);
    try
        XmlDoc.LoadFromFile(SomeFilename);
        SOAPRequest.Position := 0;
        XmlDoc.SaveToStream(SOAPRequest);
    finally
        XmlDoc.Free;
    end;
end;

Upvotes: 2

Related Questions