Question

PHP SOAP Uncaught exception - might depend on server settings?

Asked by: aburany

Dear Experts,
I have a problem with a SOAP webservice written in PHP. The webservice is written by me and is used for a stock photography site to give the ability for external applications to upload images to the site.
The code worked perfectly on an old server, it works perfectly in the new dev environment but on production server with the exactly same piece of code I get the following error:
Fatal error: Uncaught SoapFault exception (...)
There shouldn't be any PHP-include errors, as if I call the PHP functions directly, they do the work well, but the same called from an external app or called through a PHP client run on the server this error is returned.
Might this happen because of different system setup or PHP settings? The php.ini, regarding SOAP related functions seem the same. Same PHP and Apache version as well. What other setting should be looked after?
Am chasing the problem in the right direction (server difference?) or this error is probably caused by something completely different?
If needed, I can post here some codes and the WSDL file as well.
Would appreciate any ideas that would come up to your mind, I'm getting pretty clueless. Thank you!

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2007-08-15 at 04:09:16ID22763767
Tags

php

,

uncaught

,

soapfault

,

soap

Topics

SOAP

,

WebApplications

,

PHP Scripting Language

Participating Experts
3
Points
0
Comments
24

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. problem with EasyPHP 3 extensions soap
    Hello I am using Easyphp3 on my local machine, trying to use it as a soap server and client at the same time (for educative porpuses), when I execute my soap client I get the next errors: Notice: Use of undefined constant soap - assumed 'soap' in C:\Program Files\EasyPHP 3.0\...
  2. Php And Soap
    Hi i have an issue during connecting this web service ; POST /wserv/xxx.asmx HTTP/1.1 Host: www.xxxx.xxxx.tr Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://www.xxxx.com.tr/wserv/GetStockData" <?xml version="1.0" encodi...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: RQuadlingPosted on 2007-08-17 at 03:36:19ID: 19715687

Can you show the code generating the exception?

It's going to be a trial and error issue to resolve.

Also, make sure you have the same version of all related dlls/extensions on the live server and of PHP itself.

Run this as info.php

<?php phpinfo(); ?>

on all the servers and check the differences.

Paying attention to SOAP settings.

Make sure the SOAP cache folder exists and you have permissions.

Output for Soap from php -i for me ...

soap

Soap Client => enabled
Soap Server => enabled

Directive => Local Value => Master Value
soap.wsdl_cache => 1 => 1
soap.wsdl_cache_dir => D:\Data\PHP\SOAP_Cache => D:\Data\PHP\SOAP_Cache
soap.wsdl_cache_enabled => 1 => 1
soap.wsdl_cache_limit => 5 => 5
soap.wsdl_cache_ttl => 86400 => 86400


Erm.

That's all I can think of for the time being.

 

by: RQuadlingPosted on 2007-08-17 at 03:37:00ID: 19715689

Hmmm.

Do you use an auto_(ap|pre)pend_file on you dev servers? If so is this configured on the live server?

 

by: aburanyPosted on 2007-08-22 at 03:28:06ID: 19744822

Thank you for your answers!

First of all, we don't use append/prepend files. Otherwise here is a list of differences between dev and production servers I found in PHP, can this indicate you something important maybe?

On production there's eAcc also installed:
with eAccelerator v0.9.5, Copyright (c) 2004-2006 eAccelerator, by eAccelerator

Keep Alive set to ON on dev, OFF on production
Max Requests            Keep Alive: off

extra modules here:
Loaded Modules   mod_info mod_rewrite mod_ssl

HTTP headers:
on dev: Connection       close
on prod: Keep-Alive       timeout=5, max=100
       Connection       Keep-Alive

session values (lifetime, gc_probabilty) are different, though I think those wouldn't make any change

SOAP settings are the same on both boxes, and are the following:
Soap Client       enabled
Soap Server       enabled

Directive      Local Value      Master Value
soap.wsdl_cache_dir      /tmp      /tmp
soap.wsdl_cache_enabled      1      1
soap.wsdl_cache_ttl      86400      86400

 

by: RQuadlingPosted on 2007-08-22 at 03:41:22ID: 19744870

What's in the exception. Can you show the FULL error. It may have nothing to do with config.

For example, file permissions, or DB access or something like that.

 

by: RQuadlingPosted on 2007-08-22 at 03:41:46ID: 19744873

If you've got a URL we can see the error if it is too complicated, then that would be useful.

 

by: aburanyPosted on 2007-08-22 at 04:48:07ID: 19745146

Here is the URL where you can see the whole error message:

