11

Quick one, How would you go about checking if your connection to a soap server is actually connecting?

I have this code:

$m_wsdl = "https://m2mconnect.orange.co.uk/orange-soap/services/MessageServiceByCountry?wsdl";
    try {
        $client = new SoapClient($m_wsdl);

        $this->m_messages = $client->peekMessages('','',10,"");
    } catch (Exception $e) {

        echo "Exception: \n" . $e->getMessage() . "\n";
    }

    $this->do_parse_xml();

Obviously my username and password are in the peekmessages field where they should be, and they are both correct i am 100%.

For some reason its not returning any data at all and i dont know how to check to see if the connection is actually working??

Im getting no exceptions being echo'd

Thanks for any help

1 Answer 1

2

Use isSoapFault() http://php.net/manual/en/function.is-soap-fault.php

Also, the peekMessages method would probably return false or a SoapFault.

You can also set Exceptions to true on the SoapClient

2
  • Why will the peekMessages return a fault or false? Thanks
    – Tom Burman
    Commented Jan 10, 2013 at 22:49
  • Many PHP functions have a mixed return type. That way you can do something like if($client->$peekMessages) { blah blah blah }. Commented Jan 12, 2013 at 20:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.