【问题标题】:how to use a custom type as data type in another custom type in nusoap如何在 nusoap 的另一个自定义类型中使用自定义类型作为数据类型
【发布时间】:2016-06-20 10:52:26
【问题描述】:

我用nusoapphp 开发了一个soap web 服务。在这个 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 中使用自定义类型作为另一个自定义类型中的数据类型的正确方法是什么?

【问题讨论】:

    标签: php nusoap custom-type


    【解决方案1】:

    send 对象必须改为如下,xsd:charge 必须改为 tns:charge。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-04-21
      • 1970-01-01
      • 2020-10-22
      • 1970-01-01
      • 2020-04-03
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多