http://www.stockxpert.com/plugin/client_delete.php

 

by: RQuadlingPosted on 2007-08-22 at 05:10:43ID: 19745295

Can you show the code for __doRequest(). I would like to see the entire XML being generated and any response you may get.

 

by: aburanyPosted on 2007-08-22 at 05:16:25ID: 19745341

Sure, this is the client:

<?php
  $client = new SoapClient("sxc.wsdl");

  print_r($client->delete("plugintest","1234", "testphoto2.jpg"));
?>

and this is the server:

<?php

require_once ("common_ws.php");
      
function login($username, $password) {
      return ws_login ($username, $password);
}

function upload($username, $password, $title, $caption, $keywords, $filename) {
      return ws_upload ($username, $password, $title, $caption, $keywords, $filename);
}

function delete($username, $password, $files) {
      return ws_delete ($username, $password, $files);
}

ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache

$server = new SoapServer("sxc.wsdl");
$server->addFunction("login");
$server->addFunction("upload");
$server->addFunction("delete");
$server->handle();
?>

 

by: RQuadlingPosted on 2007-08-22 at 05:18:26ID: 19745353

Drilling down ... ws_delete() please?

 

by: aburanyPosted on 2007-08-22 at 05:24:39ID: 19745406

It is in common_ws.php, a usual PHP file containing these functions. If I call those functions separately, they run well, returning the array needed. Just if called as SOAP webservice from the client above it fails. Here is the code for ws_common: (pointed out ... the other two functions in order not to make this post here too long:

<?

require_once ("../common.phtml");
require_once ("../../common.php");
include "iptc_lib.php";

function ws_login ($username, $password) {
...
      }

      function ws_delete ($username, $password, $files) {
            $loginres = ws_login ($username, $password);
      
            if ($loginres['status_num'] != 0)
                  return ($loginres);

            briefcase_chkdir($username);
            $dir=briefcase_getdir($username);

            $files = explode (",",$files);
            if (!is_array ($files))
                  return (array ('status_num' => '10', 'status_msg' => 'No files provided.'));
            foreach ($files as $f) {
                  if (is_file ($dir ."/". $f)) {
                        $fname = $dir ."/" .$f;
                        if (!unlink ($fname))
                              $error = true;
            }
            else {
                        $error = true;
                  }
                  }
            if ($error) {
                  return (array ('status_num' => '10', 'status_msg' => 'Could not delete all files.'));
                  }
            else {
                  return (array ('status_num' => '0', 'status_msg' => 'Successfully removed all files.'));
            }
      }
      
function ws_upload ($username, $password, $title, $caption, $keywords, $filename) {
...
}

?>

 

by: RQuadlingPosted on 2007-08-22 at 05:29:00ID: 19745425

Ah.

SoapClient->__call() - Calls a SOAP function (deprecated)

This method is deprecated. Use SoapClient->__soapCall() instead of it.


I can't tell you when it was deprecated.

 

by: RQuadlingPosted on 2007-08-22 at 05:33:17ID: 19745453

Can you show the wdsl file also.

 

by: aburanyPosted on 2007-08-22 at 05:36:53ID: 19745478

Hmm, but where was the call function in my code...?

Here is the WSDL:

<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:sxc" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="urn:sxc">
<types>
<xsd:schema targetNamespace="urn:sxc">
  <xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
  <xsd:import namespace="http://schemas.xmlsoap.org/wsdl/" />
<xsd:complexType name="Status">
<xsd:all>
  <xsd:element name="status_num" type="xsd:int" />
  <xsd:element name="status_msg" type="xsd:string" />
  </xsd:all>
  </xsd:complexType>
  </xsd:schema>
  </types>
<message name="loginRequest">
  <part name="username" type="xsd:string" />
  <part name="password" type="xsd:string" />
  </message>
<message name="loginResponse">
  <part name="return" type="tns:Status" />
  </message>
<message name="uploadRequest">
  <part name="username" type="xsd:string" />
  <part name="password" type="xsd:string" />
  <part name="title" type="xsd:string" />
  <part name="caption" type="xsd:string" />
  <part name="keywords" type="xsd:string" />
  <part name="base64_photo" type="xsd:string" />
  </message>
<message name="uploadResponse">
  <part name="return" type="tns:Status" />
  </message>
<message name="deleteRequest">
  <part name="username" type="xsd:string" />
  <part name="password" type="xsd:string" />
  <part name="files" type="xsd:string" />
  </message>
<message name="deleteResponse">
  <part name="return" type="tns:Status" />
  </message>
<portType name="sxcPortType">
<operation name="login">
  <documentation>check for login validity</documentation>
  <input message="tns:loginRequest" />
  <output message="tns:loginResponse" />
  </operation>
<operation name="upload">
  <documentation>upload test</documentation>
  <input message="tns:uploadRequest" />
  <output message="tns:uploadResponse" />
  </operation>
<operation name="delete">
  <documentation>delete test</documentation>
  <input message="tns:deleteRequest" />
  <output message="tns:deleteResponse" />
  </operation>
  </portType>
<binding name="sxcBinding" type="tns:sxcPortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
<operation name="login">
  <soap:operation soapAction="urn:sxc#login" style="rpc" />
<input>
  <soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </input>
<output>
  <soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </output>
  </operation>
<operation name="upload">
  <soap:operation soapAction="urn:sxc#upload" style="rpc" />
<input>
  <soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </input>
<output>
  <soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </output>
  </operation>
<operation name="delete">
  <soap:operation soapAction="urn:sxc#delete" style="rpc" />
<input>
  <soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </input>
<output>
  <soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" />
  </output>
  </operation>
  </binding>
<service name="sxc">
<port name="sxcPort" binding="tns:sxcBinding">
  <soap:address location="http://stockxpert.com/plugin/sxc_wsdl.php" />
  </port>
  </service>
  </definitions>

 

by: RQuadlingPosted on 2007-08-22 at 05:37:19ID: 19745482

wsdl  file.

 

by: aburanyPosted on 2007-08-22 at 05:43:45ID: 19745522

Actually, sxc_wsdl.php is the server. (sorry for bit messed up naming)

 

by: RQuadlingPosted on 2007-08-22 at 06:27:21ID: 19745876

http://stockxpert.com/plugin/sxc_wsdl.php

Outputs ...

<envelope SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><body><fault><faultcode>SOAP-ENV:Server</faultcode><faultstring>Bad Request. Can't find HTTP_RAW_POST_DATA</faultstring></fault></body></envelope>

What OS and webserver are the servers?

I vaguely remember this being an issue.

Can you check the

; Always populate the $HTTP_RAW_POST_DATA variable.
always_populate_raw_post_data = On

settings on both platforms.

 

by: aburanyPosted on 2007-08-22 at 08:21:11ID: 19746967

; Always populate the $HTTP_RAW_POST_DATA variable.
always_populate_raw_post_data = On

it's commented out on both servers - have a ; before always_populate_raw_post_data = On

The servers are Ubuntu Linux, Apache2, PHP 5.1.2

 

by: RQuadlingPosted on 2007-08-23 at 00:33:29ID: 19752169

Remove the ;

I am pretty sure that there is a way, even uncommented, that this field is NOT populated.

Checking source ...

 

by: RQuadlingPosted on 2007-08-23 at 00:40:13ID: 19752187

From what I can tell, if you are sending the data via POST, then you use $_POST. If you are NOT using POST then you CAN use $HTTP_RAW_POST_DATA which seems wrong to me, but I may be reading that wrong.

Hmm.

soap.c is slightly different.

Can you check your php error log. There should be messages like ...

PHP-SOAP requires 'always_populate_raw_post_data' to be on please check your php.ini file

This will also generate the SOAP fault of ...

soap_server_fault("Server", "Bad Request. Can't find HTTP_RAW_POST_DATA" ...);

So. I think this is the issue.

 

by: aburanyPosted on 2007-09-18 at 03:55:49ID: 19911610

Dear Sage,

sorry for the long delay - in the end there was a solution found to the problem. It wasn't exactly server setting related, but DNS related - due to some misconfiguration, the www.domain... from inside the server wasn't pointing back to the server, but to the load balancer in front of fronteds - this way, the server PHP couldn't be found from the WSDL file. After some configuring of DNS zone files the webservice worked perfectly.
I appreciate all your efforts to help with this, and would happily give you the points on this - however, I wouldn't accept one of your answers which wasn't exactly the solution. Could you advise me please how can I still add points?

 

by: RQuadlingPosted on 2007-09-19 at 01:05:46ID: 19918916

If none of the comments constitute an answer, then you can ask for a refund in Community Support.

 

by: Computer101Posted on 2008-01-14 at 18:19:43ID: 20659544

PAQed with points refunded (500)

Computer101
EE Admin

 

by: jbmrajaPosted on 2009-09-16 at 04:49:41ID: 25344445

Can u explain this term "After some configuring of DNS zone files the webservice worked perfectly". What is the configuration u made to work the service fine?

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...