473,800 Members | 2,332 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

SOAP Call with multiple occurences of an element

Hi,

I'm a little bit stuck trying to send a SOAP request that includes
multiple occurrences of an element.

For the sake of illustration, this is what the relevant portions of
the SOAP request should look like:

<SyncItems>
<UserContext>
<UserID>some id</UserID>
<AuthToken>so me token</AuthToken>
</UserContext>
<allItems>
<anItem>
<name>Item One</name>
<type>Rocket parts</type>
</anItem>
<anItem>
<name>Item Two</name>
<type>Bear skins</type>
</anItem>
<allItems>
</SyncItems>
Here is some PHP code that illustrates how I would construct the
parameters for the call, except I'm not sure how I create the
"allItems" element:

<?php

$uc = array('UserID' ='fred', 'AuthToken' ='a48bf35-24525fea-3c43a25');
$i1 = array('name' ='Item One', 'type' ='Rocket parts');
$i2 = array('name' ='Item Two', 'type' ='Bear skins');
// how do I create $theitems so that the $params array created below
// will work?
$params = array('UserCont ext' =$uc, 'allItems' =$theitems);
$soapclient->SyncItems($par ams);

?>

I tried the obvious approach:

$item1 = array('anItem' =$i1);
$item2 = array('anItem' =$i2);
$theitems = array($item1, $item2);

But when I do that, the SOAP client call fails so badly I can't even
get trace information back.

I've been googling for others who may have solved this problem, but I
haven't seen anyone with answers.

Any help or suggestions would be much appreciated!

Nick
--
#include<stdio. h /* sigmask (sig.c) 20041028 PUBLIC DOMAIN */
int main(c,v)char *v;{return !c?putchar(* /* cc -o sig sig.c */
v-1)&&main(0,v+1) :main(0,"Ojdl!W bshjti!=ojdlAwb shjti/psh?\v\1");}
Oct 2 '08 #1
4 10652
Nick Vargish skrev:
$soapclient->SyncItems($par ams);
I can't find any "SyncItems" in the PHP SOAP extension. Are you using
another SOAP library?

And why $soapCLIENT - it looks like the server side code?

Anyway, you might try using the stdClass object
(http://php.net/manual/en/reserved.classes.php) to build your response
structure.

$response = new stdClass();
$response->x = 'x';
$response->y[] = 'y1';
$repsonse->y[] = 'y2';

and so on...

Regards

Jonathan
Oct 3 '08 #2

I found the solution to my problem in this bug report:

http://bugs.php.net/bug.php?id=45284

The solution is that the array of items must have integer keys
starting with 0.

Thanks!

Nick

--
#include<stdio. h /* sigmask (sig.c) 20041028 PUBLIC DOMAIN */
int main(c,v)char *v;{return !c?putchar(* /* cc -o sig sig.c */
v-1)&&main(0,v+1) :main(0,"Ojdl!W bshjti!=ojdlAwb shjti/psh?\v\1");}
Oct 3 '08 #3
Nick Vargish skrev:
The solution is that the array of items must have integer keys
starting with 0.
This is exactly what your approach with
$theitems = array($item1, $item2);
should give you.

How is your solution now?

Regards

Jonathan
Oct 3 '08 #4
Jonathan Stein <js****@image.d kwrites:
This is exactly what your approach with
$theitems = array($item1, $item2);
should give you.
How is your solution now?
It's working, thanks. Part of the problem is that the element that
contains the array doesn't correspond to any of the names in the WSDL
(I guess it's implied), so I had an extra named parameter in there
that was throwing things off.

It makes sense now, it just took a sort of intuitive leap to grasp it.

Nick

--
#include<stdio. h /* sigmask (sig.c) 20041028 PUBLIC DOMAIN */
int main(c,v)char *v;{return !c?putchar(* /* cc -o sig sig.c */
v-1)&&main(0,v+1) :main(0,"Ojdl!W bshjti!=ojdlAwb shjti/psh?\v\1");}
Oct 7 '08 #5

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

Similar topics

0
2251
by: Cleo | last post by:
Hi, I am trying to call a WebService Method written in Weblogic from VB.NET and I am getting the following error. I am using SOAP Caal s from VB.NET. Please find the wsdl file and my code. Any help would really be appreciated. Thx
0
2296
by: Michael Jackson | last post by:
I have attempted to mark up a service and it's methods so that it doesn't require the SOAPAction HTTP header to resolve the methods being called, this is done from first element in <SOAP-ENV:Body> and the request and responses are not suffixed with Request and Response. Is there some more I could do with the attributes on the class that defines the WS and on the methods. the code for the WS etc is below. This I can get to work POST...
4
2663
by: Jit Prasad | last post by:
I have been consuming a IBM Websphere (Java) web service using .Net 1.0 front end writen in VB.NET. The proxy class submits a soap request and gets a soap response. When I migrated the front-end to .NET1.1, the response from the web service appears as null in the proxy class. This only happens with .NET1.1, .NET1.0 is ok and works fine. I have played around with the System.Web.Services.Protocols.SoapDocumentMethodAttribute, but no luck....
6
2135
by: A.M-SG | last post by:
Hi, We are developing a SmartClient application and we are planning to expose business objects layer to SmartClient application by using ASP.NET SOAP web services.
3
11696
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works BEFORE: strCurrency = oSOAP.eServeSearch(CSTR(Request.Form("T1"))) until the WSDL file changed to have more <element name> T1 is just a field that accepts a STRING
0
2209
by: Grzegorz Smith | last post by:
Hi All. I 'm learning ZSI to use SOAP and I desperately need help. I'm working on example from tutorial -(examples/server/send_response/ simple/wsdl/). Here are my wsdl files -http://pastebin.com/873488. I made wsdl2py wsdl2py --complexType --file=binding.wsdl and get Example_services.py and Example_Services_types.py. Here is the Example_services.py -http://pastebin.com/873492 and Example_Services_types.py -http://pastebin.com/873494 Now...
0
1720
by: santycalde | last post by:
Hi!! I am executing a call to a webservice with SOAP and the following mistake takes place: The XML of the wsdl is: <?xml version="1.0" encoding="UTF-8" ?> - <wsdl:definitions targetNamespace ="http://PkgFechaSistemaSync" xmlns:tns ="http://PkgFechaSistemaSync" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/ " xmlns:soap12=" http://www.w3.org/2003/05/soap-envelope" xmlns:xsd ="http://www.w3.org/2001/XMLSchema "...
2
5866
by: forcey | last post by:
Hi all, I'm writing a SOAP server using the SOAP extension and I need to return an array_map_name_balance, which is defined in a WSDL file like this: <xsd:complexType name="map_name_balance"> <xsd:sequence> <xsd:element name="username" type="xsd:string"></xsd:element> <xsd:element name="balance" type="xsd:float"></xsd:element>
0
2252
by: vigneshrao | last post by:
Hi, I have been working on a script that loops through multiple records and sends data (one record per call) to a WS. I am supposed to make a new call for each record before sending the data. The problem I have is the first record gets processed fine where as the second record always; reason being the EAI expects it to be a seperate call Though I am creating/reseting a new service everytime within the foreach loop the data seems to be...
0
10505
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
10276
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
10035
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7580
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
5471
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...
0
5606
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4149
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3764
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2945
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.