Websydian v6.1 online documentationOnline documentation - Websydian v6.1

WsySoap Other Uses

Insert Customized SOAP Header Entries

General

In order for TransacXML to process application-dependent SOAP headers, the 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 desired 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.

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.

Calling a non-SOAP http-based web service

In some cases, the web service you are going to call does not use the soap standard. In most cases, this means that the request and response documents are not being wrapped in a SOAP-envelope.

To handle this situation, you can specify No for the HandleSoap option for the SoapGenerator function.

This prevents the SoapGenerator from wrapping the request in a SOAP envelope and from unwrapping the response from an envelope.

This option is available from version 6.1.

MySoap.Services.SoapGenerator option NME

...value SYS

WSYSOAP/HandleSoap

No

Providing a non-SOAP http-based web service

In some cases you want to provide a web service without using the SOAP standard. This can for instance be because of demands from the parties who is going to subscribe to the service.

You can set two options to control this:

The HandleSoap option controls whether the SoapProcessor handles the wrapping/unwrapping of a Soap envelope structure for the request and response documents. By specifying No for this option, you specify that the XMLHandler should always provide the original request document to the XMLHandler function - and at the same time just send the response document from the XMLHandler unmodified to the caller of the web service.

The GetXMLHandlerForTopElement option controls whether the XMLHandler is identified by the name of the top element in the request document.

In the SOAP implementation, the http-header SOAPAction is used to identify which XMLHandler to call. As this is a non-SOAP implementation, this header is not received. Instead you can let the name of the top element determine which XMLHandler to call (all request documents with the same name of the top element will be sent to the same XMLHandler). Write the name of the top element in the SOAPAction source code scoped by the XMLHandler to specify which XMLHandler to call.

These options are available from version 6.1.

MySoap.Services.SoapProcessor option NME

...value SYS

WSYSOAP/HandleSoap

No

MySoap.Services.SoapProcessor

 

option NME

...value SYS

WSYSOAP/GetXMLHandlerFromTopElement

Yes

Generate WSDL file

WSDL (Web Service Description Language) is an XML format 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.

Import WSDL file

When you are going to call a web service (the subscriber role) the provider will normally also provide a WSDL file that describes the service and the request and response documents used. You can import the Plex definitions you need to be able to handle the request and response documents using the TransacXML import tool.