ben*_*njy 3 php xml arrays soap
所以我试图在我的SOAP请求中包含以下XML:
<Responses>
<Response>
<QuestionAnswerID>someint</QuestionAnswerID>
<QuestionID>someint</QuestionID>
</Response>
<Response>
<QuestionAnswerID>someint</QuestionAnswerID>
<QuestionID>someint</QuestionID>
</Response>
</Responses>
Run Code Online (Sandbox Code Playgroud)
我查看了这个帖子,这个帖子对同一个主题含糊其辞,但它产生的输出如下:
object(stdClass)#1 (1) {
["Responses"]=>
object(stdClass)#2 (1) {
["Response"]=>
array(2) {
[0]=>
object(stdClass)#3 (2) {
["QuestionAnswerID"]=>
int(someint)
["QuestionID"]=>
int(someint)
}
[1]=>
object(stdClass)#4 (2) {
["QuestionAnswerID"]=>
int(someint)
["SurveyQuestionID"]=>
int(someint)
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
问题是数组现在有索引,我正在调用的Web服务似乎不喜欢.我可以用任何方式生成类似上面的XML吗?
TIA.
Chr*_*ams 10
没有带有WSDL的SOAP服务器就很难对此进行测试.您应该能够创建关联数组,如下所示:
$responses = array();
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$response = array("Response" => $responses);
$soapData = array("Responses" => $response);
Run Code Online (Sandbox Code Playgroud)