AddHeaderField

TwinCAT TIA
Network REST Client ActiveClients One client

ns=2;s=DEPRAG Smart/Network/HTTP/REST/ActiveClients/0/AddHeaderField

The command adds a new header element in the request.

Parameters:

    Value
    Value of the header to be added.

Returns:

    AddHeaderField
    A variable of the OpcMethodReturnValueVoid type. The method has no command-specific return values.

Examples:

In addition to the parameters already explained, the following variables must be created / transferred for the implementation in TwinCAT 3:

Beckhoff parameter:

    bHttpAddHeaderField
    A boolean variable that can be used to trigger the execution of the AddHeaderField command.
    OutputDataHttpAddHeaderField
    An instance of the ST_VoidOutputData structure into which the return value of the AddHeaderField method is written.
    hrHttpAddHeaderField
    This can be used to monitor the execution of the command. Error codes have the type HRESULT.
    fbHttpRest
    An instance of the "FB_HttpRest" function block supplied with the DEPRAG Smart library.
    sFieldName
    A string(255) variable specifying the name of the header element to be added in the request.
    sValue
    A String(255) variable containing the value of the header element to be added.
    sClientId
    A String(255) variable that specifies the client that should execute the command.
    ConnectionHandle
    "ConnectionHandle" received when establishing a connection between DEPRAG Smart Server and your OPC UA client.


VAR
   bHttpAddHeaderField   : BOOL;
   OutputDataHttpAddHeaderField: ST_VoidOutputData;
   hrHttpAddHeaderField  : HRESULT;
 
   fbHttpRest   : FB_HttpRest;
END_VAR

hrHttpAddHeaderField := fbHttpRest.AddHeaderField(
          bExecute   := bHttpAddHeaderField, 
          ConnectionHandle:= depragSmartConnection.ConnectionHandle,
          sFieldName   := 'TestHeaderField',
          sValue   := 'TestValueHeaderField',
          sClientId   := '0',
          OutputData  => OutputDataHttpAddHeaderField);
IF hrHttpAddHeaderField <> S_FALSE THEN 
    bHttpAddHeaderField := FALSE;
END_IF
                                                    

For examples and explanations regarding the calls of nodes via Siemens TIA Portal please refer to the sub-menu "Siemens TIA Portal" in section "Getting Started".