3

I would like to create xml schema on nusoap like the following:

<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>

I can't see any documentation on how I could do that. Does anyone know this already? Thank you.

Wladimir Palant
  • 56,865
  • 12
  • 98
  • 126

1 Answers1

0

Add two complex type for input, what i understood in your question is its input and has output

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

/Input Data type/

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

/Output Data type/

$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);

}

Untested but the logic is there

zero8
  • 1,997
  • 3
  • 15
  • 25