By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,587 Members | 1,168 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,587 IT Pros & Developers. It's quick & easy.

problem in passing variable from soap client to soap server

P: 26
hi All,

I got problem in passing data (more than one) from soap client to the soap server. but if i only passing one data at a time, it works successfully..
The following is the error message i get when i pass more than one data:
"SoapFault exception: [Client] looks like we got no XML document in C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\clienttry2.php:24 Stack trace: #0 [internal function]: SoapClient->__call('getMap', Array) #1 C:\Program Files\MapGuideOpenSource\WebServerExtensions\www\p hpviewersample\clienttry2.php(24): SoapClient->getMap(37563, '369499') #2 {main}"

I have trying to find out the solution but gave me no luck..I hope somebody can help me out...
thank you very much

regards,
Kencana

The following is my Soap Client code in PHP:
<?php
$symbol=123456;
$road="dunearn road";

$client = new SoapClient("http://localhost/stockquote3.wsdl");

try
{
$results= $client->getQuote($symbol,$road);
$n=1;
echo "Your search result(s):";
echo "<br><br>";

foreach ($results as $names)
{
$addres=$names['Road'];
$postal=$names['Postal'];
echo $addres . "," . $postal;
echo "<br>";

}
}
catch (SoapFault $exception)
{

echo $exception;
}
?>

the following is my soap server code in PHP:
<?php

class QuoteService
{

function getQuote($symbol,$road){

$courses = array();
mssql_connect ("localhost","user","password");
mssql_select_db ("roaddata");
$query = "SELECT Road_name,Postal_code from ADDRPT WHERE Postal_code LIKE '$symbol%' AND Road_name LIKE '$road%'";
$result = mssql_query($query);

while($course = mssql_fetch_array($result))
{
$courses[]= array('Road' => $course["Road_name"],'Postal'=>$course["Postal_code"]);
}
return $courses;

}
}
ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache
$server = new SoapServer("http://localhost/stockquote3.wsdl");
$server->setClass("QuoteService");

//$server->service($HTTP_RAW_POST_DATA);
$server->handle();

?>

the following is my wsdl file in XML:
<?xml version ='1.0' encoding ='UTF-8' ?>
<definitions name='StockQuote'
targetNamespace='http://example.org/StockQuote'
xmlns:tns=' http://example.org/StockQuote '
xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'
xmlns:soapenc='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
xmlns='http://schemas.xmlsoap.org/wsdl/'>

<message name='getQuoteRequest'>
<part name='symbol'/>
</message>
<message name='getQuoteResponse'>
<part name='Result'/>
</message>

<portType name='StockQuotePortType'>
<operation name='getQuote'>
<input message='tns:getQuoteRequest'/>
<output message='tns:getQuoteResponse'/>
</operation>

</portType>

<binding name='StockQuoteBinding' type='tns:StockQuotePortType'>
<soap:binding style='rpc'
transport='http://schemas.xmlsoap.org/soap/http'/>
<operation name='getQuote'>
<soap:operation soapAction='urn:xmethods-delayed-quotes#getQuote'/>
<input>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</input>
<output>
<soap:body use='encoded' namespace='urn:xmethods-delayed-quotes'
encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'/>
</output>
</operation>


</binding>

<service name='StockQuoteService'>
<port name='StockQuotePort' binding='StockQuoteBinding'>
<soap:address location='http://localhost/servertry2.php'/>
</port>
</service>
</definitions>
Nov 20 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

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