Declaring a variable to access a remote service

When you declare a variable to access a remote service or IBM i service program, you can use the Resource annotation to indicate that the binding detail for service access is in the resource binding section of the EGL deployment descriptor.

This example shows a variable declaration:
myService MyInterfaceType? {@Resource{bindingKey="MyBinding"}};

For details on the Resource annotation, see the topic named “EGL support for SOA.” Also available is a Language Reference entry for that annotation, which is in the eglx.lang package.

If you are accessing a SOAP service, note that a SOAP service invocation uses a new HTTP session, and no session information is retained from invocation to invocation. Your code cannot usefully call a service that is using session variables, which retain information from invocation to invocation.