[英]Passing a PHP array in a SOAP call
因此,我试图在我的SOAP请求中包括以下XML:
<Responses>
<Response>
<QuestionAnswerID>someint</QuestionAnswerID>
<QuestionID>someint</QuestionID>
</Response>
<Response>
<QuestionAnswerID>someint</QuestionAnswerID>
<QuestionID>someint</QuestionID>
</Response>
</Responses>
我看了一下这个帖子, 这个帖子含糊地涉及同一主题,但它产生的输出如下:
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)
}
}
}
}
问题在于,数组现在具有索引,我正在调用的Web服务似乎不喜欢该索引。 有什么办法可以生成类似上述XML的内容吗?
TIA。
没有WSDL的SOAP服务器,很难进行测试。 您应该能够像这样创建关联数组:
$responses = array();
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$response = array("Response" => $responses);
$soapData = array("Responses" => $response);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.