Back to Contents


Change client behavior at runtime

Starting with FGLGWS 2.40, Genero Web Services generates a global record called tGlobalEndpointType to change the client behavior at runtime without the need to modify any generated client stub. If WS-Addressing 1.0 is enabled, the global generated record is called tWSAGlobalEndpointType.

Topics


Global Endpoint type definition

The following global type is used by any generated client stub to allow the programmer to change the client behavior at runtime.

TYPE tGlobalEndpointType RECORD # End point
	Address RECORD # Address
		Uri STRING # URI
	END RECORD,
	Binding RECORD # Binding
		Version STRING, # HTTP Version (1.0 or 1.1)
		Cookie STRING,	# Cookie to be set
		ConnectionTimeout INTEGER,# Connection timeout
		ReadWriteTimeout INTEGER # Read write timeout
	END RECORD
END RECORD
Description of variables:

Back to the top


WS-Addressing 1.0 Global Endpoint type definition

The following global type is used by any generated client stub where support of WS-Addressing 1.0 is enabled. It allows the programmer to change the client behavior at runtime, and to send additional WS-Addressing 1.0 reference parameters to a server.

If this global type is used in your main application, you must add the IMPORT XML instruction.

TYPE tWSAGlobalEndpointType RECORD # End point
	Address RECORD # Address
		Uri STRING, # URI 
		Parameters DYNAMIC ARRAY OF xml.DomDocument ATTRIBUTE(XMLNamespace="##any",XMLAny) # End point WSA reference parameters
	END RECORD,
	Binding RECORD # Binding
		Version STRING, # HTTP Version (1.0 or 1.1)
		Cookie STRING,	# Cookie to be set
		ConnectionTimeout INTEGER,# Connection timeout
		ReadWriteTimeout INTEGER # Read write timeout
	END RECORD
END RECORD
Description of variables:

Back to the top


Change server location

To change the server location at runtime, set the record Uri member with a valid URL of another service. All services must respect the same WSDL contract. If you let the variable unset, the client will connect to the server URL defined in the WSDL at code generation time.

Example:

  LET Calculator_CalculatorPortTypeEndpoint.Address.Uri = http://zeus:1111/mydomain/Calculator
You can assign this variable with a URL set in the FGLPROFILE (see Logical Service location).

If you are migrating from a version prior to 2.40, see the migration note.


Change the HTTP version protocol

To communicate with a service that speaks only a given version of HTTP, set the record Version member with the desired value. If you let the variable unset, the client will communicate in HTTP 1.1.

Example:

  LET Calculator_CalculatorPortTypeEndpoint.Binding.Version = "1.0"
If you don't want the request to be split into chunks, set the HTTP protocol version to 1.0.


Set an HTTP cookie

To send an HTTP cookie to the service, set the record Cookie member with the cookie value. If you let the variable unset, the client won't send any cookie.

Example:

  LET Calculator_CalculatorPortTypeEndpoint.Binding.Cookie = "MyCookie=AValue"
Unset that variable if you don't need the cookie to be sent anymore.


Set the connection timeout for a service

To change the default timeout value for the establishment of the connection to the service, set the record ConnectionTimeout member with the timeout value in seconds.

Example:

  LET Calculator_CalculatorPortTypeEndpoint.Binding.ConnectionTimeout = 15


Set the read and write timeout for a service

To change the default time of reading and writing to or from a service, set the record ReadWriteTimeout member with the time out value in seconds.

Example:

  LET Calculator_CalculatorPortTypeEndpoint.Binding.ReadWriteTimeout = 5