Re: Is there a way to test, what's the output of PHP SOAP request?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 4 February 2011 08:31, Mariaxx <sannamari28@gmail.com> wrote:
>
> Ok, it seems, that I was looking for simple __getLastRequest() function.
>
> However, I have nested array:
>
> $form = Âarray('some' => array(
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Info' => array('Product' => 1,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Insurance' => 0,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'MaritalStatus' => 'married',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Salary' => 300000
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Borrower' => array('Number' => '1231231234',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Firstname' => 'xxxx',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'LastName' => 'xxxxxxxx',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Email' => 'xx@xx.com'
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Personal' => array('bor' => '281051006U',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Borrower' => 'yyyyy',
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Salaryr' => 300000
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â),
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Living' => array('Fee' => 250,
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â'Rent' => 0.00
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â)
> Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â);
>
> I need to send
>
> <some>
> <Info>
> <Product>1</Product>
> <Insurance>0</Insurance>
> <MaritalStatus>married</MaritalStatus>
> <Salary>3000</Salary>
> </Info>
> <Borrower>
> <Number>2312132</Number>
> <Firstname>xxxxx</Firstname>
> </Borrower>
> etc.
> </some>
>
> But my arrays are printed out as
>
> <ns1:some>
> <item><key>Info</key><value>
> <item><key>Product</key><value>1</value></item>
> <item><key>Insurance</key><value>0</value></item>
> <item><key>MaritalStatus</key><value>married</value></item> etc.
>
> Apparently there's a catch, how to use arrays with SOAP? How to get rid of
> the extra tags?
>
> Maria
>
>
>
> RQuadling wrote:
>>
>> On 3 February 2011 15:14, Mariaxx <sannamari28@gmail.com> wrote:
>>>
>>> Fatal error: Class 'Tidy' not found in
>>> /home/admin/public_html/uusi/testi.php
>>> on line 142
>>>
>>> Am I missing out some files? I have two files: WAPI.php and the other
>>> with
>>> my credentials.
>>>
>>>
>>> RQuadling wrote:
>>>>
>>>> On 2 February 2011 14:01, Mariaxx <sannamari28@gmail.com> wrote:
>>>>>
>>>>> Is there a way to figure out the form of data I'm sending in an SOAP
>>>>> XML
>>>>> request.
>>>>> I need to be sure, that when I'm calling the service, that my arrays
>>>>> are
>>>>> "printed out" correctly and doesn't contain any extra (nested)
>>>>> parameters.
>>>>>
>>>>> Maria
>>>>> --
>>>>> View this message in context:
>>>>> http://old.nabble.com/Is-there-a-way-to-test%2C-what%27s-the-output-of-PHP-SOAP-request--tp30826222p30826222.html
>>>>> Sent from the Php - Soap mailing list archive at Nabble.com.
>>>>>
>>>>>
>>>>> --
>>>>> PHP Soap Mailing List (http://www.php.net/)
>>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>>
>>>>>
>>>>
>>>> Take a look at the code here [1]. I created this to help a previous
>>>> question on this list [2].
>>>>
>>>> Whilst I only show the trace (headers sent/received for
>>>> request/response) during an exception, you can just cut'n'paste that
>>>> code to the main body.
>>>>
>>>> If you've got any concrete examples of the work you are trying to do,
>>>> then maybe I can help you some more.
>>>>
>>>> Regards,
>>>>
>>>> Richard.
>>>>
>>>> [1] http://pastebin.com/f8CBcLHc
>>>> [2] http://news.php.net/php.soap/3245
>>>>
>>>> --
>>>> Richard Quadling
>>>> Twitter : EE : Zend
>>>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>>>>
>>>> --
>>>> PHP Soap Mailing List (http://www.php.net/)
>>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>>
>>>>
>>>>
>>>
>>> --
>>> View this message in context:
>>> http://old.nabble.com/Is-there-a-way-to-test%2C-what%27s-the-output-of-PHP-SOAP-request--tp30826222p30836410.html
>>> Sent from the Php - Soap mailing list archive at Nabble.com.
>>>
>>>
>>> --
>>> PHP Soap Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>>
>>
>> http://uk3.php.net/manual/en/book.tidy.php
>>
>> If you cannot enable Tidy, then you'll have to adjust the code. All it
>> is used for it pretty printing of the XML request/response. It isn't
>> used for any data processing purposes.
>>
>> --
>> Richard Quadling
>> Twitter : EE : Zend
>> @RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY
>>
>> --
>> PHP Soap Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
>>
>>
>
> --
> View this message in context: http://old.nabble.com/Is-there-a-way-to-test%2C-what%27s-the-output-of-PHP-SOAP-request--tp30826222p30842458.html
> Sent from the Php - Soap mailing list archive at Nabble.com.
>
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

I've _never_ used arrays in SOAP. I've always used classes generated
via wsdl2php. That may be an overhead, but it makes more sense to me
that way.

You create an instance of the required parameter class (or classes if
nested), populate the classes (and assign the lower level ones to
their parents) and pass the whole lot to the required function as a
parameter.

Passing an array is going to send the data in key/value as that is
what you are passing it. Not an object instance.

If you look at the wsdl, you'll see that the required type of the
parameter for the function is NOT an array but of a particular complex
type. Complex types are easily represented as classes.

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux