PHP nuSOAP complexType在元素标签


PHP nuSOAP complexType within element tag

我必须构建以下WSDL结构:

<xs:element name="sobre">
    <xs:complexType>
        <xs:sequence>
            <xs:element minOccurs="0" maxOccurs="1" name="encabezado" type="tns:encabezadoSobre"/>
            <xs:element minOccurs="0" maxOccurs="unbounded" name="cuerpo" type="tns:cuerpoSobre"/>
        </xs:sequence>
    </xs:complexType>
</xs:element>

但是看起来nuSOAP架构不允许我这样做。

,代码如下:

$server->wsdl->addComplexType(
    'sobre',
    'complexType',
    'struct',
    'sequence',
    '',
    array(
        'encabezado' => array('name' => 'aem:encabezado', 'type' => 'tns:encabezadoSobre'),
        'cuerpo'    => array('name' => 'aem:cuerpo' , 'type' => 'tns:cuerpoSobre')
    )
);

我有以下结构:

<xsd:complexType name="sobre">
    <xsd:sequence>
        <xsd:element name="encabezado" type="tns:encabezadoSobre"/>
        <xsd:element name="cuerpo" type="tns:cuerpoSobre"/>
    </xsd:sequence>
</xsd:complexType> 

我在这里发现了一个类似的问题,但那里的答案并没有帮助我。

所以总结一下,我需要做的是创建一个名为"sobre"的元素,并在该元素中创建一个complexType。

我平均有20个web服务有同样的问题,所以使用另一个框架或php本地soap重新构建它将是最后的最后一个选择。

试试这个:

$server->wsdl->addComplexType(
'sobre',
'complexType',
'struct',
'sequence',
'',
array(
    'encabezado' => array('name' => 'aem:encabezado',  'minOccurs' => '0', 'maxOccurs' => '1', 'type' => 'tns:encabezadoSobre'),
    'cuerpo'    => array('name' => 'aem:cuerpo',  'minOccurs' => '0', 'maxOccurs' => 'unbounded', 'type' => 'tns:cuerpoSobre')
)

);