search cancel

Trigger event using curl in DE

book

Article ID: 237825

calendar_today

Updated On:

Products

CA Workload Automation DE CA Workload Automation DE - Scheduler (dSeries) CA Workload Automation DE - System Agent (dSeries) CA Workload Automation DE - Business Agents (dSeries)

Issue/Introduction

This KD provides examples on how to trigger events using SOAP.  DE has WebServices component that provides over 50 actions.

Here we will use curl to trigger an existing event in DE server.  Users will need to install DE SOAP Web Services.  The example uses curl, a utility that is readily available in Linux.  For Windows, users may use curl via PowerShell or see here.

It is highly recommended to use a tool to create SOAP message from the WSDL.  There are several 3rd party tools available, such as SoapUI.

Environment

Release : 12.x

Component : WORKLOAD AUTOMATION DE (DSERIES), WA SOAP Web Services

Resolution

Launch and connect to Web Service via browser.  Ensure the WSDL is accessible.  When access the link from browser, the link will pop up user/pass.  Enter admin / admin only.

Note: As of now, the Web Service can only pass base64 authentication as header.  Check to make sure this passes the security requirement.  It is recommended to use SSL (HTTPS) for Web Service for added security.

1. Get Authorization header.  Create one using base 64 in Linux, example:

echo -n 'user:secretpass' | base64
dXNlcjpzZWNyZXRwYXNz

2. Access the WSDL link to make sure it works (enter admin / admin on popup).

https://<serverIP/hostname>:8080/axis2/services/EspDSeriesService?wsdl

3. Using a SOAP tool build the SOAP message that will be sent to WebService.  Save the XML

E.g.  Trigger add will be like this (save in a file, for this example we saved in apple2.xml):

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://webservice.eng
ine.wa.ca.com/xsd">
   <soapenv:Header/>
   <soapenv:Body>
      <xsd:triggerAddEvent>
         <xsd:eventName>NITIN.APPLE_SAUCE</xsd:eventName>
         <xsd:when>NOW</xsd:when>
</xsd:triggerAddEvent>
   </soapenv:Body>
</soapenv:Envelope>
 

Note: The event name will have a prefix (user).  Check the event name from Desktop client by opening the application in Define.  

The WSDL may have several optional fields.  In this example we are using basic and required fields in the XML.

4. Get Endpoint URL for the WebService.  This is available in the WSDL under: Service name="EspDSeriesService"

 The example of an endpoint will be something like this:

https://de.example.com:8080/axis2/services/EspDSeriesService.EspDSeriesServiceHttpSoap11Endpoint/

Tip: Save the endpoint as variable and export it.  This makes command easy to read and run

ENDPOINT='http://de.example.com:8080/axis2/services/EspDSeriesService.EspDSeriesServiceHttpSoap11Endpoint/'
export ENDPOINT

5. Setup the curl and test it

curl --header "Content-Type: text/xml;charset=UTF-8" \
--header "Authorization: Basic dXNlcjpzZWNyZXRwYXNz" --data @apple2.xml $ENDPOINT

Note: The apple2.xml has the above Soap message XML

After successful run of command, an output similar to this will return from Web service:

<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<xsd:triggerAddEventResponse xmlns:xsd="http://webservice.engine.wa.ca.com/xsd">
<xsd:return>
<xsd:statusCompletionCode>SUCCESS</xsd:statusCompletionCode>
<xsd:statusMessage>Event NITIN.APPLE_SAUCE trigger requested</xsd:statusMessage>
<xsd:statusMessageId>0000</xsd:statusMessageId>
</xsd:return>
</xsd:triggerAddEventResponse>
</soapenv:Body>
</soapenv:Envelope>

Additional Information

You can also use REST API to trigger an event.