Retrieve parameter from a SOAP request in a workflow | Community
Skip to main content
salvdangelo
Level 5
January 18, 2018
Solved

Retrieve parameter from a SOAP request in a workflow

  • January 18, 2018
  • 7 replies
  • 4885 views

Hi,

I am trying to start a workflow and send variables through a SOAP request like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:workflow">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:PostEvent>

         <urn:sessiontoken>___53d35702-7d18-4bb6-b8ec-1f91937a7edc</urn:sessiontoken>

         <urn:strWorkflowId>26000231</urn:strWorkflowId>

         <urn:strActivity>signal</urn:strActivity>

         <urn:strTransition></urn:strTransition>

         <urn:elemParameters>

            <variables>

            <email>your@email.com</email>

            </variables>

         </urn:elemParameters>

         <urn:bComplete></urn:bComplete>

      </urn:PostEvent>

   </soapenv:Body>

</soapenv:Envelope>

How can I retrieve the information inside <email></email> ?


Here an example of the workflow.
How should I pick up the email (or another variable inside <variables>) inside a JS code?

Thanks in advance,

Salvatore

Jean-Serge Biron

@nkur

Adhiyan

kirti.rawat

Amy_Wong

Debbie

Adobe Campaign

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by salvdangelo

Hi David Garcia,

I am aware of the option you're proposing but the request is on an external source and executed with a SOAP request.
Anyway I've just found the solution:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:workflow">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:PostEvent>

         <urn:sessiontoken>___53d35702-7d18-4bb6-b8ec-1f91937a7edc</urn:sessiontoken>

         <urn:strWorkflowId>26000231</urn:strWorkflowId>

         <urn:strActivity>signal</urn:strActivity>

         <urn:strTransition></urn:strTransition>

         <urn:elemParameters>

           <variables email="your@email.com" >           

            </variables>

         </urn:elemParameters>

         <urn:bComplete></urn:bComplete>

      </urn:PostEvent>

   </soapenv:Body>

</soapenv:Envelope>

The script you wrote above is correct: vars.email

Thanks anyway!

Salvatore

7 replies

david--garcia
Level 10
January 18, 2018

Top of my head, try

logInfo(vars.email)

Here is an scenario

You can post variables from a webapp to a workflow

xtk.workflow.PostEvent("wkfInternalName", "mysignal", "", <variables id={latestEntry.Records.@id} status={ctx.vars.status} type={ctx.vars.type} serviceType={ctx.vars.serviceType} participation={ctx.vars.participation} category={ctx.vars.category} distribution={ctx.vars.distribution} proof={ctx.vars.proof} />, false);

Then in the workflow javascript you can log what was posted from the webapp

logInfo(vars.status);

salvdangelo
salvdangeloAuthorAccepted solution
Level 5
January 18, 2018

Hi David Garcia,

I am aware of the option you're proposing but the request is on an external source and executed with a SOAP request.
Anyway I've just found the solution:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:workflow">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:PostEvent>

         <urn:sessiontoken>___53d35702-7d18-4bb6-b8ec-1f91937a7edc</urn:sessiontoken>

         <urn:strWorkflowId>26000231</urn:strWorkflowId>

         <urn:strActivity>signal</urn:strActivity>

         <urn:strTransition></urn:strTransition>

         <urn:elemParameters>

           <variables email="your@email.com" >           

            </variables>

         </urn:elemParameters>

         <urn:bComplete></urn:bComplete>

      </urn:PostEvent>

   </soapenv:Body>

</soapenv:Envelope>

The script you wrote above is correct: vars.email

Thanks anyway!

Salvatore

dattarays703613
January 22, 2018

Hi,

Is there a way to read "child" tags under the <variables> tag, within JS of a workflow?

e.g.

<variables>

     <product>

          <name>XYZ</name>

          <quantity>2</quantity>

     </product>

</variables>

using vars.XXX, will read properties of <variables> tag only but in case of more complex values to read, can above be possible?

(vars.product.name: doesn't work..)

david--garcia
Level 10
January 22, 2018

@dattarays70361342 Start playing with the following, should give you an idea.

var payload = <rtEvent>

              <ctx>

                <recipient>

                  <firstName>David</firstName>

                  <lastName>Garcia</lastName>

                </recipient>

              </ctx>

              </rtEvent>

vars.fullName = payload.ctx.recipient.firstName+" "+payload.ctx.recipient.lastName;

logInfo(vars.fullName);

dattarays703613
January 22, 2018

Thanks David

- rtEvent API is quite flexible/standard, it accepts XML structure and XML is as-is accesible within message templates, no issue with rtEvent API

- The issue is with "PostEvent" API of the xtk:workflow which accepts i/p parameters only within <variables /> tag.

The <variables /> tag properties I can read with vars.xxx way but if the parameters are going to hold multiple values, how do we handle them? (using "comma" separated values is not reliable and doesn't provide much flexibility) hence I am trying to check if what I am trying to send in "PostEvent" <variables> ... </variables> tag as child tags, can they be accessed within workflow JS code?

PushEvent XML extract:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:xtk:workflow">

   <soapenv:Header/>

   <soapenv:Body>

      <urn:PostEvent>

         <urn:sessiontoken>XXXX</urn:sessiontoken>

         <urn:strWorkflowId>WKF1028</urn:strWorkflowId>

         <urn:strActivity>signal</urn:strActivity>

         <urn:strTransition></urn:strTransition>

         <urn:elemParameters>

    <variables>

         <product>

              <name>XYZ</name>

              <quantity>2</quantity>

         </product>

         <product>

              <name>PQR</name>

              <quantity>1</quantity>

         </product>

     </variables>

    </urn:elemParameters>

         <urn:bComplete>0</urn:bComplete>

      </urn:PostEvent>

   </soapenv:Body>

</soapenv:Envelope>

how to read product details from the above postevent within workflow JS, using vars.xxx?

dattarays703613
January 23, 2018

Got the solution, thanks.

Level 2
July 28, 2022

Hello,

 

We have an almost similar use case, can you let us know the solution that worked for you. Thanks in advance.

david--garcia
Level 10
January 24, 2018

Hey datta,

I am happy you were able to sort it out, could you please share your solution to the community.