Discuss this help topic in SecureBlackbox Forum

SOAP: Create SOAP message

To create new SOAP message using SOAP client component (TElXMLSOAPClient) you need to setup its SOAPVersion, OperationName and OperationNamespaceURI properties with desired SOAP version and operation element name. Additionally, you may tune-up the generated SOAP message using SOAPPrefix and MessageNamespaces properties, that let you set custom prefix for SOAP element and define additional prefixes and namespace URIs.

After that you need to setup parameters and call GenerateMessage() method to generate new SOAP message.

C#:


TElXMLSOAPClient SOAPClient = new TElXMLSOAPClient(null);
SOAPClient.SOAPVersion = SBXMLSOAPCore.__Global.SOAP_v1_1;
SOAPClient.SOAPPrefix = "soap";
SOAPClient.OperationName = "GetData";
SOAPClient.OperationNamespaceURI = "url";

SOAPClient.AddStringParameter("Query", "url", "Test");
SOAPClient.GenerateMessage();

Delphi:

SOAPClient := TElXMLSOAPClient.Create(nil);
SOAPClient.SOAPVersion := SOAP_v1_1;
SOAPClient.SOAPPrefix := 'soap';
SOAPClient.OperationName := 'GetData';
SOAPClient.OperationNamespaceURI := 'url';

SOAPClient.AddStringParameter('Query', 'url', 'Test');
SOAPClient.GenerateMessage();

The resulting SOAP message will look like

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xml="http://www.w3.org/XML/1998/namespace">
  <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
    <GetData xmlns="url">
      <Query>Test</Query>
    </GetData>
  </soap:Body>
</soap:Envelope>

After the message is created, it can be signed.

How To articles about SOAP client

Discuss this help topic in SecureBlackbox Forum