如果给出限制,PHP SoapClient与类型不匹配

时间:2018-06-27 09:46:55

标签: php soap wsdl

我对PHP SoapClient有问题。客户端生成的对象并没有应有的所有属性。

在我的情况下,2个元素(描述,描述2)具有相同的复杂类型(文本)。其中之一具有限制(描述)。在生成的PHP对象中,缺少属性“语言”。

WSDL中的示例:

<xs:complexType name="Text">
  <xs:simpleContent>
     <xs:extension base="xs:string">
        <xs:attribute name="language" type="string"/>
     </xs:extension>
  </xs:simpleContent>
</xs:complexType>

<xs:element maxOccurs="unbounded" minOccurs="1" name="description">
<xs:complexType>
    <xs:simpleContent>
        <xs:restriction base="tns:Text">
            <xs:maxLength value="400"/>
        </xs:restriction>
    </xs:simpleContent>
</xs:complexType>
</xs:element>

<xs:element maxOccurs="unbounded" minOccurs="0" name="description2" type="tns:Text">
<xs:annotation>
    <xs:documentation>...</xs:documentation>
</xs:annotation>
</xs:element>

PHP中的对象

public 'description' => 
        array (size=1)
          0 => 
            object(stdClass)[6]
              public '_' => string 'some string' (length=17)
public 'description2' => 
        array (size=1)
          0 => 
            object(stdClass)[7]
              public '_' => string 'some other string' (length=1796)
              public 'language' => string 'de_DE' (length=5)

WSDL有效。 我无法更改WSDL。 SoapClient的类型映射无效,因为该类型与描述不匹配。

我如何接收描述中的语言属性?

0 个答案:

没有答案
相关问题