Figured it out, see Update below.
I'm trying to work with a particular web service via PHP (tried both the native and Zend SOAP clients) and it only returns a failure status.
I suspect that it has something to do with the multiple beans in the retrieveMemberInfo method call (authBean, memberInfoBean).
Could someone take a look at the WSDL and point me in the right direction for this particular method call via the PHP client?
Here is what I have so far:
$service = new SoapClient('https://qa.everbridge.net/ws3/services/WebServices3?wsdl');
$result = $service->retrieveMemberInfo(array('loginId', 'orgName', 'password'), array('firstname', 'lastname'));
var_dump($result);
Update
The problem was not with the WSDL call as originally thoug开发者_JAVA百科ht. It was the format for the parameters used in the retrieveMemberInfo method call. Here is the full solution that correctly returns the SOAP response:
$params->authBean->loginId = 'username';
$params->authBean->orgName = 'orgName';
$params->authBean->password = 'password';
$params->memberInfoBean->firstName = 'firstName';
$params->memberInfoBean->lastName = 'lastName';
$service = new SoapClient('https://qa.everbridge.net/ws3/services/WebServices3?wsdl');
$result = $service->retrieveMemberInfo($params);
var_dump($result);
Now I just have to figure out how to parse the returned stdObject.
Thanks for the assistance.
This is apparently a bug in PHP. The file is not completely read. There's nothing wrong with the WSDL itself.
The XML parsing error is this:
object(LibXMLError)#1 (6) { ["level"]=> int(3) ["code"]=> int(5) ["column"]=> int(5) ["message"]=> string(41) "Extra content at the end of the document " ["file"]=> string(56) "https://qa.everbridge.net/ws3/services/WebServices3?wsdl" ["line"]=> int(537) }
Line 537 is quite before the end of the file.
I suggest you report this to http://bugs.php.net/
The problem seems to come before that method call:
Fatal error: Uncaught SoapFault exception: [WSDL] SOAP-ERROR: Parsing WSDL: Couldn't load from 'https://qa.everbridge.net/ws3/services/WebServices3?wsdl' : Extra content at the end of the document in /.../wsdl.php:2 Stack trace: #0 /.../wsdl.php(2): SoapClient->SoapClient('https://qa.ever...') #1 {main} thrown in /.../wsdl.php on line 2
<?php
$service = new SoapClient('https://qa.everbridge.net/ws3/services/WebServices3?wsdl');
//$result = $service->retrieveMemberInfo(array('loginId', 'orgName', 'password'), array('firstname', 'lastname'));
echo '<pre>';
var_dump($result);
echo '</pre>';
?>
I fetched from that URL with wget and I didn't notice anything extra at the end of the returned document. Not that I know much about WSDL, but I would track the cause of this error.
Update:
After confirming Artefacto's findings, I was motivated to try a workaround:
$curl = curl_init('https://qa.everbridge.net/ws3/services/WebServices3?wsdl');
curl_setopt($curl,CURLOPT_RETURNTRANSFER, true);
$wsdl_string = curl_exec($curl);
file_put_contents('/var/tmp/wsdl.xml',$wsdl_string);
try
{
$service = new SoapClient('/var/tmp/wsdl.xml');
$result = $service->retrieveMemberInfo(array('loginId', 'orgName', 'password'), array('firstname', 'lastname'));
print '<pre>';
var_dump($result);
print '</pre>';
}
catch (Exception $e)
{
print '<pre>';
var_dump(libxml_get_last_error());
print '</pre>';
}
Of course, remove the debugging code. You may also want to delete the temporary file after using it.
I've tried copying it locally and using the example provided in the PHP bug submission.
$tmpWsdlPath = tempnam(sys_get_temp_dir(), 'wsdl');
copy("https://qa.everbridge.net/ws3/services/WebServices3?wsdl", $tmpWsdlPath);
$service = new SoapClient($tmpWsdlPath);
$result = $service->retrieveMemberInfo(array('loginId', 'orgName', 'password'), array('firstName', 'lastName'));
It correctly grabs the WSDL file and writes it to the temp folder. It is the entire file.
It still returns the failure status.
精彩评论