ServiceGrid Article - Setup Guide Metro Push

From DocWiki

Jump to: navigation, search

Contents

Overview

The different message types and template creation are provided in this article.

Message Types

There are two different message types for the pushing service: SDSoapMessage and SDHttpMessage.

Pushing Valid SOAP Messages

Whenever the connection partner has a web service the data has to be pushed to, SOAP Push is the right choice. To accomplish this communication, we will need a combination of communication, service definition, trigger and template. An explanation on how to configure them will follow in the next sections.

Configure the Service Definition

To create a new service definition, follow these steps: 

Step 1: Choose SD.basicdata > MyCompany > ServiceDefinitions.

Step 2: Click Create a new service definition.

Create-sd.png

Step 3: Insert the service definition's master data. As in many other items in sd.call, you have to enter a ShortName and a Name, in this case, 'SGdPushOubSd' and 'Setup Guide Push Outbound Service Definition'.
Step 4: Choose WebServicePushSoap from the drop-down list for a Push Webservice. UserName and password can be filled in order to avoid setting it in the template (will be explained in later steps).

NOTE: As we are setting up a Push connection that communicates with a web service, we add the WSDL code here. As we are going to push to the service that is defined in this WSDL, pushing would not work if there is no definition in this field.

Push-wssoap-2.png

As a sample, we insert the wsdl of Core Callservice here:

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" name="CallServiceService" targetnamespace="urn:ws.solvedirect.com/broker" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:ws.solvedirect.com/broker" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsam="http://www.w3.org/2007/05/addressing/metadata" xmlns:wsp1_2="http://schemas.xmlsoap.org/ws/2004/09/policy" xmlns:wsp="http://www.w3.org/ns/ws-policy" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <types>
        <xsd:schema>
            <xsd:import schemalocation="http://localhost:8080/ws/soap/core/CallService?xsd=1" namespace="urn:ws.solvedirect.com/broker">
        </xsd:import></xsd:schema>
    </types>
    <message name="putCall">
        <part name="parameters" element="tns:putCall"></part>
    </message>
    <message name="putCallResponse">
        <part name="parameters" element="tns:putCallResponse"></part>
    </message>
    <message name="SDWebServiceException">
        <part name="fault" element="tns:SDWebServiceException"></part>
    </message>
    <message name="getCall">
        <part name="parameters" element="tns:getCall"></part>
    </message>
    <message name="getCallResponse">
        <part name="parameters" element="tns:getCallResponse"></part>
    </message>
    <porttype name="CallService">
        <operation name="putCall">
            <input type="text" wsam:action="urn:ws.solvedirect.com/broker:CallService:putCallRequest" message="tns:putCall">
            <output wsam:action="urn:ws.solvedirect.com/broker:CallService:putCallResponse" message="tns:putCallResponse">
            <fault name="SDWebServiceException" wsam:action="urn:ws.solvedirect.com/broker:CallService:putCall:Fault:SDWebServiceException" message="tns:SDWebServiceException">
        </fault></output></operation>
        <operation name="getCall">
            <input type="text" wsam:action="urn:ws.solvedirect.com/broker:CallService:getCallRequest" message="tns:getCall">
            <output wsam:action="urn:ws.solvedirect.com/broker:CallService:getCallResponse" message="tns:getCallResponse">
            <fault name="SDWebServiceException" wsam:action="urn:ws.solvedirect.com/broker:CallService:getCall:Fault:SDWebServiceException" message="tns:SDWebServiceException">
        </fault></output></operation>
    </porttype>
    <binding type="tns:CallService" name="CallServicePortBinding">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http">
        <operation name="putCall">
            <soap:operation soapaction=""></soap:operation>
            <input type="text">
                <soap:body use="literal"></soap:body>
             
            <output>
                <soap:body use="literal"></soap:body>
            </output>
            <fault name="SDWebServiceException">
                <soap:fault name="SDWebServiceException" use="literal"></soap:fault>
            </fault>
        </operation>
        <operation name="getCall">
            <soap:operation soapaction=""></soap:operation>
            <input type="text">
                <soap:body use="literal"></soap:body>
             
            <output>
                <soap:body use="literal"></soap:body>
            </output>
            <fault name="SDWebServiceException">
                <soap:fault name="SDWebServiceException" use="literal"></soap:fault>
            </fault>
        </operation>
    </soap:binding></binding>
    <service name="CallServiceService">
        <port name="CallServicePort" binding="tns:CallServicePortBinding">
            <soap:address location="https://ws.solvedirect.com/ws/soap/core/CallService">
        </soap:address></port>
    </service>
</definitions>

NOTE: By default, the communication uses the location given in the tag soap:address as destination URL. This default value can be overridden in the field URL.

Creating Template

To create a template, follow these steps:

Step 1: Go to the trigger overview and Create a new template. Steps on how to create a template can be found here.

Step 2:. Criteria for a Push template is to fulfill the following condition:

  • If you want to push to a web service with a WSDL it is important that you insert a template that creates a message with the structure of SDSoapMessage.
<sdsoapmessage>
  <servicename>CallServiceService</servicename>                 <!-- optional -->
  <portname>CallServicePort</portname>                          <!-- optional -->
  <servicenamespaceuri>CallServiceService</servicenamespaceuri> <!-- optional -->
  <portnamespaceuri>CallServiceService</portnamespaceuri>       <!-- optional -->
  <soapaction>CallServiceService</soapaction>                   <!-- optional -->
  <soapoperation>                                               <!-- required -->
    <headers>
      <!-- can be any content -->
    </headers>
    <messagebody>
      <!-- can be any content, for example -->
      <username>username</username>
      <password>password</password>
    </messagebody>
    <name>getCall</name>
    <namespaceuri>urn:ws.solvedirect.com/broker</namespaceuri>
    <responseelementname>getCallResponse</responseelementname>
    <responseelementnamespaceuri>urn:ws.solvedirect.com/broker</responseelementnamespaceuri>
  </soapoperation>
</sdsoapmessage>

A sample template is:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:template match="SD.call">
        <sd.call>
            <xsl:call-template name="CALL"></xsl:call-template>
        </sd.call>
    </xsl:template>
    <xsl:template name="CALL">
        <sdsoapmessage>
            <soapoperation>
                <messagebody>
                    <username>${servicedefinition.username}</username>
                    <password>${servicedefinition.password}</password>
                    <calldata>
                        <calls>
                            <sdcallid>
                                <xsl:value-of select="/SD.call/ID">
                            </xsl:value-of></sdcallid>
                        </calls>
                    </calldata>
                </messagebody>
                <name>putCall</name>
                <namespaceuri>urn:ws.solvedirect.com/broker</namespaceuri>
                <responseelementname>putCallResponse</responseelementname>
                <responseelementnamespaceuri>urn:ws.solvedirect.com/broker</responseelementnamespaceuri>
            </soapoperation>
        </sdsoapmessage>
    </xsl:template>
</xsl:stylesheet>



Pushing Custom HTTP Messages

Configuring Service Definition

To create a new service definition, follow these steps:

Step 1: Choose SD.basicdata > MyCompany > ServiceDefinitions.

Step 2: Click Create new service definition.

Create-sd.png

Step 2: Insert the service definition's master data. As in many other items in sdcall, you have to enter a ShortName and a Name, in this case, 'SGdPushHObSd' and Setup Guide Push Http Outbound Service Definition'.
Step 3: For a Push Http service it is important to chose the type WebServicePushHttp.
Step 4: In the field URL, enter a URL to which the request will be posted. In our sample, we will post the request to https://ws.solvedirect.com/ws/distinct/HTTPDirectServlet. UserName and password can be filled in to avoid setting it in the template (will be explained in later steps).

Push-http-service-3.png

Creating Template

To create a new template, follow these steps:

Step 1: Go to the trigger overview and click Create a new template. Steps on how to create a template can be found here.
Criteria for a Push template is to fulfill the following condition: 

  • If you want to push to a service through post, it is important that you insert a template that creates a message with the structure of SDHttpMessage.
<sdhttpmessage>
<charset>UTF-8</charset>                               <!-- optional -->
<headers>                                              <!-- optional -->
<parameter name="Connection">keep-alive</parameter>
</headers>
<message>                                              <!-- required -->
<!-- any content, for example -->
<element1>Content1</element1>
<element2>Content2</element2>
</message>
</sdhttpmessage>

A sample template is:

<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="SD.call">
<sd.call>
<xsl:call-template name="CALL"></xsl:call-template>
</sd.call>
</xsl:template>
<xsl:template name="CALL">
<sdhttpmessage>
<message>
<calldata>
<calls>
<sdcallid>
<xsl:value-of select="/SD.call/ID">
</xsl:value-of></sdcallid>
</calls>
</calldata>
</message>
</sdhttpmessage>
</xsl:template>
</xsl:stylesheet>

Creating Communication

To create a new communication, follow these steps:

Step 1: Click SD.basicdata.
Step 2: Choose MessageRules > All Communications > Create new outbout communication

Create-outbound-comm-4.png

Step 3: Select the converter and communication type.

NOTE: Converter must be "SD.xsl-SDStandardXSL" (because we have to write a template for this communication which is explained later in this guide).CommunicationType is "WS.out-WebService REST/SOAP outbound".

Step 4: Click Next to get to the next screen.

Create-outbound-comm-5.png

Step 5: Enter a value in the ShortName and Name fields to finish the basic creation. In this example, 'SGdPushOubCo' for the short name and 'Setup Guide Push Outbound Communication' for the name.
Step 6: Click Save to finish the creation .

Create-outbound-comm-6.png

Adding the Receiver

The next step is to connect the service definition that was created earlier with the communication. To connect the service definition with the communication, follow these steps:

Step 1: Click Add new receiver in the communication receivers section.

Add-new-receiver-7.png

Step 2: Enter the master data for the receiver. The Type has to be Service Definition-WebService REST/SOAP outboundFor the ServiceDefinitionName, the application provides a list view, where you can select the desired service definition. In this example, we select the service definition SGdPushOubSdwhich was created earlier.
Step 3: ClickSave to save the changes.
Add-new-receiver-8.png

Add-new-receiver-9.png

Adding the Template

To add the template created earlier to the communication, follow these steps:

Step 1: Click Add new template.
Step 2: Select the desired template from the drop-down list.
'
Step 3: ClickSave.

New-template-10.png


New-template-11.png

Connect Communication and Trigger

Specialties

Response Filters

It is possible to set action to specific type of responses. A detailed description can be found at ResponseFilters.

Template Macros

Specialties for the template. 

  • Quite often, the customer has to face the requirement to ensure simple security standards like hiding passwords. As for this communication method, you will find a high potential that the service's requester (in this case Cisco ServiceGrid) has to authenticate. The application provides two macros for support:  ${servicedefinition.username} and  ${servicedefinition.password}

NOTE: Even if the macro is used and it is translated before sending the message, different screens providing a view of the message content will not show the translated value.


Attachment Handling

Because you are using the standard XSL conversion process for producing the message, you can attach templates as described in link to custom callservice.

Limitations Message Size

As the messages that are sent out are in both cases (SDSoapMessage as well as SDHttpMessage) tranformed with the standard XSL converter, we have a limit of 15 MB of the complete message size (including possible attachments).


For a complete list of Cisco ServiceGrid Articles, go to the List of Articles page.



Rating: 0.0/5 (0 votes cast)

Personal tools