1
我正在寫一個簡單的web服務方法在php中使用nusoap庫。 我已經在服務器端創建了複雜類型(struct),但我想在方法中實例化該結構,以便我可以返回它。我在here中看到一個示例,但使用關鍵字「新」不起作用。它沒有看到ComplexType。 那麼如何在我的LoginTest函數中創建新的ComplexLogin結構?如何在服務器端使用php實例化Nusoap的ComplexType?
//ComplexLoginType
$server->wsdl->addComplexType('ComplexLogin','complexType','struct','all','',
array(
'EnterpriseId' => array('name' => 'EnterpriseId','type' => 'xsd:int'),
'FirstName' => array('name' => 'FirstName','type' => 'xsd:string'),
'Password' => array('name' => 'Password','type' => 'xsd:string'))
);
$server->register(
// method name:
'LoginTest',
// parameter list:
array('name'=>'tns:ComplexLogin'),
// return value(s):
array('return'=>'tns:ComplexLogin'),
// namespace:
$namespace,
// soapaction: (use default)
false,
// style: rpc or document
'rpc',
// use: encoded or literal
'encoded',
// description: documentation for the method
'Login Method'
);