getServerVariable(var: String): String;
The getServerVariable method of the JadeWebServiceProvider class returns the specified HTTP header information for your Web service request from the Internet Information Server (IIS).
As the var parameter is IIS-dependent and is therefore subject to change, refer to the ServerVariables function in your Internet Information Services (IIS) documentation for details.
The code fragment in the following example returns the IP address of the current Web service as determined by IIS.
JadeWebServiceProvider.getServerVariable('REMOTE_ADDR');
Common server environment variables, documented in the IIS documentation under the ServerVariables function, include those listed in the following table.
Variable | Returns… |
---|---|
HTTP_ACCEPT_LANGUAGE | A string describing the language to use for displaying content |
HTTP_USER_AGENT | A string describing the browser that sent the request |
HTTPS | ON if the request came in through a secure channel (SSL) or it returns OFF if the request is for a non-secure channel |
REMOTE_ADDR | IP address of the remote host making the request |
SERVER_NAME | Host name, DNS alias, or IP address of the server as it would appear in self-referencing URLs |
SERVER_PORT | Port number to which the request was sent |
URL | Base portion of the URL |
An exception is raised if this method is invoked from a server method.
The Web service provider requires the name of the method to invoke. In order to obtain this, the getServerVariable method is called. When the name that is retrieved is longer than 100 characters, the name is truncated to 100 characters. In addition, if the first character of the name is uppercase, it is changed to lowercase.
This name is used to determine the method to invoke when using non-wrapped document literal format messages. When the name does not meet the JADE method-naming requirements, the method invocation is likely to fail and a SOAP fault will be returned to the Web service consumer.
You can implement your own getServerVariable method (equivalent to this method in the JadeWebServiceProvider class) if you are using a
The following method returns the value of the Internet Server Application Programming Interface (ISAPI) variable (specified by the var parameter) associated with an Internet message that is received.
getServerVariable(var: String): String; // The request for the ISAPI variable var is built in the bin variable // The JadeInternetTCPIPConnection instance must exist and be connected constants NULL: Character = #00.Character; vars bin: Binary; connection: JadeInternetTCPIPConnection; begin if connection <> null and connection.state = Connection.Connected then if IsUnicodeSystem then bin := ("GSV" & NULL & var.trimBlanks & NULL).Binary._unicodeToAnsi; // unpublished Binary method else bin := ("GSV" & NULL & var.trimBlanks & NULL).Binary; endif; connection.writeBinary(bin); bin := connection.readBinary(0); endif; if IsUnicodeSystem then return bin.ansiToUnicode.trimBlanks; else return bin.String.trimBlanks; endif; end;
You can call this method only during the processing of a received Internet message and before the reply is sent. Accessing the method at any other time causes the process to wait indefinitely for the connection read or causes the message exchange process with the jadehttp library to be out of step.