SOAP は初めてで、Web サービスを作成しようとしています。残念ながら、何かがうまくいかず、server.php ページが呼び出されていないようです。最初に非常に単純なクエリを使用しました。問題はどこだ?
これはサーバーです:
<?php
function getStockQuote($symbol) {
mysql_connect('localhost','root');
mysql_select_db('mio');
$query = "SELECT * FROM nomi WHERE nome = '$symbol' ";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result)
return $row['scuola'];
}
require('nusoap.php');
$server = new nusoap_server();
$server->configureWSDL('stockquote', 'urn:stockquote');
$server->register("getStockQuote",
array('symbol' => 'xsd:string'),
array('return' => 'xsd:string'),
'urn:stockquote',
'urn:stockquote#getStockQuote');
if( ! isset( $HTTP_RAW_POST_DATA )) {
$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
}
$server->service($HTTP_RAW_POST_DATA);
?>
そして、これはクライアントです..
<html>
<body>
<form method="get" action="client.php">
ID: <input name="symbol" type="text" value="">
<br>
<br>
<input type="submit">
</form>
<?php
$symbol = $_GET['symbol'];
if ($symbol) {
require_once('nusoap.php');
$c = new nusoap_client('serv.wsdl',true);
$stockprice = $c->call('getStockQuote',
array('symbol' => $symbol));
echo "Information for $symbol is $stockprice.";
}
?>
</body>
</html>
これはwsdlです:
<definitions xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
ema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-
ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="urn:stockquote"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="urn:stockquote">
<types>
<xsd:schema targetNamespace="urn:stockquote">
<xsd:import namespace="http://schemas.xmlsoap.org/soap/encoding/"/>
<xsd:import namespace="http://schemas.xmlsoap.org/wsdl/"/>
</xsd:schema>
</types>
<message name="getStockQuoteRequest">
<part name="symbol" type="xsd:string"/>
</message>
<message name="getStockQuoteResponse">
<part name="return" type="xsd:string"/>
</message>
<portType name="stockquotePortType">
<operation name="getStockQuote">
<input message="tns:getStockQuoteRequest"/>
<output message="tns:getStockQuoteResponse"/>
</operation>
</portType>
<binding name="stockquoteBinding" type="tns:stockquotePortType">
<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="getStockQuote">
<soap:operation soapAction="urn:stockquote#getStockQuote" style="rpc"/>
<input>
<soap:body use="encoded" namespace="urn:stockquote"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded" namespace="urn:stockquote"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<service name="stockquote">
<port name="stockquotePort" binding="tns:stockquoteBinding">
<soap:address location="server.php"/>
</port>
</service>
</definitions>
何を変更すればよいですか?