开发者

PHP Soap request format differences

We have a site built in Zend Framework and we're using the Zend Soap client.

I'm having trouble with one of the soap requests: It's expecting data in this form

        <CustomerForm>
            <CustomerFormRow>
                <CuisineType>3</CuisineType>
                <CuisineRestaurant>True</CuisineRestaurant>
                <NumberOfStaff>801</NumberOfStaff>
                ...

But the soap client is generating the following

        <customerform>
            <ns2:map>
                <item>
                    <key>CuisineType</key>
                    <value>Greek</value>
         开发者_如何转开发       </item>
                <item>
                    <key>CuisineRestaurant</key>
                    <value>Cafe</value>
                </item>
                <item>
                    <key>NumberOfStaff</key>
                    <value>11 to 20</value>
                </item>
                ...

When using

$_processFormWS->processFormWS($session_id, $customer_id, $form_data);

So the service isn't handling the data I'm sending!

Am I missing something?

Thanks!


Turns out that if I pass my $form_data as an object (rather than an array which it was before) then it works!

So:

$_processFormWS->processFormWS($session_id, $customer_id, (object) $form_data);

Would fix the above code.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