So I am trying to include the following XML in my SOAP request:
所以我试图在我的SOAP请求中包含以下XML:
<Responses>
<Response>
<QuestionAnswerID>someint</QuestionAnswerID>
<QuestionID>someint</QuestionID>
</Response>
<Response>
<QuestionAnswerID>someint</QuestionAnswerID>
<QuestionID>someint</QuestionID>
</Response>
</Responses>
I looked at this posting, which is vaguely on the same topic, but it produces output like so:
我查看了这个帖子,这个帖子对同一个主题含糊不清,但它产生的输出如下:
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)
}
}
}
}
The problem with that is that the arrays now have indices, which the web service I'm calling appears to not like. Any way I can generate something like the above XML?
问题是数组现在有索引,我正在调用的Web服务似乎不喜欢。我可以用任何方式生成类似上面的XML吗?
TIA.
1 个解决方案
#1
10
It's hard to test this without a SOAP server with your WSDL to go against. You should be able to create associative arrays like so:
没有带有WSDL的SOAP服务器就很难对此进行测试。您应该能够创建关联数组,如下所示:
$responses = array();
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$response = array("Response" => $responses);
$soapData = array("Responses" => $response);
#1
10
It's hard to test this without a SOAP server with your WSDL to go against. You should be able to create associative arrays like so:
没有带有WSDL的SOAP服务器就很难对此进行测试。您应该能够创建关联数组,如下所示:
$responses = array();
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$responses[] = array("QuestionAnswerID" => someint, "QuestionID" => someint);
$response = array("Response" => $responses);
$soapData = array("Responses" => $response);