現在、次のコードを使用してSOAPサーバーをセットアップしようとしています。
server.php
<?php
class Name {
private $_name;
public function setName($name) {
$this->_name = $name;
}
public function getName() {
return $this->_name;
}
}
$server = new SoapServer('soap.wsdl');
$server->setClass('Name');
$server->handle();
?>
client.php
<?php
$client = new SoapClient('soap.wsdl');
$client->setName('test');
print $client->getName();
?>
soap.wsdl
<?xml version ="1.0" encoding ="UTF-8" ?>
<definitions
name="Name"
targetNamespace="/Name/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.examples.com/wsdl/HelloService.wsdl"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<message name="nameInput">
<part name="sName" type="xsd:string" />
</message>
<message name="nameOutput">
<part name="sName" type="xsd:string" />
</message>
<portType name="NamePortType">
<operation name="setName" parameterOrder="sName">
<input message="tns:nameInput" />
</operation>
<operation name="getName">
<output message="tns:nameOutput" />
</operation>
</portType>
<binding name="NameBinding" type="tns:NamePortType">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="setName">
<soap:operation soapAction=""/>
<input>
<soap:body use="literal"/>
</input>
</operation>
<operation name="getName">
<soap:operation soapAction=""/>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="NameService">
<port name="NamePort" binding="tns:NameBinding">
<soap:address location="http://10.200.3.48/zI/soap/server.php"/>
</port>
</service>
</definitions>
クラスオブジェクトの引数に値を格納することは可能ですか?getName()は空の文字列を返します。