PHP SOAP call, if soapfault try 2 more times then continue

Discussion in 'PHP' started by zep007, Oct 22, 2008.

  1. #1
    Hey all,

    I am writing a script to hit a web service and put the info in to my database, unfortunately, sometimes the soap call comes back with bad headers, and my script stops. Id like to hit the service, and if it comes back with an error, try again 2 more times before giving up, and moving to the next call.

    I tried something like this
    do {
    $response = $client->getProductDetail($objRequest);
    } while (true == is_soap_fault($response));

    to see if it would loop (I know it doesn't try 3 times), but it just gives me the error and stops

    Im executing this through SSH when I root into my server, so I can echo where I am in the script as it executes, and see where/what the issue is.

    Any one know how I might achieve this?

    Thanks!
     
    zep007, Oct 22, 2008 IP
  2. keyaa

    keyaa Peon

    Messages:
    137
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Did you set exceptions to 0 when creating the SOAP Client Object?
     
    keyaa, Oct 22, 2008 IP
  3. zep007

    zep007 Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Your comment got me on the right track to make the script work.

    I do have one other question, if my php script fails or there is a soap fault, is there a way to make the whole thing restart?

    I plan on storing the current position of the script in my database, then on error restart, grab the position and continue.

    Is this possible? I just need to know how to restart the script, the rest I can handle. Thanks!
     
    zep007, Oct 22, 2008 IP