ugrás a tartalomhoz

SoapClient hibakeresés

carstepD · 2008. Aug. 26. (K), 11.40
Üdv Mindenkinek,

olyan kérdésem lenne,hogy van egy comlpex type-os Soap Server és Client, mindkettő PHP-ban van megcsinálva, de állandóan hibaüzentet kapok: DTD are not Supported by SOAP-al

Server (wsServer.php):
  1. <?php  
  2.     class ctManu {  
  3.         /** @var string Identity of the Manufacturer */  
  4.         public $id;  
  5.         /** @var string Name of the Manufacturer */  
  6.         public $name;  
  7.           
  8.         public function __construct( $id$name ) {  
  9.             $this->id    = $id;  
  10.             $this->name  = $name;  
  11.         }  
  12.     }  
  13.   
  14.     class wsServer {  
  15.         protected $tranid;  
  16.           
  17.         public function __construct( ) {  
  18.             $this->tranid = $this->loadTransid();  
  19.         }  
  20.           
  21.         private function loadTransid() {  
  22.             if ( !isset($_SESSION) ) {  
  23.                 session_start();  
  24.             }  
  25.               
  26.             //return $_SESSION['tranid'];  
  27.             return '20C';  
  28.         }  
  29.           
  30.         /** 
  31.          * Get Car manufacturers to fill up combobox 
  32.          * @param string $tranid transaction identifier after login 
  33.          * @return ctManu[] 
  34.          */  
  35.         public function getManufacturers( $tranid ) {  
  36.             if ( $tranid == $this->tranid ) {  
  37.                 $out = array(  
  38.                     new ctManu('aaa','Opel'),  
  39.                     new ctManu('xxx','Porsche')  
  40.                 );  
  41.                   
  42.                 return $out;  
  43.             }  
  44.         }  
  45.     }  
  46.     ini_set("soap.wsdl_cache_enabled""0");   
  47.       
  48.     $server = new SoapServer( "http://localhost/wsdlmaker/example/wsServer.php" );  
  49.     $server->setClass( "wsServer" );  
  50.     $server->handle();  
  51. ?>  
Client (wsclient.php):
  1. <?php  
  2.   
  3.     $client = new SoapClient("http://localhost/wsdlmaker/example/wsServer.wsdl");  
  4.     $tranid = '20C';  
  5.     //var_dump( $client->__getFunctions() );  
  6.     //var_dump( $client->__getTypes() );  
  7.     try{  
  8.         $res = $client->getManufacturers( $tranid );  
  9.     } catch ( SoapFault $SF) {  
  10.         var_dump( $SF );  
  11.     }  
  12.     var_dump($res);?>  
wsdl (wsServer.wsdl):
  1. <?xml version="1.0" encoding="UTF-8"?>  
  2. <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" name="service1" targetNamespace="http://localhost/WS/login.php?f=wsServer.wsdl" xmlns:tns="http://localhost/WS/login.php?f=wsServer.wsdl" xmlns:impl="http://localhost/WS/login.php?f=wsServer.wsdl" xmlns:xsd1="http://localhost/WS/login.php?f=wsServer.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">  
  3.   <types>  
  4.     <schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="http://localhost/WS/login.php?f=wsServer.wsdl">  
  5.       <complexType name="ArrayOfctManu">  
  6.         <complexContent>  
  7.           <restriction base="soapenc:Array">  
  8.             <attribute ref="soapenc:arrayType" wsdl:arrayType="tns:ctManu[]"/>  
  9.           </restriction>  
  10.         </complexContent>  
  11.       </complexType>  
  12.       <complexType name="ctManu">  
  13.         <sequence>  
  14.           <element name="id" type="xsd:string"/>  
  15.           <element name="name" type="xsd:string"/>  
  16.         </sequence>  
  17.       </complexType>  
  18.     </schema>  
  19.   </types>  
  20.   <portType name="service1PortType">  
  21.     <operation name="getManufacturers" parameterOrder="tranid">  
  22.       <input message="tns:GetManufacturersRequest"/>  
  23.       <output message="tns:GetManufacturersResponse"/>  
  24.     </operation>  
  25.   </portType>  
  26.   <binding name="service1Binding" type="tns:service1PortType">  
  27.     <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>  
  28.     <operation name="getManufacturers">  
  29.       <soap:operation soapAction="urn:service1#service1Server#getManufacturers"/>  
  30.       <input>  
  31.         <soap:body parts="tranid" use="encoded" namespace="http://localhost/WS/login.php?f=wsServer.wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>  
  32.       </input>  
  33.       <output>  
  34.         <soap:body parts="return" use="encoded" namespace="http://localhost/WS/login.php?f=wsServer.wsdl" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>  
  35.       </output>  
  36.     </operation>  
  37.   </binding>  
  38.   <message name="GetManufacturersRequest">  
  39.     <part name="tranid" type="xsd:string"/>  
  40.   </message>  
  41.   <message name="GetManufacturersResponse">  
  42.     <part name="return" type="tns:ArrayOfctManu"/>  
  43.   </message>  
  44.   <service name="service1Service">  
  45.     <port name="service1Port" binding="tns:service1Binding">  
  46.       <soap:address location="http://localhost/wsdlmaker/example/wsServer.php"/>  
  47.     </port>  
  48.   </service>  
  49. </definitions>  
Azt hiszem, jelen pillanatban ez így elég jól használható, mindössze, annyi, hogy az egészet a "docroot"/wsdlmaker/example könyvtárba kellene helyezni.

Én már nem látom a fától az erdőt és a hibát sem tudom felderíteni. Egy szóköz változás sincs a tegnap estihez képest.

A kérdés, hogy ha valaki le tudná tesztelni, hogy nála se működik az jó lenne és megköszönném? Tegnap éjjel még működött, de ma reggelre felmondta a szolgálatot. Nem éles rendszer!!!

Üdv
Sanyi
 
1

megloldás

carstepD · 2008. Aug. 26. (K), 13.30
Sziasztok Még1x,

hát hosszú bajlódás után végül is sikerült kiderítenem, hogy a PHP cache-li a wsdl fájlokat és hiába van kikapcsolva a cache-lés 1xűen nem hajlandó frissíteni a wsdl, csak ha manuálisan kitörlöm a cache-ből a wsdl kezdetű fájt.

Mindenesetre sokat segített a __getLastResponse(), __getLastRequestHeaders, __getLastRequest függvények a probléma felderítésében.

Elnézést mindenkitől, aki foglalkozott vele és idejét vettel el.

Üdv
Sanyi