RE: Trouble with PHP using Cache Webservice

244 views
Skip to first unread message

Rich Taylor

unread,
Apr 13, 2009, 5:57:33 PM4/13/09
to Oleg Olenin, wwsaleseng, intersystems...@googlegroups.com
I am tracing down the Security issue, but I did install Cache with minimal security.
 
One thing that makes me think this is not a problem is that if I same thing through Cache using the internal Apache server rather than a standalone it works.  So it is something with coming from the external apache that is involved in this too
 
Rich Taylor
Sales Engineer
InterSystems Corporation
Office: 443-340-8614
 


From: Oleg Olenin [mailto:oleg....@intersystems.com]
Sent: Monday, April 13, 2009 4:17 PM
To: Rich Taylor
Cc: wwsaleseng; intersystems...@googlegroups.com
Subject: Re: Trouble with PHP using Cache Webservice

Hi!

I guess you have problems with authentication.
If you would save the wsdl file at the same directory  that php script is, and would modify the php code as:

<?

require_once('./nusoap/lib/nusoap.php');
$url = 'isc.saleseng.PHPService.wsdl.xml'; //  wsdl in local file
$client = new nusoap_client($url,true);
$result = $client->call('WebMfgForm',array('Arg' => "from phpxxxx"));
//print_r($client);
echo $err = $client->getError();
echo $result;
?>

you would get:

wsse:FailedAuthentication: The security token could not be authenticated or authorizedArray

Next thing is to learn how to change SOAP header in NuSoap and add WS-Security elements or to switch off the authentication in Cache.

Ask Google about WS-Security and NuSOAP


Regards,
Oleg Olenin



On Apr 13, 2009, at 9:59 PM, Rich Taylor wrote:

I am currently working on a php program that calls a web service from PHP.  This program is using the NUSoap library.  The program is running, but the web service does not executed.  I am getting an error as shown below when I test the client->GetError() results after I call the web service.
 
wsdl error: XML error parsing WSDL from http://localhost/csp/arcdev/MFG.ARCDEV.cls?wsdl=1 on line 10: XML_ERR_NAME_REQUIRED
 
The environment is a separate Apache 2.2 instance working with Cache.  Both are installed on the same server.  I can verify that the webservice works correctly when run from the URL.  It can be confirmed that this does use the standalone apache by looking at the access.log.  Looking at the Cache CSP log shows that the wsdl is being requested and responded to from the PHP program, but the web service call never shows up.
 
Here are the relevant lines of code
 
$client = new nusoap_client('http://localhost/csp/arcdev/MFG.ARCDEV.cls?wsdl=1',true);
$result = $client->call('WebMfgForm',array('Arg' => "from phpxxxx"));
$err = $client->getError();
The $client is filled in and would appear to be correct.
 
