如何在nusoap中使用自定义类型作为另一种自定义类型的数据类型

时间:2016-06-20 10:52:26

标签: php nusoap custom-type

我开发了一个包含nusoapphp的肥皂网服务。在这个Web服务中,我已经定义了一个名为charge的自定义类型:

  $server->wsdl->addComplexType('charge',
        'complexType',
        'struct',
        'all',
        '',
        array(
                'code' => array('name' => 'code', 'type' => 'xsd:string'),
                'value' => array('name' => 'value', 'type' => 'xsd:string')
        )
    );

我想定义另一种自定义类型,其中费用自定义类型用作数据类型,如下所示:

 $server->wsdl->addComplexType('send',
        'complexType',
        'struct',
        'all',
        '',
        array(
                'send' => array('name' => 'send', 'type' => 'xsd:charge')
        )
    );

然后我收到此错误:

Could not find type 'charge@http://www.w3.org/2001/XMLSchema'

在nusoap中将自定义类型用作另一种自定义类型的数据类型的正确方法是什么?

1 个答案:

答案 0 :(得分:0)

send对象必须更改为低于,xsd:charge必须更改为tns:charge。

 $server->wsdl->addComplexType('send',
        'complexType',
        'struct',
        'all',
        '',
        array(
                'send' => array('name' => 'send', 'type' => 'tns:charge')
        )
    );