ExpressionEngine CMS
Open, Free, Amazing

Thread

This is an archived forum and the content is probably no longer relevant, but is provided here for posterity.

The active forums are here.

A rant about SOAP/NuSOAP

August 09, 2011 6:58pm

Subscribe [6]
  • #1 / Aug 09, 2011 6:58pm

    ToddyBoy

    21 posts

    Put simply, I’m having a really hard time trying to wrap my head around SOAP and how to implement it for a project.  I’ve been using CI for a couple of years now and am used to the MVC method of programming but SOAP is just doing my head in.

    I’ve been reading forum posts on this forum and looking up articles on how to integrate SOAP, more specifically, NuSOAP with CI and feel like I’m drowning.  I’m almost at the point where I will ditch CI for the project and try to handle SOAP/NuSOAP with standard PHP.  It’s not what my boss wants me but he’s not the one doing it so he’ll have to deal with it.

    /rant

  • #2 / Nov 14, 2011 11:18pm

    Does anyone have links to any project or tutorial that uses CI with SOAP? That would be helpful.

  • #3 / Nov 14, 2011 11:41pm

    CroNiX

    4713 posts

    You can google for some, but it is pretty easy to integrate nusoap in ci.

    1) Download nusoap
    2) put the nusoap folder in /application/libraries/Nusoap

    That’s it!  Now use it.
    in a controller:

    //instantiate nusoap
    require_once(APPPATH.'libraries/Nusoap/nusoap.php');
    
    //set the url to the soapserver interface
    $client = new nusoap_client('https://soapserver.com/services/clientWSDL_1-3.php');
    
    //create an array of parameters to be sent to soap server:
    $n_params = array(
      'cid'  => 'f118f93',
      'password'  => 'pass',
      'leadName' => 'Test From API2',
      'leadEmail' => '[email protected]'
    );
    
    //call the soap server and send it our data
    $result = $client->call('addEditLead', $n_params);
    
    //check our response
    if ($client->fault)
    {
      echo '<h2>Fault</h2><p><pre>';<br />
      print_r($result);<br />
      echo '</p>
    </pre><p>‘;<br />
    } else {<br />
    // Check for errors<br />
    $err = $client->getError();<br />
    if ($err) {<br />
      // Display the error<br />
      echo '</p><h2>Error</h2><pre>' . $err . '</pre><p>‘;<br />
    } else {<br />
      // Display the result<br />
      echo '</p><h2>Result</h2><pre>';
      print_r($result);
      echo '</pre><p>‘;<br />
    }<br />
    echo ‘</p><h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES) . '</pre><p>‘;<br />
    echo ‘</p><h2>Response</h2><pre>' . htmlspecialchars($client->response, ENT_QUOTES) . '</pre><p>‘;<br />
    echo ‘</p><h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES) . '</pre><p>‘;
    </pre>

  • #4 / Nov 17, 2011 12:57pm

    Gbecaro

    42 posts

    this week my nusoap started having issues when im in internet explorer… cant find why yet…

  • #5 / Nov 24, 2011 4:18am

    wendieB

    1 posts

    Just search on google or yahoo.

  • #6 / Dec 01, 2011 12:59pm

    jimmykak

    12 posts

    Its not just that easy….

  • #7 / Dec 08, 2011 8:03pm

    daveaton

    2 posts

    I agree with @jimmykak it’s not just that easy, all the methods and work arounds are for pre 2.X and don’t work anymore, I been looking for about 5 days so far.  There are tons of tutorials out there but they don’t work anymore with 2.x

  • #8 / Dec 08, 2011 8:37pm

    daveaton

    2 posts

    I thought it was working but it’s really not.

.(JavaScript must be enabled to view this email address)

ExpressionEngine News!

#eecms, #events, #releases