Discuss this help topic in SecureBlackbox Forum

SOAP: Create or load SOAP message

To load an existing SOAP message from an XML document you need to use TElXMLSOAPMessage.LoadFromXML() method, for example:

C#:


TElXMLDOMDocument XMLDocument = new TElXMLDOMDocument();
TElXMLSOAPMessage SOAPMessage = new TElXMLSOAPMessage(null);
try
{
	SOAPMessage.CreateEnvelope(XMLDocument, SOAP_v1_1, "SOAP-ENV");
	// process message
	// ...
}
finally
{
	SOAPMessage.Dispose();
	XMLDocument.Dispose();
}

Delphi:

var
  XMLDocument : TElXMLDOMDocument;
  SOAPMessage : TElXMLSOAPMessage;
begin
  XMLDocument := TElXMLDOMDocument.Create;
  SOAPMessage := TElXMLSOAPMessage.Create(nil);
  try
    SOAPMessage.CreateEnvelope(XMLDocument, SOAP_v1_1, 'SOAP-ENV');
    // build message
  finally
    FreeAndNil(SOAPMessage);
    FreeAndNil(XMLDocument);
  end;
end;

To create an Envelope element, which identifies the XML document as a SOAP message, you need to use TElXMLSOAPMessage.CreateEnvelope() method, for example:

C#:


TElXMLDOMDocument XMLDocument = new TElXMLDOMDocument();
TElXMLSOAPMessage SOAPMessage = new TElXMLSOAPMessage(null);
try
{
	XMLDocument.LoadFromFile("filename.xml");
	SOAPMessage.LoadFromXML(XMLDocument);
	// process message
	...
}
finally
{
	SOAPMessage.Dispose();
	XMLDocument.Dispose();
}

Delphi:

var
  XMLDocument : TElXMLDOMDocument;
  SOAPMessage : TElXMLSOAPMessage;
begin
  XMLDocument := TElXMLDOMDocument.Create;
  SOAPMessage := TElXMLSOAPMessage.Create(nil);
  try
    XMLDocument.LoadFromFile('filename.xml');
    SOAPMessage.LoadFromXML(XMLDocument);
    // process message
  finally
    FreeAndNil(SOAPMessage);
    FreeAndNil(XMLDocument);
  end;
end;

How To articles about SOAP messages

Discuss this help topic in SecureBlackbox Forum