我正在尝试使用带有XML查询解析的PHP从NWMLS Web服务获得响应,如下面的源代码所示,它返回错误下方。 SO中也存在类似的问题,但这些解决方案对我来说并不成功。 如何解决此问题?
源代码:
<?php
try {
$soap_client = new SoapClient('http://evernet.nwmls.com/evernetqueryservice/evernetquery.asmx?WSDL');
$query = "<?xml version='1.0' encoding='utf-8' standalone='no'?>";
$query .= "<EverNetQuerySpecification xmlns='urn:evernet.nwmls.com/evernetqueryservice/evernetquery.asmx?WSDL'>";
$query .= "<Message>";
$query .= "<Head>";
$query .= "<UserId>username</UserId>";
$query .= "<Password>password</Password>";
$query .= "<SchemaName>StandardXML1_1</SchemaName>";
$query .= "</Head>";
$query .= "<Body>";
$query .= "<Query>";
$query .= "<MLS>nwmls</MLS>";
$query .= "<PropertyType>MANU</PropertyType>";
$query .= "<BeginDate>2013-10-24T23:00:19</BeginDate>";
$query .= "<EndDate>2013-10-24T23:19:17</EndDate>";
$query .= "<Status>SFR</Status>";
$query .= "</Query>";
$query .= "<Filter></Filter>";
$query .= "</Body>";
$query .= "</Message>";
$query .= "</EverNetQuerySpecification>";
// RetrieveListingData
$params = array('v_strXmlQuery' => $query); // ?
$listing = $soap_client->RetrieveListingData($params);
// RetrieveListingDataResponse
$result = $listing->RetrieveListingDataResult;
echo $result;
// Convert the $result into a multi-dimensional
// array comprising of each returned value
$xml_result = new SimpleXMLElement($result);
// print_r($xml_result->Residential);
$residential = $xml_result->Residential;
echo '<pre>';
print_r ($residential);
echo '</pre>';
exit();
foreach($residential[0] as $tag => $val) {
echo '<p id="'. $tag . '">' . $val . '</p>';
}
// VIEW the wsdl.
// Uncomment these to see all available methods of the EverNet Service.
/*
var_dump( $soapclient->__getFunctions() );
var_dump( $soapclient->__getTypes() );
*/
} catch (SoapClient $exception) {
echo '<pre>';
echo $exception->getMessage();
echo '</pre>';
}
?>
而不是列出我面临以下问题,
ERROR:
**Could not find schema information for the element 'urn:evernet.nwmls.com/evernetqueryservice/evernetquery.asmx?WSDL:**
的 EverNetQuerySpecification, Message, Head, UserId, Password, SchemaName, Body, Query, MLS, PropertyType, BeginDate, EndDate, Status, Filter
答案 0 :(得分:0)
s.no检查清单 1. extension = php_openssl.dll - 已启用 2. default_socket_timeout - 60 3. allow_url_fopen - 开 4.本地证书试试这个...... 5. URL中的www - 存在 6. WSDL - 已启用 7. soap.wsdl_cache_enabled - 1 8. httpd.conf - 超时 - 600(非常重要)
这些是配置组合,我尝试从'localhost'wamp而不是从live server解决。除了获得输出值之外,还包括以下内容,
$query .= " <ListingNumber>Your listing ID comes here</ListingNumber>";