HttpClientAbstract
- Namespace
- ZAux
- Implements
FUNCTION_BLOCK ABSTRACT HttpClientAbstract IMPLEMENTS ZCore.IHttpClient, ZCore.IObject, ZCore.IError
Used to send HTTP requests and receiving HTTP responses from a resource identified by a URI.
Note
The TwinCAT implementation of HttpClient, additionally to Zeugwerk Framework, requires an installation of Zeugwerk HttpClientProxy on a computer in your local network and an ADS route to this server. For questions, contact the support.
Properties
Busy
PROPERTY Busy : BOOL
This property returns TRUE if the object is Busy executing a sequence or still in its
initialization phase (if applicable). It returns FALSE if the object is Idle or in an
Error state.
Use State to find out if the object is busy executing its initialization phase,
or it is busy performing an actual sequence.
Property Value
- BOOL
Done
PROPERTY Done : BOOL
If the object is in idle state (often mentioned as "the object is not busy and not on error"),
this is indicated by this property returning TRUE.
Property Value
- BOOL
StatusCode
PROPERTY StatusCode : ZCore.HttpClientStatusCode
This property returns the statuscode of a server's response. The value is only valid if Busy=FALSE.
Property Value
Methods
GetAsync
METHOD GetAsync (
[input] startToken : ZCore.IStartToken,
[input] uri : STRING(ZCore.ParameterList.MaxHttpClientUriLength),
[input] responseBuffer : ZCore.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
startTokenIStartTokenuriSTRING(ZCore.ParameterList.MaxHttpClientUriLength)responseBufferZPointerresponseSizeUDINT
PostAsync
METHOD PostAsync (
[input] startToken : ZCore.IStartToken,
[input] uri : STRING(ZCore.ParameterList.MaxHttpClientUriLength),
[input] payloadBuffer : ZCore.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
startTokenIStartTokenuriSTRING(ZCore.ParameterList.MaxHttpClientUriLength)payloadBufferZPointerpayloadSizeUDINT
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
TraceErrorStack
METHOD TraceErrorStack (
[input] trace : ZCore.IErrorTrace)
This method is used internally when recording an error trace.
Inputs
traceIErrorTrace