Table of Contents

IHttpClient

Namespace
ZCore
Extends
Inherited Properties
Inherited Methods
INTERFACE IHttpClient EXTENDS ZCore.IObject, ZCore.IError

Used to send HTTP requests and receiving HTTP responses from a resource identified by a URI.

Properties

StatusCode

PROPERTY StatusCode : HttpClientStatusCode

This property returns the statuscode of a server's response. The value is only valid if Busy=FALSE.

Property Value

HttpClientStatusCode

Methods

GetAsync

METHOD GetAsync (
 [input] startToken : IStartToken,
 [input] uri : STRING(ParameterList.MaxHttpClientUriLength),
 [input] responseBuffer : ZPointer,
 [input] responseSize : UDINT)

Send a GET request to the specified Uri as an asynchronous operation. Use Busy property and its derivatives to retrieve the status of the asynchronous operation. As soon as Busy=FALSE the StatusCode method can be used to check if the request was successful (StatusCode=200) or not. The response of the GET request is written to the responseBuffer, which is passed as a parameter to this method. Make sure that the buffer size is big enough for the response, which is returned by the server.

Inputs

startToken IStartToken
uri STRING(ParameterList.MaxHttpClientUriLength)
responseBuffer ZPointer
responseSize UDINT

PostAsync

METHOD PostAsync (
 [input] startToken : IStartToken,
 [input] uri : STRING(ParameterList.MaxHttpClientUriLength),
 [input] payloadBuffer : ZPointer,
 [input] payloadSize : UDINT)

Send a POST request to the specified Uri as an asynchronous operation. Use Busy property and its derivatives to retrieve the status of the asynchronous operation. As soon as Busy=FALSE the StatusCode method can be used to check if the request was successful (StatusCode=200) or not. The payload that should be send to the server is is passed as a parameter to this method.

Inputs

startToken IStartToken
uri STRING(ParameterList.MaxHttpClientUriLength)
payloadBuffer ZPointer
payloadSize UDINT

SetHttpClientProxy

METHOD SetHttpClientProxy (
 [input] on : BOOL,
 [input] target : STRING)

This method is used to set a server, which acts as a proxy for the PLC. Refer to the implementation to get more details about this.

Inputs

on BOOL

Use proxy (on:=TRUE) or try to use native mode (on:=FALSE)

target STRING