473,320 Members | 2,080 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,320 software developers and data experts.

how to assign attributes to paramater in php for nusoap client

Hi all

I'm having trouble assigning an attribute to a namespace using nusoap/php when creating a new soapclient. I can get the soapclient to assign the parameters correctly but can't assign an attribute to any namespaces. The code below is from the actual soap request and i need to assign the 'ApplicantID' from the soapclient to the Applicant parameter for each new applicant, then have nested arrays within various arrays.

Expand|Select|Wrap|Line Numbers
  1. <Applicant ApplicantID="1">
  2. <Title>Miss</Title>
  3. <Forename>Tessa</Forename>
  4. <Secondname>Jane</Secondname>
  5. <Surname>Smith</Surname>
  6. <DOB>1966-12-29</DOB>
  7. <TelephoneHome>01942408669</TelephoneHome>
  8. <TelephoneWork>01942724915</TelephoneWork>
  9. </Applicant>
I've set up all the arrays as follows, but was wondering how to assign the 'ApplicantID' to the 'Applicant' array in the soapclient.

[PHP]$header = array('userId' => 'Ivuser', 'password' => 'Ivpa55word');
$loandetail = array('Loan' => '5000', 'Term' => '24');
$Applicant =
$result = $client->call('sendv1', array('header' => $header), array('loandetail' => $loandetail));[/PHP]

i'm a total nusoap novice so sorry if i haven't given enough information. Your help would be much appreciated.
Jun 20 '07 #1
4 7306
pbmods
5,821 Expert 4TB
Heya, johnners. Welcome to TSDN!

It sounds like you're looking for an XML parser. PHP's got a couple of those....
Jun 20 '07 #2
thanks for the reply - we're using a shared windows server which is having a few problems with .net applications and ssl certificates, hence we decided to re-write the application using php to access a webservice using a soap client. However we cannot have access to the php.ini or full root of the server to make any changes to the configuration of php. Using php4 so we thought we'd give nusoap a go to create the soap client. Just need to know how to code the array for the 'Applicant' in the soap client as the namespace has the 'ApplicantID' attribute. Having trouble getting the soapclient to pass on the 'ApplicantID' as part of the namespace.

Not sure if i'm explaining it very clearly!
Jun 20 '07 #3
I too am needing to know how to set a node attribute. I need to set an attribute to false to indicate a testing environment versus a live environment, and cannot test the XML call without that attribute which is required by the webservice server...

Anyone? Anyone? Bueller?

AG


Hi all

I'm having trouble assigning an attribute to a namespace using nusoap/php when creating a new soapclient. I can get the soapclient to assign the parameters correctly but can't assign an attribute to any namespaces. The code below is from the actual soap request and i need to assign the 'ApplicantID' from the soapclient to the Applicant parameter for each new applicant, then have nested arrays within various arrays.

Expand|Select|Wrap|Line Numbers
  1. <Applicant ApplicantID="1">
  2. <Title>Miss</Title>
  3. <Forename>Tessa</Forename>
  4. <Secondname>Jane</Secondname>
  5. <Surname>Smith</Surname>
  6. <DOB>1966-12-29</DOB>
  7. <TelephoneHome>01942408669</TelephoneHome>
  8. <TelephoneWork>01942724915</TelephoneWork>
  9. </Applicant>
I've set up all the arrays as follows, but was wondering how to assign the 'ApplicantID' to the 'Applicant' array in the soapclient.

[PHP]$header = array('userId' => 'Ivuser', 'password' => 'Ivpa55word');
$loandetail = array('Loan' => '5000', 'Term' => '24');
$Applicant =
$result = $client->call('sendv1', array('header' => $header), array('loandetail' => $loandetail));[/PHP]

i'm a total nusoap novice so sorry if i haven't given enough information. Your help would be much appreciated.
Jul 20 '07 #4
pbmods
5,821 Expert 4TB
I don't generally use XML parsers to generate XML, to be honest. What I do is create an XML template and then create tags where I'd want stuff to go.

Expand|Select|Wrap|Line Numbers
  1. <Applicant ApplicantID="[::ApplicantID::]">
  2. <Title>[::Title::]</Title>
  3. <Forename>[::Forename::]</Forename>
  4. <Secondname>[::Secondname::]</Secondname>
  5. <Surname>[::Surname::]</Surname>
  6. <DOB>[::DOB::]</DOB>
  7. <TelephoneHome>[::TelephoneHome::]</TelephoneHome>
  8. <TelephoneWork>[::TelephoneWork::]</TelephoneWork>
  9. </Applicant>
  10.  
Then load up your template, create an array of content:
Expand|Select|Wrap|Line Numbers
  1. $content = array(
  2.     '[::ApplicantID::]' => $applicantID,
  3.     '[::Title::]'       => $title,
  4.     .
  5.     .
  6.     .
  7. );
  8.  
And then run a fancy str_replace():
Expand|Select|Wrap|Line Numbers
  1. $xml = str_replace(array_keys($content), array_values($content), $template);
  2.  
Jul 20 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Eric Dennison | last post by:
I've been playing around with NuSOAP as a PHP based SOAP server and client. Works great! Now I'm trying to write (using gSOAP) a simple C/C++ based client to test against my simple SOAP server....
2
by: Larry Sankey | last post by:
Hello. I am having what is probably the simplest problem there is with Nusoap. I have to admit I'm new to this stuff, but I have some programming experience and what I'm doing *shouldn't* be hard....
0
by: Unbreakable | last post by:
I am using the nusoap client and nusoap server without any problem. However, once I change the client to the excel, I am not sure how to call the nusoap server. Especially the nusoap server only...
5
by: Mark C | last post by:
I have a memory allocation problem in PHP using NuSOAP and the built in XML parser. The code below is called in a loop and executed about 1900 times before it failed. I am using nusoap.php,v 1.76...
0
by: Afnan Zari | last post by:
Hi, i've facing a problem in nusoap server ... scenario is my server is in NUSoap ... and have used complex types in my WS. My client is Pear Soap and GSoap. NuSoap ws accepts an argument...
2
by: Johnny | last post by:
Searched on google for any info relating to this before posting here but found none. I set up a web service using nusoap on apache php 4.3.8 on windows with error_reporting = E_ALL and had that...
0
by: spoonlikesham | last post by:
I've never used SOAP before, so am more than a little foggy on it. Just doing a project where it's basically the only way, and due to limitations on the server, I have to use nuSOAP (unless there's...
6
amine
by: amine | last post by:
Hello People, I created a WebService in .NET on my machine with following methode: <WebMethod(Description:="test")> _ Public Function sayHello(ByVal myName As String, ByVal myID As Integer)...
7
by: craig.keightley | last post by:
I have access to the following web service but always retreive the same error:- Array ( =soapenv:Server.userException =se.brodit.ws.InvalidUserException =Array ( =webserver
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.