newbie help!

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello
Im trying to follow an example of a stockquoting service from xmethods and not doing so well. I was following this tutorial: http://www.zend.com/php5/articles/php5-SOAP.php?article=php5-SOAP&kind=php5&id=4560&open=1&anc=0&view=1#Heading2  where all the info and orignal documents i was working from can be found.

So far i can do that and get a value returned, but id like to extend this so i can have more functions on the server, ive tried too do it and its all going a bit wrong! So far my server is the same as theirs, and i have tried too add a new function to return a digest of a value held in the array ( i havnt put the soapfault check on the new function to over complicate things as im fairly sure the problem is with the WSDL doc, shown after):

  function getQuote($symbol)
  {
    if (isset($this->quotes[$symbol]))
    {
      return $this->quotes[$symbol];
    }
    else
    {
      throw new SoapFault("Server","Unknown Symbol '$symbol'.");
    }
  }

  function getDigest($symbol)
  {
      $digestanswer = $this->quotes[$symbol];
      return md5($digestanswer);
  }

I think the problem is with my WSDL document though, im not good at them at all, any ideas? I think the namespaces are really confusing me, can anyone help? sorry this is a total newbie question but ive only just started learning and i dont want too give up! My edited WSDL:

<?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' type='xsd:string'/> 
</message> 
<message name='getQuoteResponse'> 
  <part name='Result' type='xsd:float'/> 
</message> 

<message name='getDigestRequest'> 
  <part name='symbol' type='xsd:string'/> 
</message> 
<message name='getDigestResponse'> 
  <part name='Result' type='xsd:string'/> 
</message>  

<portType name='StockQuotePortType'> 

  <operation name='getDigest'> 
    <input message='tns:getDigestRequest'/> 
    <output message='tns:getDigestResponse'/> 
  </operation>
  
  <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> 
  
  <operation name='getDigest'> 
      <soap:operation soapAction=''/> 
      <input> 
        <soap:body use="literal"/> 
      </input> 
      <output> 
        <soap:body use="literal"/> 
      </output> 
  </operation>
  
</binding> 

<service name='StockQuoteService'> 
  <port name='StockQuotePort' binding='StockQuoteBinding'> 
    <soap:address location='http://localhost/server1.php'/> 
  </port> 
</service> 

</definitions> 

thanks for any help, 
Laura

[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux