SOAP Callback Operations for Web Services Call-Out
When a Uniface component activates a web service, the SOAP connector is responsible for preparing and sending the request, and receiving and interpreting the response. Using the callback operations for call-out, you can enable additional processing just before the SOAP message is sent, or just after it is received. For example, you can provide intelligent error handling for SOAP faults, or encrypt or decrypt the content.
Note: The callback operations for call-out are only available in the U2.0 SOAP connector.
- SOAP_CALLOUT_PRE—called before a SOAP request for a web service is actually sent. It can be used to encrypt content and modify the SOAP envelope sent to the target web service.
- SOAP_CALLOUT_POST—called after the SOAP response from a web service is received. It can be used to examine the SOAP envelope and header, decrypt encrypted content, and modify the SOAP header that is passed to the calling component.
These operations can be implemented in one or more Uniface services, which must be specified
in the assignment file of the calling application. You can specify callback services that are
common to all web services using the SOAP connector option callback
(USYS$SOP_PARAMS = callback
). You can specify callback services that are specific
to a web service in the [SERVICES_EXEC] section of the assignment file. For details, see
Using SOAP Callback Operations.
When a Uniface client calls out to a web service, Uniface calls the SOAP_CALLOUT_PRE operation on the services in the order given. When the response is received, the SOAP_CALLOUT_POST operation is called, this time processing the list of services in reverse order. This makes it possible to deploy extra processing on the envelope without having to change existing pre and post operations.
Calling Sequence
- A Uniface component activates an operation on a web service (using the signature
imported from the WSDL). For example:
activate "WsAccount".ChangePwd(newpwd)
- The SOAP connector creates the SOAP request.
- The SOAP connector then calls the SOAP_CALLOUT_PRE operation.
For each callback service named in the assignment file, an existing instance is re-used or a new one is instantiated. The SOAP_CALLOUT_PRE operation of the first component is called before the second one is instantiated
The operation may alter the SOAP envelope.
If it returns
-1
, further processing is aborted.if it returns
1
, no further callbacks are called. The SOAP connector treats the envelope as if it had been received from the web service, and continues with step 6. - The SOAP connector sends the modified request to the web service. No verification is performed.
- The SOAP connector receives the response from the web service, and calls the SOAP_CALLOUT_POST operation of each callback component named in the assignment file, in reverse order.
- The SOAP connector then processes the modified envelope. If the response is a SOAP fault, the content is passed to $ProcErrorContext. Otherwise, the message is interpreted according to the WSDL definition.
- The SOAP connect interprets the response and fills in the OUT and INOUT parameters of the activated call.