SOAP服务在响应中缺少值



我在SOAP响应中缺少一个值。我在print_r和__getLastResponse中都看不到值。在返回响应之前,我正在服务器端记录响应,我可以看到缺少值"contentListRef",并且它不是空的。

根据我的研究,数据在SOAP解析过程中似乎丢失了,但我不知道如何修复它。WSDL缓存被禁用。有解决这个问题的指导吗?

响应的print_r给出以下

stdClass Object
(
[questions] => stdClass Object
(
[multipleChoiceQuestion] => stdClass Object
(
[label] => stdClass Object
(
[text] => Search type:
[dir] => ltr
)
[choices] => stdClass Object
(
[choice] => Array
(
[0] => stdClass Object
(
[label] => stdClass Object
(
[text] => Basic
[dir] => ltr
)
[id] => search_type_basic
)                                        
)
)
[id] => search_type
[allowMultipleSelections] => 
)
[inputQuestion] => stdClass Object
(
[inputTypes] => stdClass Object
(
[input] => stdClass Object
(
[type] => TEXT_ALPHANUMERIC
)
)
[label] => stdClass Object
(
[text] => Search type:
[dir] => ltr
)
[id] => search_box
)
)
)

__getLastResponse:

<?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope" xmlns:ns1="http://www.daisy.org/ns/daisy-online/">
<env:Body>
<ns1:getQuestionsResponse>
<ns1:questions>
<ns1:multipleChoiceQuestion id="search_type" allowMultipleSelections="false">
<ns1:label dir="ltr">
<ns1:text>Search type:</ns1:text>
</ns1:label>
<ns1:choices>
<ns1:choice id="search_type_basic">
<ns1:label dir="ltr">
<ns1:text>Basic</ns1:text>
</ns1:label>
</ns1:choice>
</ns1:choices>
</ns1:multipleChoiceQuestion>
<ns1:inputQuestion id="search_box">
<ns1:inputTypes>
<ns1:input type="TEXT_ALPHANUMERIC"/>
</ns1:inputTypes>
<ns1:label dir="ltr">
<ns1:text>Search type:</ns1:text>
</ns1:label>
</ns1:inputQuestion>
</ns1:questions>
</ns1:getQuestionsResponse>
</env:Body>
</env:Envelope>

xsd文件:

<xs:element name="questions">
<xs:complexType>
<xs:choice>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element ref="multipleChoiceQuestion"/>
<xs:element ref="inputQuestion"/>
</xs:choice>
<xs:element name="contentListRef" type="xs:NMTOKEN"/>
<xs:element ref="label"/>
</xs:choice>
</xs:complexType>
</xs:element>

WSDL可以在这里访问

我能够识别并修复这个问题。问题在于xsd和数据结构不匹配。

来自服务器的伪响应是

$questions = [
'multipleChoiceQuestion' => ['label'=>['text'=>'testtxt'],'choices'=>['choice'=>[['label'=>['text'=>'basic','dir'=>'ltr'],'id'=>'search_type_basic']]]],
'inputQuestion'          => '',
'contentListRef'         => 'L100',
'label'                  => ['text'=>'testtxt1'],
];

我调整了xsd文件,它工作

<xs:element name="questions">
<xs:complexType>
<xs:choice minOccurs="1" maxOccurs="unbounded">
<xs:element ref="multipleChoiceQuestion"/>
<xs:element ref="inputQuestion"/>
<xs:element name="contentListRef" type="xs:NMTOKEN"/>
<xs:element ref="label"/>
</xs:choice>
</xs:complexType>
</xs:element>

相关内容

  • 没有找到相关文章

最新更新