Unofficial Content

Name

Web Service Wrapper

Intention

The Web Service Wrapper pattern encapsulates the technological issues related to Web Services, handling services locations and SOAP errors.

It also clarifies the system boundaries providing a unique point of interaction for each service referenced by the application or the module.

Canonical Example

Getting the information of a invoice from a web service

Implementation

Given a web service method, the pattern generates a procedure which uses the web service method handling SOAP errors.

It would be useful to be able to specify if a given parameter of the web service method should be omitted in the parm rule.

For security and logging purposes, the implementation should allow user code specification before, on error and on success of the execution.

Rules

parm(in:&K2BDocumentoComercial, out:&K2BDocumentoComercialout, out:&K2BResultado, out:&Success, ,out:&errorMessage);

Source

// Gets the location information from a repository

&Location = LocationGet.udp('wsDocumentoComercialGetInstance')

 

&Ws.Execute(&K2BDocumentoComercial,&K2BWsOpciones,&K2BDocumentoComercialout,&K2BResultado)

 

If GetSOAPErr() = 0 // No SOAP Error

    &success = True

    &errormessage.SetEmpty()

Else

    &success = False

    &errorMessage = GetSOAPErrMsg() // returning the error message

EndIf

Variables

&K2BDocumentoComercial input parameter of the web service

&K2BDocumentoComercialout Populated Invoice structure

&Success true if the service executes successfully, false otherwise

&Location Location of the web service

&K2BWsOpciones Web service input variable not initialized

&K2BResultado Web service output variable. Only valid if &success = True

&errorMessage the errror returned as consequence of the SOAP error

Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant