ServiceGrid Article - Creating a WebService Download in the Downloads and SD.Databroker Modules
The Downloads and SD.Databroker modules can be used for performing an automated download of data. For this, you can use WebServices as a download protocol.
This article provides you with all necessary steps to create the configuration for downloading data using WebServices. For some of those steps, you need administrator privileges.
You must be familiar with creating a download scheduler for SMTP protocol.
WebServices: Some Background Information
The main reason for downloading data using WebServices is due to a customer request to exchange data with a SAP System. Additionally, the WebServices can also be used for other purposes.
A WebService is an API which provides an interface for direct B2B data exchange.
Each WebService must have the following:
- a URL (where to find the Service)
- a WSDL (a description of the Interface)
ServiceGrid supports only WSDL in the format of an XML.
As part of the WSDL definition, operations are defined. The operations act like a sub procedure call and can be used for special purposes, for example, PUT-Data, GET-Data, Create, Delete, and so on.
When a WebService download occurs, the data is downloaded in the configured format and content. Due to the fact that we use the WebService of the customer, the data which we send must fulfill the following two conditions:
- The data must be stored in an XML structure.
- The namespace of the customer must be used.
Therefore, an XSLT transformation must occur. After the transformation has occurred, all data is sent to the customer in a single message. This could lead to a very huge message.
Step-by-Step Procedure for Creating a WebService Download
A WebService Download can be created with the following actions:
- Creating a ServiceDefinition
- Creating a Template
- Adding a Scheduler
Creating a ServiceDefinition
To create a ServiceDefinition, perform the following steps:
Step 1: In the ServiceGrid Portal, choose Companies > [choose the respective company] > ServiceDefinitions > Create new Service Definition.
Step 2: In the ServiceGrid SD ² application, choose SD.BasicData > MyCompany > [choose the mentioned company] > ServiceDefinitions > Create new Service Definition.
Creating a Template
To create a template, perform the following steps:
Step 1: In the ServiceGrid Portal, choose Companies > [choose the mentioned company] > Setups > Templates > Create a new template.
Step 2: In the ServiceGrid SD² application, choose SD.BasicData > MyCompany > [choose the mentioned company] > Setups > Templates > Create a new template.
The XSLT template that you need to design will transform the downloaded data into a single message which is presented in the namespace of the customer.
Here is an example of an XSLT-template:
<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"> <xsl:template match="/"> <ws> <SDSoapMessage> <SOAPOperation> <MessageBody> <IDatFrom><xsl:value-of select="concat(substring(//DATUM, 9,2), substring(//DATUM, 6,2), substring(//DATUM, 1,4))" /></IDatFrom> <IDatTo><xsl:value-of select="concat(substring(//DATUM, 22,2), substring(//DATUM, 19,2), substring(//DATUM, 14,4))" /></IDatTo> <ItResact> <xsl:for-each select="//Row"> <item> <Datum><xsl:value-of select="DATUM" /></Datum> <xsl:if test="string-length(POSID-1) = 0"> <Posid><xsl:value-of select="POSID-2" /></Posid> </xsl:if> <xsl:if test="string-length(POSID-1) > 1"> <Posid><xsl:value-of select="POSID-1" /></Posid> </xsl:if> <xsl:variable name="SUME"><xsl:value-of select="(HOURS_1 + HOURS_2 + HOURS_3) div 60" /></xsl:variable> <Pernr><xsl:value-of select="substring-after(PERNR-1,'-')" /></Pernr> <Hours><xsl:value-of select="format-number($SUME, '0.000')" /></Hours> <Prtyp><xsl:value-of select="substring-before(PRTYP,'-')" /></Prtyp> </item> </xsl:for-each> </ItResact> </MessageBody> </SOAPOperation> </SDSoapMessage> </ws> </xsl:template> </xsl:stylesheet>
NOTE: This step is required only if the customer does not accept the ServiceGrid namespace. There might be situations where the customers accept XML structures with different namespaces, and transform it into their own namespace by themselves after having received the data.
Adding a Scheduler
To add a scheduler, perform the following steps:
Step 1: In the ServiceGrid Portal, choose Downloads > Add a scheduler.
'Step 2: In the ServiceGrid SD² application, choose SD.Databroker > Downloads > Add a scheduler.
NOTE: When adding a scheduler you must select the data object.
After having chosen the data object, a new mask is shown as displayed in the following figure:
Step 3: From the Destination drop-down list, choose WebService. You can immediately see some new fields.
Step 4: From the Format drop-down list, choose XML (Extensible Markup Language). This is the only option that can be seen in the drop-down list.
Step 5: From the Template drop-down list, choose the template that you created in “Creating a Template” section.
Step 6: From the list of ServiceDefinitions in the WebService drop-down, choose the ServiceDefinition that you created in “Creating a ServiceDefinition” section.
Step 7: From the ServiceOperationName drop-down list, choose the service operation name For more than one service operations, you must contact the customer for selecting the service operation that the customer requires.
NOTE: For any service operation that has been selected, it must be a PUSH operation where ServiceGrid sends the data actively to the customer.
- WebServices can only be used for downloading data. In other words, data cannot be uploaded using Databroker or WebServices.
- Customers’ WebService can only be used. Cisco ServiceGrid’s WebService cannot be used.
- If you need to download huge amount of data, ensure that downloading is done during non-business hours as the necessary database queries could also be huge and could slow down the normal data processing during business hours.
- The maximum size of a single message in ServiceGrid is about 10MB. However, the actual message size depends on the encoding of the data.
For a complete list of Cisco ServiceGrid Articles, go to the List of Articles page.