Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4097474
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T20:10:42+00:00 2026-05-20T20:10:42+00:00

I’m writing a PHP application which uses a number of SOAP web services to

  • 0

I’m writing a PHP application which uses a number of SOAP web services to gather data.

I’m getting significant overheads in instantiating all those objects: in some cases a single line of code $object = new SoapClient($wsdl); can take over three seconds. It obviously only takes a few of those to make a web page feel really slow.

To speed things up a bit, I figured I’d serialise the objects and store them in the session (or somewhere similar), so I wrote the following function:

function soap_client($name,$wsdl) {
    if (!isset($_SESSION['soapobjects'][$name])) {
        $client = new SoapClient($wsdl, array('trace' => 1));
            $_SESSION['soapobjects'][$name]=serialize($client);
        } else {
            $client = unserialize($_SESSION['soapobjects'][$name]);
        }
    return $client;
}

That certainly seems to be the way PHP recommends to do it.

…and then calling it like this…

$client = soap_client('servicename',$wsdl);
$client->MethodName($parameters);

However, it doesn’t seem to work.

The first time you run it, it works (ie the object is created and a serialised copy is made, and the method call works fine). However the second time you run it, it fails.

The object appears to serialise and de-serialise correctly, but when you try to execute a SOAP call on the de-serialised object, it throws the following error:

Fatal error: Uncaught SoapFault exception: [Client] Error finding "uri" property

Clearly the de-serialised object is not the same as the original object, which is at odds with how object serialisation is supposed to work.

Can anyone explain why I’m getting this error? Can you suggest a way to get it working, or an alternative strategy that I could be persuing?

Thank you.

ps – I’ve tried to work around the problem, but no joy.

I’ve tried specifying the URI in the options parameter (as specified in the PHP SOAP Client manual), but it didn’t make any difference. But it shouldn’t be necessary anyway, as I’m using a WSDL.

I’ve also tried simply copying the object to $_SESSION, without using serialize() and deserialize(), but that has exactly the same effect.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T20:10:42+00:00Added an answer on May 20, 2026 at 8:10 pm

    The built-in SOAP extension is an undebuggable binary blob of horrors. It’s very likely that it was not built with serialization in mind. For example, it could contain an internal filehandle that won’t survive the serialize/unserialize process. I urge you to use some other SOAP client, such as:

    • Zend_Soap, part of the Zend Framework. You don’t need to use the Framework in any other area of your code, and can probably remove most of the other components. However, it seems to use the existing SOAP extension under the covers, so it’s probably not a good candidate for serialization.
    • PEAR’s SOAP is frequently referenced, though it’s a bit old.
    • NuSOAP has recently been brought back from the dead, though all of the online documentation appears to have disappeared into zip files.

    If none of these are suitable, consider caching the WSDL file locally, as I somehow expect that’s where the delay is.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I want to count how many characters a certain string has in PHP, but
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.