Online documentation - Websydian v6.0

Users Guide | Patterns Reference | WebsydianExpress | Search

 

WsySoap Other Uses


Insert Customized SOAP Header Entries

General

In order for TransacXML to process application-dependent SOAP headers the CA Plex XML model of the SOAP message must be modified to contains these SOAP headers.

Create the application-dependent SOAP header entity and specify it as an XmlElement:

MySoap.Data.Envelope.Header includes ENT MyHeader
MySoap.Data.Envelope.Header.MyHeader is a ENT XmlElement

Specify the wanted attributes of MyHeader as described in the Implementation Guide for the TransacXML pattern.

The Data view of the new header entity must then be added to the Output variable of the EnvelopeFlatView function. Then the EnvelopeFlatView function will automatically extract the SOAP header values from the XML document.

Add the following triples to the MySoap.Services.EnvelopeFlatView function:

MySoap.Services.EnvelopeFlatView is a FNC MySoap.Data.Envelope.Header.MyHeader.FieldHolder

SoapProcessor

In order for the SoapProcessor to have access to the extracted data values the Data view of the SOAP header must also be added to the SoapProcessor function. 

Add the following triples to the MySoap.Services.SoapProcessor function:

MySoap.Services.SoapProcessor local view VW

...for VAR

MySoap.Data.Envelope.Header.MyHeader.Data
WSYSOAP/ComplexHeaderElements

The above triples will make the SOAP header elements in the SOAP request available for the SoapProcessor function in the variable ComplexHeaderElements.

If there are simple elements in the Header XML element (MySoap.Data.Envelope.Header) these can be retrieved with the following modifications.

Add the following triples to the MySoap.Services.SoapProcessor function:

MySoap.Services.SoapProcessor local view VW

...for VAR

MySoap.Data.Envelope.Header.Data

WSYSOAP/SimpleHeaderElements

variable VAR

...as SYS

WSYSOAP/SimpleHeaderElements

Local

Insert the following statement in the edit point After populate Data from SOAP message in the function MySoap.Services.SoapProcessor:

Set SimpleHeaderElements = Data

If the SoapProcessor must insert SOAP headers in the SOAP response, then this must be done in the edit point 'Insert optional Header element in response here'.

SoapGenerator

The SoapGenerator automatically inserts the necessary SOAP headers into the SOAP request. The only thing that has to be done is to specify the SOAP headers that must be inserted.

Add the MySoap.Data.Envelope.Header.MyHeader.Data view to the SoapGenerator function both to the Input/ComplexHeaderElements and Local/ComplexHeaderElements variable.

MySoap.
Services.
SoapGenerator
input view VW

...for VAR

MySoap.Data.Envelope.Header.MyHeader.Data
WSYSOAP/ComplexHeaderElements
local view VW

...for VAR

MySoap.Data.Envelope.Header.MyHeader.Data
WSYSOAP/ComplexHeaderElements

The data for the header elements are then transferred as input fields to the SoapGenerator function, and the SoapGenerator function will then insert the SOAP headers into the SOAP request message.

If the SoapGenerator must read SOAP headers in the SOAP response then use the EnvelopeFlatView function to extract the SOAP headers from the SOAP response.

Use HTTP as Transport Layer

Choice of transport layer is a matter of inheritance. Presently HTTP is implemented. Inherit from HttpSoap for implementing a web service using HTTP as the transport layer. See the Tutorial for an example where HttpSoap is the base entity.

Specify different encoding in SoapProcessor function

Per default, the SOAPProcessor will return the SOAP Response in the same encoding as it was received.

If for some reason a change of encoding is needed, the SoapProcessor should specify the new encoding by setting the field DOM<encoding> in the edit point Start construct answer to SOAP client.

Generate WSDL file

WSDL (Web Service Description Language) is a language used to create formal descriptions of web services.

The description includes information, which makes it possible for a number of programming tools to generate the structure and calls needed to contact the web service.

The SOAPProcessor scopes a CreateWSDL function, which can be used for creating a WSDL file for the SOAPProcessor.

Detailed instructions for the use of the CreateWSDL function can be found in the Create WSDL Guide.