General Technical Discussions for Service

Get Involved. Join the Conversation.


    Ross Crockett
    Custom Process - outgoing connection
    Topic posted April 9, 2014 by Ross CrockettRed Ribbon: 250+ Points 
    1335 Views, 13 Comments
    Custom Process - outgoing connection


    I've managed to configure a custom process to include the NuSOAP library to make a web service call on trigger of an event. I have migrated code from customer portal Model classes that is working fine into the Custom Process. At the moment I am adding a little bit at a time and building on it as it works so the code below isn't the end picture.

    Upon testing the client though, the process finishes abruptly with no error in the Process Designer. My output would indicate that it got to the line where it was creating the client and then it just ends. If I check the Logs though, the error logs show this:

    Fatal signal '11' received, current errno=11

     Client Type: Console-C#
    -- Call Stack ----------------------------------------

    -- Raw Post Data ------------------------------------

    -- CGI Environment -----------------------------------
    REQUEST_URI   : /cgi-bin/[myinterface].cfg/php/xml_api/soap_api.php
    SCRIPT_NAME   : /cgi-bin/[myinterface].cfg/php
    PATH_INFO     : /xml_api/soap_api.php

    The apply method is given in the snippet below, i have masked the interface and URLs etc so that isn't the issue. i have provided some code comments too to give some context.

    I read that outgoing connections from Custom processes might be blocked from August 2013, and given that we are on Nov 2013 I was wondering if that could be the problem. Could anyone provide some insight?


    November 2013
    Code Snippet:



    • Roderick Peace


      I presume you are executing the cpm asynchronously and have the curl library loaded?

      Synchronous CPMs time out in a matter of seconds IIRC.

      The docs say “loading cURL libraries requires you to use the load_curl() PHP function in your script.”

      I could be wrong but I don’t think dl(''); etc will work in a custom model and I don’t recall what nusoap requires internally.

      Out of curiosity, is there a delta between what’s available in cphp/roql and xml_api that would warrant communicating with a deprecated api on a site that supports the newer frameworks?


      And one more question. Are you on a commercial pod or a regulated one where our fire wall could be blocking the call altogether?

    • Ross Crockett

      Thanks for the response Roderick. I am using load_curl() to include the cURL library and not the older way of dl(). The last two questions I'm not sure about though.

      I'm not sure what you mean by "is there a delta between what’s available in cphp/roql and xml_api that would warrant communicating with a deprecated api on a site that supports the newer frameworks?". I know the xml_api is deprecated in this release however I don't think I am explicitly using it here, even so this code works from customer portal so unless there is some other limitation between custom process v customer portal?

      How would I check if I am on a commercial or regulated pod?



    • Ross Crockett

      As an update to this, I checked that I can do a straight POST to the endpoint I need just using plain old cURL. That works fine so it's not a firewall issue, but I would still like to use NuSOAP as the code is more readable and I have to do less parsing.


    • Roderick Peace

      RE: xml_api | My comment may have come from my miss reading the trace output supplied. It looked to me on first glance like your page was calling back to a url down /cgi-bin/[myinterface].cfg/php/xml_api.

      Are you running this process asynchronously? I ask because I expect it might be timing out after a few seconds due to some network connectivity issue or latency some where and if it does you won't get back any return value from nusoap.

      Will this cpm run often?
      I know its cleaner to use a library rather than capturing the current output from your cp page and hard codeing it but I'm curious if that consideration out ways the additional over head of loading nusoap, getting and consuming the wsdl, etc. 

    • Ross Crockett

      Hey Roderick,

      I've tried running this in real time and asynchronously but get the same result. The constructor for nusoap_client takes timeout parameters which I have set at 30 seconds each (see line 14 of the code block above). The output and error happen pretty much instantly though, so it's not timeout.

      What's the second solution you mention? Calling a customer portal page from the event handler and reading the response? Perhaps I don't understand it but it doesn't sound right.

    • Shreyas Pandhari

      Hi Ross,

      Though not sure on the scenario you are working on, just to confirm whether you are using the on-premise application or cloud? If your wsdl is directly accessible via URL in either case then you can just use client->call() to call your wsdl operation:

      $client=new \nusoap_client($wsdl, 'wsdl');
      $client->soap_defencoding = 'UTF-8';
      $client->debug_flag = false;
      $lk = "7058";
      $result=$client->call('GetQuote', array('StockSymbol' => $obj->Subject, 'LicenseKey' => $lk));
      Ignore the parameters which I am passing, those are scenario specific but this way you can send the input to your service. You can parse the response you get thereafter and save it in RN object field.
      I hope this is what to want to achieve. It works perfectly in CPM of Feb 14 version not sure about the backward versions.
    • Ross Crockett

      Hey Shreyas.

      I am using the cloud version, not on-premise. I am attaching the current test file, would someone with NuSOAP also in their env be able to test it out and see if they get the same issue?

      You will have to change the interface on line 37 but everything else should work. I've temporarily changed the webservice being called to a open web service which does currency conversion as a proof of concept.

      If you see more output after "Instantiating client" then you're doing better than me.



    • Joan Gazel

      Same exact problem here with a Nov'14 site : curl works perfectly inside CPM but a call to new \soap_client make the process execution to quit immediately.


      Does someone here use nusoap inside CPM ?

      Do I need to ask Oracle to set something up to use nusoap from CPM ?

    • Roderick Peace

      I don't believe nusoap can be used in a cpm easily.
      Most people just build up their soap request in pure php and execute curl.

      Not Ideal but it works every time.


    • Joan Gazel

      Thanks for your answer Roderick.

      Yes curl works : if you just need to push information it's perfect, but if you also need to parse the XML answer to extract some information you feel like you have been teleported twenty years ago

    • Praveen Puvvada

      I tried to instantiate a WSDL through nusoap_client but there was the same problem as pointed in the post before so thought of using CURL for the same.

      Can some one provide sample code to instantiate a WSDL in CURL, I tried as shown in below code through CPM but the process simply terminated after the click on test:

      public static function apply($runMode, $action, $obj, $cycle)
              if ($cycle !== 0) return;       
              if (RNCPM\ActionCreate == $action)
                      /*Load curl*/
                      $handle = curl_init(); 
                      curl_setopt($handle, CURLOPT_URL, $url);                
                      curl_setopt($handle, CURLOPT_SSL_VERIFYPEER, false);                
                      curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
                      $data = curl_exec($handle);
                      $json = json_decode($data);
                  catch (Exception $err)
                      echo $err;

      Thanks In Advance


    • Roderick Peace

      The simple answer is Curl won't do anything auto magically with the WSDL.
      Its simply a conduit for sending / retrieving data.
      Unfortunately we don't have a library that automates using soap in CPHP, its up to you to build your own pure php implementation at this point.

    • Ben Johns

      Not sure if this is related to your issue, but I've had problems calling the \load_curl() function directly in async CPMs (described here: Try wrapping it in a conditional:

      if (!function_exists("\curl_init"))