Discuss this help topic in SecureBlackbox Forum

SOAP: Add parameters to SOAP message

To add parameters to the SOAP message operation you would need to use TElXMLSOAPClient.AddParameter() method, which adds parameter of type TElXMLSOAPCustomParameter or of derived class. Alternatively you can use one of helper methods of TElXMLSOAPClient class like AddIntegerParameter(), AddStringParameter(), AddBase64BinaryParameter() etc., which add objects of specific type.

To add complex parameters you would need to use TElXMLSOAPClient.AddCompoundParameter() method and then add scalar values and/or compound values into it.
Also you can create a descendant of TElXMLSOAPCompoundParameter class to replicate your complex parameter structure. The procedure is described in a separate how-to article.

C#:


SOAPClient.AddIntegerParameter("IntegerParam", "http://...", 1);

k = SOAPClient.AddCompoundParameter("ComplexParam1", "http://...");
CompoundParameter = TElXMLSOAPCompoundParameter(SOAPClient.get_Parameters(k));

k2 = CompoundParameter.AddCompound("ComplexParam2", "http://...");
CompoundParameter2 = TElXMLSOAPCompoundParameter(CompoundParameter.get_Parameters(k2));

CompoundParameter2.AddStringParameter("StringParam", "http://...", "text value");

Delphi:

SOAPClient.AddIntegerParameter('IntegerParam', 'http://...', 1);

k := SOAPClient.AddCompoundParameter('ComplexParam1', 'http://...');
CompoundParameter := TElXMLSOAPCompoundParameter(SOAPClient.Parameters[k]);

k2 := CompoundParameter.AddCompound('ComplexParam2', 'http://...');
CompoundParameter2 := TElXMLSOAPCompoundParameter(CompoundParameter.Parameters[k2]);

CompoundParameter2.AddStringParameter('StringParam', 'http://...', 'text value');

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/">
    <OperationName xmlns=”http://...”>
      <IntegerParam>1</IntegerParam>
      <ComplexParam1>
        <ComplexParam2>
           <StringParam>text value</StringParam>
        </ComplexParam2>
      </ComplexParam1>
    </OperationName>
  </soap:Body>
</soap:Envelope>

How To articles about SOAP client

Discuss this help topic in SecureBlackbox Forum