problem in passing variable from soap client to soap server

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kencana
    New Member
    • Nov 2006
    • 26

    problem in passing variable from soap client to soap server

    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\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\clienttry2 .php:24 Stack trace: #0 [internal function]: SoapClient->__call('getMap ', Array) #1 C:\Program Files\MapGuideO penSource\WebSe rverExtensions\ www\phpviewersa mple\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("htt p://localhost/stockquote3.wsd l");

    try
    {
    $results= $client->getQuote($symb ol,$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($symbo l,$road){

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

    while($course = mssql_fetch_arr ay($result))
    {
    $courses[]= array('Road' => $course["Road_name"],'Postal'=>$cou rse["Postal_cod e"]);
    }
    return $courses;

    }
    }
    ini_set("soap.w sdl_cache_enabl ed", "0"); // disabling WSDL cache
    $server = new SoapServer("htt p://localhost/stockquote3.wsd l");
    $server->setClass("Quot eService");

    //$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='StockQuot e'
    targetNamespace ='http://example.org/StockQuote'
    xmlns:tns=' http://example.org/StockQuote '
    xmlns:soap='htt p://schemas.xmlsoap .org/wsdl/soap/'
    xmlns:xsd='http ://www.w3.org/2001/XMLSchema'
    xmlns:soapenc=' http://schemas.xmlsoap .org/soap/encoding/'
    xmlns:wsdl='htt p://schemas.xmlsoap .org/wsdl/'
    xmlns='http://schemas.xmlsoap .org/wsdl/'>

    <message name='getQuoteR equest'>
    <part name='symbol'/>
    </message>
    <message name='getQuoteR esponse'>
    <part name='Result'/>
    </message>

    <portType name='StockQuot ePortType'>
    <operation name='getQuote' >
    <input message='tns:ge tQuoteRequest'/>
    <output message='tns:ge tQuoteResponse'/>
    </operation>

    </portType>

    <binding name='StockQuot eBinding' type='tns:Stock QuotePortType'>
    <soap:binding style='rpc'
    transport='http ://schemas.xmlsoap .org/soap/http'/>
    <operation name='getQuote' >
    <soap:operati on 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='StockQuot eService'>
    <port name='StockQuot ePort' binding='StockQ uoteBinding'>
    <soap:address location='http://localhost/servertry2.php'/>
    </port>
    </service>
    </definitions>
Working...