Hmmm.
Do you use an auto_(ap|pre)pend_file on you dev servers? If so is this configured on the live server?
Main Topics
Browse All TopicsDear 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.
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.
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.
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.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
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.
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
Here is the URL where you can see the whole error message:
http://www.stockxpert.com/
Sure, this is the client:
<?php
$client = new SoapClient("sxc.wsdl");
print_r($client->delete("p
?>
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_e
$server = new SoapServer("sxc.wsdl");
$server->addFunction("logi
$server->addFunction("uplo
$server->addFunction("dele
$server->handle();
?>
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($use
$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) {
...
}
?>
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://sch
<types>
<xsd:schema targetNamespace="urn:sxc">
<xsd:import namespace="http://schemas.
<xsd:import namespace="http://schemas.
<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:uploadRespons
</operation>
<operation name="delete">
<documentation>delete test</documentation>
<input message="tns:deleteRequest
<output message="tns:deleteRespons
</operation>
</portType>
<binding name="sxcBinding" type="tns:sxcPortType">
<soap:binding style="rpc" transport="http://schemas.
<operation name="login">
<soap:operation soapAction="urn:sxc#login"
<input>
<soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://sche
</input>
<output>
<soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://sche
</output>
</operation>
<operation name="upload">
<soap:operation soapAction="urn:sxc#upload
<input>
<soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://sche
</input>
<output>
<soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://sche
</output>
</operation>
<operation name="delete">
<soap:operation soapAction="urn:sxc#delete
<input>
<soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://sche
</input>
<output>
<soap:body use="encoded" namespace="urn:sxc" encodingStyle="http://sche
</output>
</operation>
</binding>
<service name="sxc">
<port name="sxcPort" binding="tns:sxcBinding">
<soap:address location="http://stockxper
</port>
</service>
</definitions>
http://stockxpert.com/plug
Outputs ...
<envelope SOAP-ENV="http://schemas.x
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_d
settings on both platforms.
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_
This will also generate the SOAP fault of ...
soap_server_fault("Server"
So. I think this is the issue.
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?
Business Accounts
Answer for Membership
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.