wsdl2php.phpを使用して、wsdlに基づくクラスマップを使用してクラスを作成しました。アカウントを作成するためのクラスと名前と値のペアのためのクラスの2つのクラスを生成しました。
クラスを使用してsoapリクエストを作成する方法を理解しようとしています。石鹸サーバーは.Netです。
CreateAccount.asmxページで提案されたsoapリクエストは次のとおりです。
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<CreateAccount xmlns="https://www.mywsdlsitehere.com/Account">
<parameters>
<NameValue>
<name>string</name>
<value>string</value>
</NameValue>
<NameValue>
<name>string</name>
<value>string</value>
</NameValue>
</parameters>
</CreateAccount>
</soap:Body>
</soap:Envelope>
名前と値のペアをNameValueタグにネストするいくつかの方法を使用してみました。
これが私の最新の失敗した試みです:
$createaccount->parameters->fullName='Testy Tester';
$createaccount->parameters->userEmail='testy@tester.com';
$createaccount->parameters->accountName='TestyTester';
$createaccount->parameters->password='*****';
class CreateAccount {
public $parameters; // ArrayOfNameValue
}
class NameValue {
public $name; // string
public $value; // string
}
public function CreateAccount(CreateAccount $parameters) {
return $this->__soapCall('CreateAccount', array($parameters), array(
'uri' => 'https://www.mywsdlsitehere.com/Accounting',
'soapaction' => ''
)
);
}
私が得るエラーは次のとおりです。
致命的なエラー:キャッチされないSoapFault例外:[soap:Server]サーバーはリクエストを処理できませんでした。--->値をnullにすることはできません。