I got it to work! What I had to do is make an associtive array with the keys 
being the name of the params that needed to get passed to the 'execute' method 
that it was calling via soap.  Or conversely you could write the $params as 
objects instead of an array.

Code below:

$params["From"] = "06/01/2005"; // also can use $params->From = "date";
$params["to"] = "12/31/2005"; // also can use $params->to = "date";

$client = new SoapClient("some.wsdl", array("trace" => 1, "exceptions" => 0));

try {
        print($client->execute($params));
} catch (SoapFault $exception) {
        echo $exception;
}


-----Original Message-----
From: Jay Paulson (CE CEN) [mailto:[EMAIL PROTECTED]
Sent: Tue 1/10/2006 11:32 AM
To: php-general@lists.php.net
Subject: [PHP] SOAP Problems.
 
I'm trying to call a SOAP service where you pass it a couple of dates and it is 
supposed to return stuff.  My testing code is below along with the errors I'm 
getting.  What's strange is that it's not working in php but it works perfectly 
in Flash.  The request it is sending is only sending one param the $to value 
and not the $from value.  Any idea what's going on?

$from = "06/01/2005"; // some date but what format?
$to = "12/31/2005"; // some date but what format?

$client = new SoapClient("some.wsdl", array("trace" => 1, "exceptions" => 0));

var_dump($client->__getFunctions());
echo "<br><br>";
var_dump($client->__getTypes());
echo "<br><br>";

try {
        print($client->execute($from, $to));
} catch (SoapFault $exception) {
        echo $exception;
}
$client->execute($from, $to);
print "<pre>\n";
print "Request :\n".htmlspecialchars($client->__getLastRequest()) ."\n";
print "Response:\n".htmlspecialchars($client->__getLastResponse())."\n";
print "</pre>";

var_dump($client->execute($from, $to));
echo "<br><br>";

echo "<br><br>";
print($client->__soapCall("execute", array("From" => $from, "to" => $to)));



array(1) { [0]=>  string(44) "executeResponse execute(execute $parameters)" }

array(2) { [0]=> string(44) "struct execute { string From; string to; }" [1]=> 
string(44) "struct executeResponse { string wsReturn; }" }

SoapFault exception: [soapenv:Server.userException] [TeamworksException 
name='Process: 'HR Training Infomation' ProcessItem: 'Untitled0' Type: 'ITEM'', 
message='Internal Script error: org.mozilla.javascript.WrappedException: 
WrappedException of ORA-01858: a non-numeric character was found where a 
numeric was expected ', line=-1, pos=-1 nested=] in 
/Library/WebServer/Documents/services/soap-test.php:9 Stack trace: #0 
/Library/WebServer/Documents/services/soap-test.php(9): 
SoapClient->__call('execute', Array) #1 
/Library/WebServer/Documents/services/soap-test.php(9): 
SoapClient->execute('06/01/2005', '12/31/2005') #2 {main}

Request :
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:ns1="somens"><SOAP-ENV:Body><ns1:execute/><param1>12/31/2005</param1></SOAP-ENV:Body></SOAP-ENV:Envelope>

Response:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"; 
xmlns:xsd="http://www.w3.org/2001/XMLSchema"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode>soapenv:Server.userException</faultcode>
   <faultstring>[TeamworksException name=&apos;Process: &apos;HR Training 
Infomation&apos; ProcessItem: &apos;Untitled0&apos; Type: 
&apos;ITEM&apos;&apos;, message=&apos;Internal Script error: 
org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a 
non-numeric character was found where a numeric was expected
&apos;, line=-1, pos=-1 nested=&lt;none&gt;]</faultstring>
   <detail/>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>



object(SoapFault)#2 (9) { ["message:protected"]=> string(0) "" 
["string:private"]=> string(0) "" ["code:protected"]=> int(0) 
["file:protected"]=> string(51) 
"/Library/WebServer/Documents/services/soap-test.php" ["line:protected"]=> 
int(16) ["trace:private"]=> array(2) { [0]=> array(6) { ["file"]=> string(51) 
"/Library/WebServer/Documents/services/soap-test.php" ["line"]=> int(16) 
["function"]=> string(6) "__call" ["class"]=> string(10) "SoapClient" 
["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(7) "execute" [1]=> 
array(2) { [0]=> string(10) "06/01/2005" [1]=> string(10) "12/31/2005" } } } 
[1]=> array(6) { ["file"]=> string(51) 
"/Library/WebServer/Documents/services/soap-test.php" ["line"]=> int(16) 
["function"]=> string(7) "execute" ["class"]=> string(10) "SoapClient" 
["type"]=> string(2) "->" ["args"]=> array(2) { [0]=> string(10) "06/01/2005" 
[1]=> string(10) "12/31/2005" } } } ["faultstring"]=> string(300) 
"[TeamworksException name='Process: 'HR Training Infomation' ProcessItem: 
'Untitled0' Type: 'ITEM'', message='Internal Script error: 
org.mozilla.javascript.WrappedException: WrappedException of ORA-01858: a 
non-numeric character was found where a numeric was expected ', line=-1, pos=-1 
nested=]" ["faultcode"]=> string(28) "soapenv:Server.userException" 
["detail"]=> string(0) "" }

SoapFault exception: [soapenv:Server.userException] [TeamworksException 
name='Process: 'HR Training Infomation' ProcessItem: 'Untitled0' Type: 'ITEM'', 
message='Internal Script error: org.mozilla.javascript.WrappedException: 
WrappedException of ORA-01858: a non-numeric character was found where a 
numeric was expected ', line=-1, pos=-1 nested=] in 
/Library/WebServer/Documents/services/soap-test.php:17 Stack trace: #0 
/Library/WebServer/Documents/services/soap-test.php(17): 
SoapClient->__soapCall('execute', Array) #1 {main}

  • [PHP] SOAP Problems. Jay Paulson \(CE CEN\)
    • RE: [PHP] SOAP Problems SOLVED! Jay Paulson \(CE CEN\)

Reply via email to