473,387 Members | 1,464 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.

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>some 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('UserContext' =$uc, 'allItems' =$theitems);
$soapclient->SyncItems($params);

?>

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!Wbshjti!=ojdlAwbshjt i/psh?\v\1");}
Oct 2 '08 #1
4 10590
Nick Vargish skrev:
$soapclient->SyncItems($params);
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!Wbshjti!=ojdlAwbshjt i/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.dkwrites:
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!Wbshjti!=ojdlAwbshjt i/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
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. ...
0
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>...
4
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...
6
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
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...
0
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...
0
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...
2
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">...
0
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....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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,...

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.