More about Service SAP rules

Service SAP services are SOAP-based and defined the same way as a SOAP service.

After you have created all the Service SAP rules in a package, use the service package to generate WSDL files that describe the services in the package. Then you can copy the generated WSDL files to the system on which you are developing the SAP client and use it to create your SAP client application.

WSDL generation

After you have created all the Service SAP rules in a package, open the service package data instance to create a WSDL file. You can copy this file to the client (calling) system to support deployment.

Although SAP services support the nillable attribute, the WSDL file generated by the Pega Platform does not include any nillable attributes. If required, edit the WSDL file to include an attribute similar to the following:

<xsd:elementname="shipDate" type="xsd:date" nillable="true" />

The Pega Platform can process a message that contains:

<shipDate xsi:nil="true"></shipDate>

Debugging with TCPMon

Use the Tracer to debug Service SAP rules. A proxy server such as TCPMon — part of the Apache Axis toolkit — lets you see the content of the messages.

HTTP messages sent by the Pega Platform may be compressed and difficult to review in Tracer and TCPMon displays. You can turn off data compression. See Tracer best practices.

To start TCPMon, install Axis on your workstation and create a Windows BAT file similar to the following:

set AXIS_LIB=C:\axis-1_1\lib
set CLASSPATH=%AXIS_LIB%\axis.jar
set CLASSPATH=%CLASSPATH%;%AXIS_LIB%\jaxrpc.jar
set CLASSPATH=%CLASSPATH%;%AXIS_LIB%\wsdl4j.jar
set CLASSPATH=%CLASSPATH%;%AXIS_LIB%\saaj.jar
set CLASSPATH=%CLASSPATH%;%AXIS_LIB%\commons-discovery.jar
set CLASSPATH=%CLASSPATH%;%AXIS_LIB%\commons-logging.jar
java org.apache.axis.utils.tcpmon

User instructions are available on the Apache Axis site. You can run TCPMon on any computer, and modify the SAP client to send the request to the host and port on which TCPmon runs. After TCPMon receives the request message, it forwards the message to the endpoint that you specify to TCPMon.

Character set encoding

By default, the Pega Platform uses UTF-8 as the character set encoding for SOAP response messages. To change character set encoding for SOAP responses, modify the value of the CharacterEncoding parameter specified for the PRSOAPServlet servlet in the Pega Platform web.xml file.

If required, you can configure the Pega Platform so that the encoding of the response matches the encoding of each SOAP request, no matter what it is set to. To implement this configuration, do the following:

  • Delete the CharacterEncoding parameter from the servlet definition of PRSOAPServlet in the web.xml file.
  • Configure the external application that sends the SOAP requests so that it includes the Content-Type HTTP request header in the SOAP request, specifying the character set encoding of the message.

Then, if a SOAP request provides an encoding value, the PRSOAPServlet servlet uses that character set for the response. But if the SOAP request does not specify an encoding value, PRSOAPServlet uses UTF-8.

Production

Service SOAP rules run in a background requestor that uses the PRSOAPServlet servlet. At runtime, the package, class, and method names are passed in as part of a SOAP request so that your Pega Platform application can look up the corresponding Service SOAP rule and execute the service activity.

Stateful processing

When the Processing mode field on the service package is set to Stateful, the PRSOAPServlet servlet uses token passing and cookies to maintain state between client and server.

Attachments

Service SOAP rules can accept and process binary files from incoming connections. For more information, see Pega Community article How to process a binary file with a SOAP service.

For information about how to handle attachments with SOAP connectors, see Using attachments with SOAP, dotNet, and HTTP connectors and services.

Debugging tip

To see the full text of the request and response messages, use the Set Logging Levels tool to set logging for this Java class to INFO.

com.pega.pegarules.web.PRSOAPServlet

Performance statistics

Through changes to the prlog4j2.xml file, you can obtain performance statistics on the execution of services. See Performance tool — Statistics for services in the SERVICES-PAL log.

Through changes to the prconfig.xml file, you can be alerted to unusually long SOAP service operations. See How to detect lengthy service operations.

As an alternative to updating the prconfig.xml file, you can use Dynamic System Settings to configure your application. See Dynamic System Settings data instances.

SOAP Sample

A SOAP service sample is provided to demonstrate an out-of-the-box self-contained example for application designers to configure. Sample rules are stored in the Pega-LP-Integration ruleset under the root class PegaSample-Integration derived from the PegaSample class.