When echoed to the page here is the value of $client
object(nusoap_client)#2 (49) { ["username"]=> string(0) "" ["password"]=> string(0) "" ["authtype"]=> string(0) "" ["certRequest"]=> array(0) { } ["requestHeaders"]=> bool(false) ["responseHeaders"]=> string(0) "" ["responseHeader"]=> NULL ["document"]=> string(0) "" ["endpoint"]=> string(49) "http://localhost/csp/arcdev/MFG.ARCDEV.cls?wsdl=1" ["forceEndpoint"]=> string(0) "" ["proxyhost"]=> bool(false) ["proxyport"]=> bool(false) ["proxyusername"]=> bool(false) ["proxypassword"]=> bool(false) ["xml_encoding"]=> string(0) "" ["http_encoding"]=> bool(false) ["timeout"]=> int(0) ["response_timeout"]=> int(30) ["endpointType"]=> string(4) "wsdl" ["persistentConnection"]=> bool(false) ["defaultRpcParams"]=> bool(false) ["request"]=> string(0) "" ["response"]=> string(0) "" ["responseData"]=> string(0) "" ["cookies"]=> array(0) { } ["decode_utf8"]=> bool(true) ["operations"]=> array(0) { } ["curl_options"]=> array(0) { } ["bindingType"]=> string(0) "" ["use_curl"]=> bool(false) ["fault"]=> NULL ["faultcode"]=> NULL ["faultstring"]=> NULL ["faultdetail"]=> NULL ["title"]=> string(6) "NuSOAP" ["version"]=> string(5) "0.7.3" ["revision"]=> string(18) "$Revision: 1.114 $" ["error_str"]=> string(0) "" ["debug_str"]=> string(286) "2009-04-13 13:55:55.086697 nusoap_client: ctor wsdl=1 timeout=0 response_timeout=30 endpoint=string(49) "http://localhost/csp/arcdev/MFG.ARCDEV.cls?wsdl=1" 2009-04-13 13:55:55.086888 nusoap_client: will use lazy evaluation of wsdl from http://localhost/csp/arcdev/MFG.ARCDEV.cls?wsdl=1 " ["charencoding"]=> bool(true) ["debugLevel"]=> int(9) ["XMLSchemaVersion"]=> string(32) "http://www.w3.org/2001/XMLSchema" ["soap_defencoding"]=> string(10) "ISO-8859-1" ["namespaces"]=> array(4) { ["SOAP-ENV"]=> string(41) "http://schemas.xmlsoap.org/soap/envelope/" ["xsd"]=> string(32) "http://www.w3.org/2001/XMLSchema" ["xsi"]=> string(41) "http://www.w3.org/2001/XMLSchema-instance" ["SOAP-ENC"]=> string(41) "http://schemas.xmlsoap.org/soap/encoding/" } ["usedNamespaces"]=> array(0) { } ["typemap"]=> array(6) { ["http://www.w3.org/2001/XMLSchema"]=> array(43) { ["string"]=> string(6) "string" ["boolean"]=> string(7) "boolean" ["float"]=> string(6) "double" ["double"]=> string(6) "double" ["decimal"]=> string(6) "double" ["duration"]=> string(0) "" ["dateTime"]=> string(6) "string" ["time"]=> string(6) "string" ["date"]=> string(6) "string" ["gYearMonth"]=> string(0) "" ["gYear"]=> string(0) "" ["gMonthDay"]=> string(0) "" ["gDay"]=> string(0) "" ["gMonth"]=> string(0) "" ["hexBinary"]=> string(6) "string" ["base64Binary"]=> string(6) "string" ["anyType"]=> string(6) "string" ["anySimpleType"]=> string(6) "string" ["normalizedString"]=> string(6) "string" ["token"]=> string(6) "string" ["language"]=> string(0) "" ["NMTOKEN"]=> string(0) "" ["NMTOKENS"]=> string(0) "" ["Name"]=> string(0) "" ["NCName"]=> string(0) "" ["ID"]=> string(0) "" ["IDREF"]=> string(0) "" ["IDREFS"]=> string(0) "" ["ENTITY"]=> string(0) "" ["ENTITIES"]=> string(0) "" ["integer"]=> string(7) "integer" ["nonPositiveInteger"]=> string(7) "integer" ["negativeInteger"]=> string(7) "integer" ["long"]=> string(7) "integer" ["int"]=> string(7) "integer" ["short"]=> string(7) "integer" ["byte"]=> string(7) "integer" ["nonNegativeInteger"]=> string(7) "integer" ["unsignedLong"]=> string(0) "" ["unsignedInt"]=> string(0) "" ["unsignedShort"]=> string(0) "" ["unsignedByte"]=> string(0) "" ["positiveInteger"]=> string(0) "" } ["http://www.w3.org/2000/10/XMLSchema"]=> array(11) { ["i4"]=> string(0) "" ["int"]=> string(7) "integer" ["boolean"]=> string(7) "boolean" ["string"]=> string(6) "string" ["double"]=> string(6) "double" ["float"]=> string(6) "double" ["dateTime"]=> string(6) "string" ["timeInstant"]=> string(6) "string" ["base64Binary"]=> string(6) "string" ["base64"]=> string(6) "string" ["ur-type"]=> string(5) "array" } ["http://www.w3.org/1999/XMLSchema"]=> array(11) { ["i4"]=> string(0) "" ["int"]=> string(7) "integer" ["boolean"]=> string(7) "boolean" ["string"]=> string(6) "string" ["double"]=> string(6) "double" ["float"]=> string(6) "double" ["dateTime"]=> string(6) "string" ["timeInstant"]=> string(6) "string" ["base64Binary"]=> string(6) "string" ["base64"]=> string(6) "string" ["ur-type"]=> string(5) "array" } ["http://soapinterop.org/xsd"]=> array(1) { ["SOAPStruct"]=> string(6) "struct" } ["http://schemas.xmlsoap.org/soap/encoding/"]=> array(3) { ["base64"]=> string(6) "string" ["array"]=> string(5) "array" ["Array"]=> string(5) "array" } ["http://xml.apache.org/xml-soap"]=> array(1) { [0]=> string(3) "Map" } } ["xmlEntities"]=> array(5) { ["quot"]=> string(1) """ ["amp"]=> string(1) "&" ["lt"]=> string(1) "<" ["gt"]=> string(1) ">" ["apos"]=> string(1) "'" } ["wsdlFile"]=> string(49) "http://localhost/csp/arcdev/MFG.ARCDEV.cls?wsdl=1" ["wsdl"]=> NULL }
 
 
Rich
 

