how to return custom types with php soap server?

687 views Asked by At

I'm in with PHP SoapServer working in non-wsdl mode. I have the server set up to handle the data and return a response using setClass(). I tried returning an associative array, but that translates into SOAP maps with items, keys and values. I'd like to respond with the following:

<soap:Body>
    <AsyncResponseOperationResponse xmlns="http://www.sample.com/">
        <AsyncResponseOperationResult>
            <Succeeded>true</Succeeded>
            <Comments>
                The operation was a success
            </Comments>
         </AsyncResponseOperationResult>
    </AsyncResponseOperationResponse>
</soap:Body>

The variables would be whether success is true or false, and the comments.

I've been trying to read about the 'typemap' option, but it is not very well documented, and what I've found so far has only confused me further. The resources I've found so far are the php unit tests, like this one and this one, as well as this stackoverflow question

Can anyone provide me an example that does what I'm trying to do? I think I would be alright switching to wsdl mode with autodiscover (using Zend's Soap Server), if that comes up as a solution.

Edit:Until I figure out how to do it the right way, I'm just writing out all the XML manually.

header("Content-type: text/xml");
echo "<?xml version="1.0" encoding="utf-8"?><soap:Envelope ...
0

There are 0 answers