Has anyone had to deal with sending arrays of complex XML elements as part of a SOAP message?
I'm attempting to use PHP's SoapClient to call a function on a remote server. The server's XML schema specifies the input type to the function as taking a complex type comprised of a couple elements. One of the elements is an array element, which encapsulates an unbounded array of another particular complex type.
My issue is that whenever I attempt to create an array of elements of the inner type, I get empty elements. I create a PHP stdObject to encapsulate the SOAP message as such:
Code: Select all
$container1->AnswerContainer->Answer = "answer1";
$container2->AnswerContainer->Answer = "answer2";
$soapMsg->Answers = array( $container1, $container2 );
$soapMsg->QuestionId = 1;
Code: Select all
<ns1:QuestionId>1</ns1:QuestionId>
<ns1:Answers>
<ns1:AnswerContainer />
<ns1:AnswerContainer />
</ns1:Answers>
Code: Select all
<ns1:QuestionId>1</ns1:QuestionId>
<ns1:Answers>
<ns1:AnswerContainer>
<ns1:Answer>answer1</ns1:Answer>
</ns1:AnswerContainer>
</ns1:Answers>
Has anyone encountered this issue before? Is this a shortcoming with PHP's SoapClient? I find it unlikely that PHP wouldn't be able to handle an array of elements, and I really don't want to pull out Java to do this. Seems like Java would be way to much of a headache for such a simple task.
Any ideas?