soap клиент + сервер

Sigorma

Новичок
soap клиент + сервер

Собственно поставлена задача разобраться с soap для интеграции сайта с внутренним ПО.

почитав статью PHP SOAP Extension на zend.com пришло некоторое понимание технологии но при попытке запустить примеры сервер+клиент на своей машине получил стабильный феил.

все примеры запускались на машине с конфигурацией:

Win XP
PHP 5.2.4 (собственно стоит денвер, домашняя машина)

phpinfo:

Soap Client enabled
Soap Server enabled
soap.wsdl_cache 1 1
soap.wsdl_cache_dir /tmp /tmp
soap.wsdl_cache_enabled 1 1
soap.wsdl_cache_limit 5 5
soap.wsdl_cache_ttl 86400 86400

server.php
PHP:
<?php  
class QuoteService {  
  private $quotes = array("ibm" => 98.42);    

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

$server = new SoapServer("stockquote.wsdl");  
$server->setClass("QuoteService");  
$server->handle();  
?>
client.php
PHP:
<?php
$client = new SoapClient("stockquote.wsdl",
	array(
		"trace"      => 1,
		"exceptions" => 0));

$client->getQuote("ibm");  
print "<pre>\n";  
print "getLastRequest:\n".$client->__getLastRequest() ."\n";  
print "getLastResponse:\n".$client->__getLastResponse()."\n";  
print "</pre>";  
?>
stockquote.wsdl
Код:
<?xml version ='1.0' encoding ='UTF-8' ?> 
<definitions name='StockQuote' 
 targetNamespace='http://example.org/StockQuote' 
 xmlns:tns=' [url]http://example.org/StockQuote[/url] ' 
 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> 

<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/stockquote.wsdl'/> 
 </port> 
</service> 
</definitions>
Все скрипты лежат в одной директории.

на запрос http://localhost/client.php

получаю результат:

getLastRequest:
Код:
<SOAP-ENV:Envelope
 		xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 		xmlns:ns1="urn:xmethods-delayed-quotes"
 		xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 		xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 		xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
 		SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
 <SOAP-ENV:Body>
  <ns1:getQuote>
   <symbol xsi:type="xsd:string">ibm</symbol>
  </ns1:getQuote>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>
getLastResponse:

"exceptions" => 1:
Fatal error: Uncaught SoapFault exception: [HTTP] Not Found in Z:\home\localhost\www\client.php:7 Stack trace: #0 [internal function]: SoapClient->__doRequest('<?xml version="...', 'http://server/s...', 'urn:xmethods-de...', 1, 0) #1 [internal function]: SoapClient->__call('getQuote', Array) #2 Z:\home\localhost\www\client.php(7): SoapClient->getQuote('ibm') #3 {main} thrown in Z:\home\localhost\www\client.php on line 7

Возможно кто то сможет подсказать как это лечится?

Т.к. на сегодняшний день нет необходимости в soap сервере, нужно только отправлять и получать(парсить) ответ, то временным решением стал Curl который не только работает более чем стабильно но и позволяет в ручную составлять запрос серверу чего как я понял не позволяет делать SoapClient

Второй вопрос на который собственно не удалось найти нормального решения это парсинг soap ответа и что сейчас решается в общем то набором регулярных выражений либо пачкой эксплодов. Генерируемый ответ синтаксисом сильно похож на ответы соап ЦБР с ихними выгрузками валют. Может кто подскажет хорошую библиотеку для парсинга? :)
 
Сверху