NuSphere Forums Forum Index
NuSphere Forums
Reply to topic
Passing XML information in a single variable


Joined: 17 Jun 2009
Posts: 1
Reply with quote
Hi

I need to pass a single variable containing XML elements to a webservice.
The service only has one variable xmlLeads declared, but the format of this needs to be XML.

My file looks like this:

<?php

//create XML lead
$xmlcode = '
<?xml version="1.0" encoding="utf-8" ?>
<Lead>
<General>
<dealer>576</dealer>
<source>Cars</source>
<enquiry>1</enquiry>
<subtype>4</subtype>
<comment />
</General>
<Prospect>
<title>Test Title</title>
<name>Test Name</name>
<surname>Test Surname</surname>
<email>Test Email</email>
<home>Test Home</home>
<work>Test Work</work>
<mobile>Test Mobile</mobile>
<idnumber>Test Idnumber</idnumber>
<comment>Testing please notify me if you receive this lead.</comment>
<area>Test Area</area>
</Prospect>
<Item>
<id>43</id>
<purchaseDate></purchaseDate>
</Item>
</Lead>
';
//echo($xmlcode);


//send lead
$wsdlurl2 = "http://leadEngine.ix.co.za/Submit.asmx?WDSL";

include_once("../lib/nusoap.php");
$nusoapClient2 = new nusoap_client($wsdlurl2, 'wsdl');
$err2 = $nusoapClient2->getError();
if ($err2) {
throw new Exception('Constructor error' . $err2);
}

$result3 = $nusoapClient2->call('SubmitLead',array('xmlLead'=>"$xmlcode"));
print_r($result3);

?>
The print_r($result3) returns an empty string. If i change the variables however it throws an XML missing error, which means it is connecting correctly.
If I run the webservice through soapUI and just copy my xmlcode variable contents into the webservice between the xmlLead tags it works perfectly.
I am new to webservices in general. Is it possible to pass the entire XML contents through like this?
View user's profileFind all posts by vrugteSend private message
Passing XML information in a single variable
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT - 5 Hours  
Page 1 of 1  

  
  
 Reply to topic