SetProxy

TwinCAT TIA
Network REST Client ActiveClients One client

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

Sets the proxy server. The proxy server is used for all requests to the API.

Parameters:

    Host
    IP or DNS address of the proxy server.
    Port
    Port of the proxy server.
    UseDefaultCredentials
    Specifies whether to use the system credentials when logging in to the proxy server or to specify the user name and password itself.
    UserName
    User name used to authenticate with the specified proxy server.
    Password
    Password used to authenticate with the specified proxy server.

Returns:

    SetProxy
    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:

    bHttpSetProxy
    A boolean variable that can be used to trigger the execution of the SetProxy command.
    OutputDataHttpSetProxy
    An instance of the ST_VoidOutputData structure into which the return value of the SetProxy method is written.
    hrHttpSetProxy
    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.
    sHost
    A string(255) variable in which the IP or DNS address of the proxy server is stored.
    nPort
    A DINT variable containing the port of the proxy server.
    bBypassProxyOnLocal
    A boolean variable by which the proxy server can be bypassed for local addresses.
    bUseDefaultCredentials
    A boolean variable for choosing between using the system credentials and entering a username and password.
    sUserName
    A string(255) variable that can be used to store a username for authentication with the proxy server.
    sPassword
    A string(255) variable that can be used to store a password for authentication with the proxy server.
    sDomain
    A String(255) variable for the proxy server domain.
    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
 bHttpSetProxy     : BOOL;
 OutputDataHttpSetProxy   : ST_VoidOutputData;
 hrHttpSetProxy    : HRESULT;
 
   fbHttpRest   : FB_HttpRest;
END_VAR

hrHttpSetProxy := fbHttpRest.SetProxy( 
       bExecute    := bHttpSetProxy,
       ConnectionHandle   := depragSmartConnection.ConnectionHandle,
       sHost     := 'TestHost',
       nPort     := 1234,
       bBypassProxyOnLocal  := TRUE,
       bUseDefaultCredentials := TRUE,
       sUserName    := 'User1',
       sPassword    := 'Password123',
       sDomain     := 'http://OpcUa.deprag.com/',
       sClientId    := '0',
       OutputData    => OutputDataHttpSetProxy);
IF hrHttpSetProxy <> S_FALSE THEN
 bHttpSetProxy := 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".