Call HPOO runFlow webservice with params (677 Views)
Reply
Occasional Visitor
netelbcn
Posts: 1
Registered: ‎12-12-2012
Message 1 of 3 (677 Views)

Call HPOO runFlow webservice with params

Hi,

 

I'm testing a very simple flow called from PHP, but I can't pass parametres to this flow.

 

The flow that I created sends an e-mail with the subject and body received from params:

 

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:wsc="http://wscentralservice.services.dharma.iconclude.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Header/>
 <soapenv:Body>
  <wsc:runFlow soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
   <params xsi:type="soap:WSRunParameters" xmlns:soap="http://iconclude.com/webservices/rss/v2.0/soap">
    <async xsi:type="xsd:boolean">true</async>
    <flowInputs xsi:type="wsc:ArrayOf_tns1_WSFlowInput"soapenc:arrayType="soap:WSFlowInput[]" xmlns:wsc="https://192.168.1.100:8443/PAS/services/WSCentralService">
     <listValues>
      <name>subject</name>
      <value>HELLO</value>
     </listValues>
     <listValues>
      <name>body</name>
      <value>HOW ARE YOU?</value>
     </listValues>
    </flowInputs>
    <startPaused xsi:type="xsd:boolean">false</startPaused>
    <trackStatus xsi:type="xsd:boolean">false</trackStatus>
    <uuid xsi:type="xsd:string">2d27dedb-56f6-427e-862f-81197ee6a5ag</uuid>
   </params>
  </wsc:runFlow>
 </soapenv:Body>
</soapenv:Envelope>

 

If I run this XML with SoapUI, the result is OK, the e-mail is sended with the subject and body specified.

 

The probles is when I call this flow from PHP, I don't know how I can pass the parameters!! The flow runs OK, but not receive any param... This is my PHP code:

 

$this->client = new SoapClient('https://192.168.1.100:8443/PAS/services/WSCentralService?wsdl',     array(    'soap_version'     => SOAP_1_1,
        'login'         => "user",
        'password'         => "pass",
        'trace'         => 1));

 

$param                                  = new stdClass();
$param->async                           = true;
$param->startPaused                     = false;
$param->trackStatus                     = false;
$param->uuid                            = '2d27dedb-56f6-427e-862f-81197ee6a5ag';
$param->flowInputs                      = new stdClass();
$param->flowInputs->listValues          = new stdClass();
$param->flowInputs->listValues->subject = 'HELLO';
$param->flowInputs->listValues->body    = 'HOW ARE YOU';

 

   
$result = $this->client->runFlow($param);

 

 

Have somebody this same problem? How can I pass the param "subject" and "body" (in this case) to the WS method?

 

Thanks!

 

Honored Contributor
Mahmoud Ibrahim
Posts: 1,574
Registered: ‎05-21-2008
Message 2 of 3 (623 Views)

Re: Call HPOO runFlow webservice with params

[ Edited ]

HI,

I am not professional in PHP but I am just trying to help you here.

You may try soapCall() function it is very direct in passing the parameters

 

You may try somehting like the below

 


$client =newSoapClient("https://192.168.1.100:8443/PAS/services/WSCentralService");

/*Creating the list of values array */

$listValuesArray = array();
$listValuesArray[] = array("name" => "subject", "value" => "hello");
$listValuesArray[] = array("name" => "body", "value" => "how are you");

/*Adding list of values array to flowinput Array  */

$flowInputsArray = array();
$flowInputsArray[] = array("listValues" => $listValuesArray );
$params = array(
async=>"true"
startPaused=>"false"
trackStatus=>"true"
uuid=>"2d27dedb-56f6-427e-862f-81197ee6a5ag"
flowInputs => $flowInputsArray
);
$response = $client->__soapCall("runFlow", array($params));

 

I hope this will work

Regards,
Mahmoud Ibrahim
http://www.mahmoudthoughts.com
  • Say thanks by clicking the "Kudos! Star" which is on the left.

  • Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue.
  • Occasional Visitor
    LocaOl
    Posts: 1
    Registered: ‎05-13-2014
    Message 3 of 3 (219 Views)

    Re: Call HPOO runFlow webservice with params

    I know this thread is old, but I had troubles using HPOO runFlow with SOAP and finaly found the solution, so I give it:

     

    You must use objects and SoapVar to create a good XML:

    <?php
    class listValues {
        public $name;
        public $value;
    }
    function newParam($name, $value) {
        $flowParam = new listValues();
        $flowParam->name = $name;
        $flowParam->value = $value;
        $flowParam = new SoapVar($flowParam, SOAP_ENC_OBJECT, null, null, 'listValues');
        return $flowParam;
    }
    
    $flowInputArray= new ArrayObject();
    $flowInputArray->append(newParam('subject', 'Hello'));
    $flowInputArray->append(newParam('body', 'this is my body'));
    
    $params = array(
       'async' => 'true',
       'startPaused' => 'false',
       'trackStatus' => 'true',
       'uuid' => '2d27dedb-56f6-427e-862f-81197ee6a5ag',
       'flowInputs' => $flowInputsArray
    );
    $client =newSoapClient("https://192.168.1.2:8443/PAS/services/WSCentralService");
    $response = $client->__soapCall('runFlow', array(
       new SoapVar($params, SOAP_ENC_OBJECT)
    ));

    If you can read french, I did a small explanation on my blog : Utiliser le webservice HPOO runFlow avec SOAP.

     

    The opinions expressed above are the personal opinions of the authors, not of HP. By using this site, you accept the Terms of Use and Rules of Participation.