Looking for sample SOAP applications to test

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • whitep8
    New Member
    • Oct 2009
    • 65

    Looking for sample SOAP applications to test

    Can anybody show me a sample SOAP application that works? All the examples i've tried don't seem to work. Im certainly not new to PHP but soap is causing real pain.

    Ive got the nusoap.php file in the root and all file permissions are fine but EVERY SINGLE example fails to load. My server has SOAP activated and is definitly running PHP 5. Ive ran a whole load of tutorials and all i get is a white screen.
  • Atli
    Recognized Expert Expert
    • Nov 2006
    • 5062

    #2
    Hey.

    What have you been trying? Can we see an example?

    I've been reading a bit about SOAP myself recently, and I've managed to get the nuSOAP client working fine. I've been using this code:
    [code=php]<?php
    header('content-type: text/plain; charset=UTF-8');
    error_reporting (E_ALL + E_NOTICE - E_STRICT - E_DEPRECATED);
    require_once('n usoap/nusoap.php');

    // Create a SOAP client and make sure it connected OK
    $client = new nusoap_client(' http://www.ecubicle.ne t/iptocountry.asm x?wsdl', 'wsdl');
    $error = $client->getError();
    if ($error)
    {
    echo "--- ERROR ---\n";
    print_r($error) ;
    echo "\n---\ERROR ---\n";
    }
    else
    {
    // Call the SOAP function
    $param = array('V4IPAddr ess' => '<-- INSERT IP ADDRESS HERE -->');
    $result = $client->call('FindCoun tryAsString', array('paramete rs' => $param), '', '', false, true);

    // Check if there was a fault
    if ($client->fault)
    {
    echo "--- FAULT ---\n";
    print_r($result );
    echo "\n---\FAULT ---\n";
    }
    else
    {
    // Check if there were any errors.
    $error = $client->getError();
    if ($error)
    {
    echo "--- ERROR ---\n";
    print_r($error) ;
    echo "\n---\ERROR ---\n";
    }
    else
    {
    // Display the result
    echo "--- RESULT ---\n";
    print_r($result );
    echo "\n---\RESULT ---\n";
    }
    }

    // Print debug info
    echo <<<DEBUG


    -------------
    --- DEBUG ---
    -------------

    --- REQUEST ---
    {$client->request}
    ---\REQUEST ---

    --- Response ---
    {$client->response}
    ---\Response ---

    --- Debug ---
    {$client->debug_str}
    ---\Debug ---
    DEBUG;
    }
    ?>[/code]
    Found the SOAP service I'm using there online. It's a free IP to geo-location thing.

    Haven't really done much research into putting up a SOAP server though. I'm only really interested in using a SOAP service at the moment.

    Comment

    • whitep8
      New Member
      • Oct 2009
      • 65

      #3
      Hi,

      Thanks for getting back to me. Ive had almost no responses at all regarding this. All of the online documentation delivers a white screen. Its not like usual PHP when at least you get an error message.

      Comment

      • whitep8
        New Member
        • Oct 2009
        • 65

        #4
        Even this example gives me a white screen.

        Did you do anything at all to get an output? i have soap activated on my system

        Comment

        Working...