PHP SOAP Extension Addition

July 11, 2005

I made a post a while back about the new PHP5 Soap Extension not supporting dynamic locations for web services. It appears to be fixed and in the 5.0.4 version.

You can now do something like:

  1.  
  2. <?php
  3. $client = new SoapClient("http://some.host.net/wsdl/somefile.wsdl",array("location" => 'myurl.com'));
  4. ?>


The problem was that the soap ext looked in the wsdl file for the location of the web service. Well if you distributed your product or wanted to have a development location you had to maintain seperate wsdl files for each location. This fix addresses the problem and works just nicely. Thanks Andi!

Comments

RSS feed for comments on this post.

  1. Eddie Peloke says:
    July 11, 2005 @ 15:36 — Reply

    Couldn't you do this before and not use wsdl? Just pass in a null and then pass in the info as the second param?

  2. Jim says:
    July 11, 2005 @ 15:46 — Reply

    yep you could but realistically you're almost always using a WSDL file so to have to not use an available WSDL because of PHP's shortcoming was not ideal so you couldn't do $client->getAccount('jim'); you'd have to use __call and specify a bunch of other crap.

  3. Eddie Peloke says:
    July 11, 2005 @ 16:08 — Reply

    Yeah and I think you have to bundle your params to each method as an array as the SOAP client didn't know how many params to expect for each method...right?.....yuk. That is the great thing about open source....bugs and features are added constantly and releases are often, no waiting indefinitely for the next version.

  4. Stefan says:
    November 11, 2006 @ 12:10 — Reply

    Hello Jim, I am currently starting to learn SOAP with PHP. I am hitting lots of problems due to php caching of WSDL files. So every time I change the WSDL file, i have to copy them to new files. This really hinders trial and error approaches or learning. I already disabled caching within PHP. Do you mind helping me out a bit and doing an initial looking over my shoulders until I got started? My email is sb at bluhm-de dot com. This would be greatly appreciated. Best wishes, Stefan

  5. Louis Vuitton handbags says:
    June 16, 2010 @ 01:38 — Reply

    Comment pending moderation

Leave a Comment

Line and paragraph breaks automatic, HTML allowed: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <code> <em> <i> <strike> <strong>

Comments disabled due to spammers being losers that lead sad lives.