扩展基于nusoap

时间:2012-06-06 10:43:47

标签: web-services nusoap base

我想在nusoap上创建xml架构,如下所示:

<xsd:complexType name="WSMessage">
    <xsd:sequence>
        <xsd:element minOccurs="0" maxOccurs="1" name="ErrorMessage" type="s:string"/>
        <xsd:element minOccurs="0" maxOccurs="1" name="ErrorCode" type="s:string"/>
    </xsd:sequence>
</xsd:complexType>

<s:complexType name="ResultSet">
    <s:complexContent mixed="false">
        <s:extension base="tns:WSMessage">
            <s:sequence>
                <s:element minOccurs="0" maxOccurs="1" name="TestData" type="tns:ArrayOfTestData"/>
            </s:sequence>
        </s:extension>
    </s:complexContent>
</s:complexType>

我看不到任何关于如何做到的文档。有人知道吗? 谢谢。

1 个答案:

答案 0 :(得分:0)

为输入添加两个复杂类型,我在你的问题中理解的是它的输入和输出

$this->nusaop->wsdl->addComplexType(
            'WSMessage',
            'complexType',
            'struct',
            'all',
            '',
            array(
                'ErrorMessage ' => array(
                    'MethodParameters' => 'ErrorMessage',
                    'type' => 'xsd:string'
                ),
                'ErrorCode' => array(
                    'MethodParameters' => 'ErrorCode',
                    'type' => 'xsd:string'
                )
               )
        );

/ 输入数据类型 /

$this->nusaop->wsdl->addComplexType(
            'ResultSet',
            'complexType',
            'struct',
            'all',
            '',
            array(
                'TestData' => array(
                    'MethodParameters' => 'TestData',
                    'type' => 'xsd:string'
                ),
            )
        );

/ 输出数据类型 /

$this->FM_SoapServer->register(
        'Methodcall',// parameter list:
        array('Credentials'=>'tns:WSMessage'),// return value(s):
        array('return'=>'tns:ResultSet'),// namespace:
        false,// soapaction: (use default)
        false,// style: rpc or document
        'rpc',// use: encoded or literal
        'encoded',// description: documentation for the method
        ''
    );



function Methodcall(){
  ///  validations ....
  code....
  return array("ResultSet" => $return);

}

未经测试,但逻辑是