扫一扫
分享文章到微信
扫一扫
关注官方公众号
至顶头条
作者:佚名 来源:CNBLOG 2007年10月21日
关键字: Linux
<?php $soapClient = new SoapClient("http://localhost:9080/" . "ItsoWebService2RouterWeb/wsdl/itso/session/WeatherForecastEJB.wsdl"); ?> |
$functions = $soapClient->__getFunctions(); print_r($functions); $types = $soapClient->__getTypes(); print_r($types); |
getForecastResponse getForecast(getForecast $parameters) struct getForecast { dateTime startDate; int days; } struct getForecastResponse { Weather getForecastReturn; } struct Weather { string condition; dateTime date; string windDirection; int windSpeed; int temperatureCelsius; boolean dbflag; } |
$getForecastParam = array('startDate' =>time(), 'days' => 3); |
$forecastResponse = $soapClient->getForecast($getForecastParam); |
echo "<table border=1 cellpadding=5>"; echo "<tr><th>Date</th><th>Condition</th><th>Temperature</th><th>Wind</th></tr>"; $weatherArray = $forecastResponse->getForecastReturn; foreach ($weatherArray as $weather) { echo "<tr>", "<td>",strftime("%a. %b %d, %Y", strtotime($weather->date)),"</td>", "<td>$weather->condition</td>", "<td>$weather->temperatureCelsius</td>", "<td>$weather->windDirection $weather->windSpeed</td>", "</tr>"; } echo "</table>"; |
图 3. PHP WeatherClient |
$soapClient = new SoapClient("http://localhost:9080/" . "ItsoWebService2RouterWeb/wsdl/itso/session/WeatherForecastEJB.wsdl", array('trace' => 1)); |
echo "Request :<br>", htmlspecialchars($soapClient->__getLastRequest()), "<br>"; echo "Response :<br>", htmlspecialchars($soapClient->__getLastResponse()), "<br>"; |
<?xml version="1.0" encoding="UTF-8"?> <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="http://session.itso"> <SOAP-ENV:Body> <ns1:getForecast> <ns1:startDate>2004-11-30T13:41:59</ns1:startDate> <ns1:days>0</ns1:days> </ns1:getForecast> </SOAP-ENV:Body> </SOAP-ENV:Envelope> |
<?xml version="1.0" encoding="UTF-8"?> <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soapenv:Body> <getForecastResponse xmlns="http://session.itso"> <getForecastReturn xmlns:ns-239399687="http://mapping.itso"> <ns-239399687:condition>sunny</ns-239399687:condition> <ns-239399687:date>2004-11-30T00:00:00.000Z</ns-239399687:date> <ns-239399687:windDirection>W</ns-239399687:windDirection> <ns-239399687:windSpeed>18</ns-239399687:windSpeed> <ns-239399687:temperatureCelsius>6</ns-239399687:temperatureCelsius> <ns-239399687:dbflag>1</ns-239399687:dbflag> </getForecastReturn> </getForecastResponse> </soapenv:Body> </soapenv:Envelope> |
如果您非常迫切的想了解IT领域最新产品与技术信息,那么订阅至顶网技术邮件将是您的最佳途径之一。
现场直击|2021世界人工智能大会
直击5G创新地带,就在2021MWC上海
5G已至 转型当时——服务提供商如何把握转型的绝佳时机
寻找自己的Flag
华为开发者大会2020(Cloud)- 科技行者