eglx.http package

eglx.http defines an API for accessing details in HTTP messages. 

Table 1. Types
enumeration HttpMethod
   _GET = 1,
   POST = 2,
   _DELETE = 3,
   PUT = 4
end
externalType IHttp type NativeType 
   private constructor();
   function getRequest() returns (eglx.http.Request);
   function getResponse() returns (eglx.http.Response);
end
externalType HttpProxy extends HttpRest type NativeType
   constructor();
   constructor(serviceName string in);
end
externalType HttpRest extends IHttp type NativeType
   constructor();
   request Request{@Property {}};
   response Response{@Property {}};
   restType eglx.rest.ServiceType?;
end
handler Request 
   uri string?;  							// Complete URL, encoded for HTTP use
   method HttpMethod?;			// Method being invoked. Default is _GET.
   encoding Encoding?;			// As described in relation to the eglx.services package.
   charset string?;    		// character encoding; for example, "UTF-8".
   contentType string?;		// content type; for example, "text/html".
   headers dictionary?;		// each entry identifies a header name and content.
   body string?;							// content of transported message.end
You can use an EGL-specific HTTP request header to give a service timeout value, which specifies the maximum valid number of seconds that elapse between two events:
  • In the case of a Rich UI application, the events are when the EGL Rich UI proxy (on the application server) invokes a web service and when the proxy receives a response.
  • In the case of an EGL-generated Java requester, the events are when the EGL Runtime invokes a web service and when that code receives a response.
The header is edt.proxy.invocation.timeout. For example, the following code ends the service connection if the proxy does not receive a response in 6 seconds:
myBindingVar HttpRest?{@Resource {uri="binding:myEntry"}};
myBindingVar.request.headers = new dictionary;
myBindingVar.request.headers["edt.proxy.invocation.timeout"] = 6;
call MyInterfaceType.myOperation("My input")
   using myBindingVar
   returning to myResponseHandler
   onException myExceptionHandler;

If the response takes longer than the specified maximum, the EGL Runtime throws a ServiceInvocationException.

Setting a timeout is partly a matter of trial and error:
  • Take into account a variety of factors, such as local network traffic, internet traffic, and server response time. Those factors mean that two invocations of the same service are likely to take a different amount of time under different conditions.
  • Consider the nature of your application. If your code is waiting for a credit approval, you might set a high timeout value to avoid charging the user twice. If your code is making a bid in an online auction bid, you might set a low timeout value so that the user can make an additional bid quickly.
  • Use various timeout values.

The default is an infinite wait.

handler Response 
   status int?;
   statusMessage string?;
   encoding Encoding?;
   charset string?;
   contentType string?;
   headers dictionary?;
   body string?;
end
interface IHttp
   function getRequest() 
      returns 
      (eglx.http.Request);
   function getResponse() 
      returns 
      (eglx.http.Response);
end
HTTPLib external type
Table 2. Compatibility
Target Issue
Java See type-specific topics.
JavaScript See type-specific topics.