Oleg Olenin

unread,
Apr 13, 2009, 4:16:56 PM4/13/09
to Rich Taylor, wwsaleseng, intersystems...@googlegroups.com

Rich Taylor

unread,
Apr 13, 2009, 1:59:12 PM4/13/09
to wwsal...@intersystems.com, cacheo...@intersystems.com, intersystems...@googlegroups.com

msthandi

unread,
Apr 14, 2009, 12:35:00 PM4/14/09
to intersystems...@info2.kinich.com
hi Rich,
try logging the call from a tool like soapUI maybe, not a test page call. As
well validating your data or XML, if using it.
Looks like a weird char/hidden char/syntax problem.

http://www.soapui.org/
http://www.w3.org/2001/03/webdata/xsv

regards,
"Rich Taylor" <Rich....@intersystems.com> escribió en el mensaje de
noticias news:200904131759...@mail.intersystems.com...

Rich Taylor

unread,
Apr 14, 2009, 10:29:28 AM4/14/09
to Oleg Olenin, wwsaleseng, intersystems...@googlegroups.com
Well Thanks to Oleg for his pointing in the direction of security.  I added the following line and made some progress.
 
$client->setCredentials('_system', 'SYS');
However now I have an error on the server processing the web service.  I have tried to trace this, but could use some more eyes.
 
<?xml version='1.0' encoding='UTF-8' standalone='no' ?> <SOAP-ENV:Envelope xmlns:SOAP-ENV='http://schemas.xmlsoap.org/soap/envelope/' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:s='http://www.w3.org/2001/XMLSchema' > <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring>Internal Server Error</faultstring> <detail> <error xmlns='http://tempuri.org'> <text>ERROR #5002: Cache error: &lt;UNDEFINED&gt;zProcessSOAPEnvelope+6^MFG.ARCDEV.1 ^||%xmlTemp(1,1,&quot;t&quot;)</text> </error> </detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
 
Thanks for any help
 
Rich


From: Oleg Olenin [mailto:oleg....@intersystems.com]
Sent: Monday, April 13, 2009 4:17 PM
To: Rich Taylor
Cc: wwsaleseng; intersystems...@googlegroups.com
Subject: Re: Trouble with PHP using Cache Webservice

Rich Taylor

unread,
Apr 14, 2009, 4:18:08 PM4/14/09
to intersystems...@googlegroups.com, wwsal...@intersystems.com, cacheo...@intersystems.com
Ok, forget about this.  I found that I had some issues in the class caused by too much fooling around trying to solve the earlier problem that turned out to be security. 
 
Thanks to all who responded here and in PM.
 
To review in NuSoap from PHP I needed a call to $client->setCredentials(username, password) to get this working.  Not sure why I was not getting any response, even and error in the logs, earlier.  With the suggestions from Oleg and the info in the log it was immediately clear.
 
Rich


From: intersystems...@googlegroups.com [mailto:intersystems...@googlegroups.com] On Behalf Of Rich Taylor
Sent: Monday, April 13, 2009 1:59 PM
To: wwsal...@intersystems.com; cacheo...@intersystems.com; intersystems...@googlegroups.com
Subject: [Caché] Trouble with PHP using Cache Webservice

Reply all
Reply to author
Forward
0 new messages