473,746 Members | 2,727 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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]

<GetChildCatego riesResult>
<item>
<CategoryId>1 </CategoryId>
<Name>Cultura </Name>
<ParentCategory Id>0</ParentCategoryI d>
</item>
<item>
<CategoryId>2 </CategoryId>
<Name>Autom..ve is</Name>
<ParentCategory Id>0</ParentCategoryI d>
</item>
</GetChildCategor iesResult>
[snipped trailing markup]

How PEAR::SOAP translates:

array(2) {
[0]=>
object(stdClass )(3) {
["CategoryId "]=>
string(1) "1"
["Name"]=>
string(7) "Cultura"
["ParentCategory Id"]=>
string(1) "0"
}
[1]=>
object(stdClass )(3) {
["CategoryId "]=>
string(1) "2"
["Name"]=>
string(11) "Automóveis "
["ParentCategory Id"]=>
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]
<GetChildCatego riesResult>
<item>
<CategoryId>3 </CategoryId>
<Name>Carros</Name>
<ParentCategory Id>2</ParentCategoryI d>
</item>
</GetChildCategor iesResult>
[snipped trailing markup]

How PEAR::SOAP translates it:

object(stdClass )(1) {
["item"]=>
&object(stdClas s)(3) {
["CategoryId "]=>
string(1) "3"
["Name"]=>
string(6) "Carros"
["ParentCategory Id"]=>
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 1354

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

Similar topics

1
2968
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? Thanks in advance Stephan Lachmuth
0
4407
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 that, I had many problems with the PHP-dlls) I've set up several SOAP Testscripts that I found on WebSites and in PHP-Books to get a PHP Client and a PHP Server communicate over Web Services (using PEAR::SOAP).
0
2385
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 Services with SOAP .... and I can t get it work. :'-(
0
4094
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: require_once("SOAP/Client.php"); $wsdlurl = "http://myserver/myservices/mypage.php?wsdl"; $wsdl = new SOAP_WSDL($wsdlurl, array("timeout" => 360));
3
7244
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 it tells mea it can not run pear/soap, because it can not be found.the book im learning form does not tell me how to install or configure this extension. so now im looking for help.
0
1465
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 ... "; include_once("SOAP/Server.php"); print " ok!"; ?>
0
1914
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: ---------------------------------------------------- <?php require_once('SOAP/Server.php'); require_once('SOAP/Disco.php');
0
5608
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 SERVER================ <SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
4
3705
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. Environment: Solaris 9 php 5.2.1 GNU Make 3.81 gcc 4.1.1
0
8974
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8800
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9500
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9349
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8227
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6772
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6060
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4575
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
2765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.