473,387 Members | 3,787 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Pear SOAP oddity

I'm having some trouble with PEAR soap and a response from a webservice
when the number of results is one or more than one.

Versions are PHP 4.4.2-1build1, PEAR-1.4.6, SOAP-0.9.4 running in
Linux (Ubuntu Dapper)

When we have multiple items in the result, all goes well, and I can use
the result straight away (I do some JSON translation afterwards, but
that's beyond the scope of my question).

Multiple result:

Actual XML sent back from webservice (sniffed off the connection):

[snipped headers]

<GetChildCategoriesResult>
<item>
<CategoryId>1</CategoryId>
<Name>Cultura</Name>
<ParentCategoryId>0</ParentCategoryId>
</item>
<item>
<CategoryId>2</CategoryId>
<Name>Autom..veis</Name>
<ParentCategoryId>0</ParentCategoryId>
</item>
</GetChildCategoriesResult>
[snipped trailing markup]

How PEAR::SOAP translates:

array(2) {
[0]=>
object(stdClass)(3) {
["CategoryId"]=>
string(1) "1"
["Name"]=>
string(7) "Cultura"
["ParentCategoryId"]=>
string(1) "0"
}
[1]=>
object(stdClass)(3) {
["CategoryId"]=>
string(1) "2"
["Name"]=>
string(11) "Automóveis"
["ParentCategoryId"]=>
string(1) "0"
}
}
When I get a single item in the result, however, things go a little
differently - and I'd have to write some pretty silly code to be able
to actually use it "as is":

Single result:

Actual XML sent back from webservice (sniffed off the connection):

[snipped headers]
<GetChildCategoriesResult>
<item>
<CategoryId>3</CategoryId>
<Name>Carros</Name>
<ParentCategoryId>2</ParentCategoryId>
</item>
</GetChildCategoriesResult>
[snipped trailing markup]

How PEAR::SOAP translates it:

object(stdClass)(1) {
["item"]=>
&object(stdClass)(3) {
["CategoryId"]=>
string(1) "3"
["Name"]=>
string(6) "Carros"
["ParentCategoryId"]=>
string(1) "2"
}
}
As you can see, instead of an array of length one, I get an object with
an "item" property, with the expected object inside it. That's not (for
me, at least) the desired behaviour for the beast - is this a bug, a
miss-feature? Or is it supposed to work like that, and I have to write
a work-around for my purposes? Does anyone know of an already-written
workaround?

Thanks in advance for your time,

WageMage / Manuel

May 22 '06 #1
0 1336

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Stephan Lachmuth | last post by:
Hello, I want to do some SOAP with PHP and found the SOAP package at PEAR. But I didn't find any documentation for it. Can anybody tell, where to find docs? Or can anybody tell how to use it? ...
0
by: Arne Kösling | last post by:
Hi ! I am new to Web Services. Therefore I ve set up a PHP Installation on Windows (PHP 4.3.2 and Apache 1.3.29). I have tested PHP alone and then installed PEAR. Now I am stuck there (Before...
0
by: Arne Kösling | last post by:
Hi, PEAR:SOAP is not working. I've tried so many examples now and the only one that works, is that amazon example, which is too complex for me to understand. I am so reliant on the Web...
0
by: Henrik Brautaset Aronsen | last post by:
I am having problems converting from Pear SOAP to PHP5 SOAP, especially when it comes to complex types. I would be grateful for any help on how this should be translated: ...
3
by: junkmail | last post by:
on a win 2k server apparantly it is saying i dont have it. or it cant find it. im using mySQL 4.1 php 4.3.x apache 3.0.53 im new to php and am doing some tutorials, but when i run the sripts...
0
by: Alexander Waldmann | last post by:
Hi, i have PEAR::SOAP installed correctly (beta, all dependent packages are installed). When i try out the following simple Script <?php print "Include is ... ";...
0
by: Samuel Zallocco | last post by:
Hi all, I've a problem with PHP5 + PEAR::SOAP. I Have the following 2 script that implements a simple web service: The Server Code running on WinXP + PHP5 + Apache 2.x:...
0
by: info | last post by:
Dear all, is the first time that I use SOAP, and i must say that i'm having several problems. this is SOAP message that expects the server =================XML EXPECTED FROM THE...
4
by: inetquestion | last post by:
php has been configured with the following two configure lines and core's during "make install" on the PEAR section. Is there something simple i'm missing? Any help would be appreciated. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.