SK_CallWebService()

This function is used to call an XML web service via HTTP post.

Applies to:

Win32, Win64

Syntax-VB:

Declare Function SK_CallWebService(ByVal flags As Long, ByVal server As String, ByVal proxy As String, ByVal url As String, ByVal request As String, ByVal responseBuffer As String, ByRef responseBufferSize As Long) As Long

Syntax-C:

LONG SK_CallWebService(LONG flags, LPSTR server, LPSTR proxy, LPSTR url, LPSTR request, LPSTR responseBuffer, LPLONG responseBufferSize);

Arguments:

<flags> is a parameter with available options, defined as:

Flag

Value

Description

SK_SECURE_CONNECTION

32768

Attempt secure communication using SSL.

SK_SOCKETS_ONLY

65536

Only communicate using WinSock. Required if called from DLLMain.

<server> The name or IP address of the server to attempt communication. Set to "swk" or secure.softwarekey.com if using Instant SOLO.

<proxy> Optional.The name or IP address and port of any proxy server necessary to access the Internet. The format is server:port. Eg) proxy.consoft.com:80. This parameter is optional if WinInet is available on the PC. Pass an empty string to omit.

<url> The document path and name to use (must start with "/"). For Instant SOLO, use "/solo/webservices/XmlLicenseService.asmx/UpdateCheckS".

<request> The XML web service request.

<responseBuffer> The XML web service response.

<responseBufferSize> The size of the responseBuffer. This buffer should be pre-initialized to at least 16384characters (16KB).

Returns:

If successful a return value of SWKERR_NONE [0] is returned. Otherwise a value listed in SK_GetErrorStr() is returned.

If successful, the web service response will be copied to the responseBuffer output parameter.

Description:

This function is used to call an XML web service via HTTP post. Refer to the web service documentation for the required request/response format.

For XML web services using RSA public-key cryptography you can use SK_PrepareWebServiceRequest() to encrypt/sign the request and SK_PrepareWebServiceResponse() to decrypt/verify the responseBuffer.

IMPORTANT
Any custom character data must be ASCII or UTF-8 encoded or signature verification may fail with result code 5004.

Example:

Dim result As Long  

Dim request As String  

Dim responseBuffer As String * 16384

Dim responseBufferSize As Long

responseBufferSize = 16384

request = "<LicenseInfoCheck><LicenseID>12345</LicenseID><Password>password</Password></LicenseInfoCheck>"

result = SK_CallWebService(NO_FLAGS, "swk", "", "/solo/webservices/XmlLicenseService.asmx/InfoCheckS", request, responseBuffer, responseBufferSize

If result = SWKERR_NONE Then

    ...

See Also:

SK_PrepareWebServiceRequest(), and SK_PrepareWebServiceResponse()