2012-09-07 82 views
0

我正在嘗試使用PHP和Web服務的幫助來構建Web應用程序。我想通過Web服務使用PHP的PDO連接到數據庫。我已經構建了服務器文件,客戶端文件和wsdl文件。通過各種測試,我發現我的wsdl文件存在一些問題,因爲當我在服務器和客戶端文件中使用其他wsdl文件運行其他函數時,它們正常工作。我和本地主機一起工作,所有文件都位於wamp/www/myApp/api /目錄(Apache 2.2.8,PHP 5.2.6)。我張貼wsdl文件供您參考。請告訴我哪裏出錯,並指導我糾正錯誤。謝謝。肥皂給予Uncaught SoapFault異常:[HTTP]錯誤獲取http標頭

WSDL文件:

<?xml version="1.0" encoding="utf-8"?> 
    <definitions name="MyService" xmlns="http://schemas.xmlsoap.org/wsdl/" targetNamespace="http://My.Local.IP/myApp/api/my.wsdl" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"> 

<message name="LoginRequest"> 
    <part name="dns" type="xsd:string"/> 
    <part name="user" type="xsd:string"/> 
    <part name="password" type="xsd:string"/> 
</message> 
<message name="LoginResponse"> 
    <part name="result" type="xsd:string"/> 
</message> 

<portType name="Fetch_PortType"> 
    <operation name="Login"> 
     <input message="tns:LoginRequest"/> 
     <output message="tns:LoginResponse"/> 
    </operation> 
</portType> 

<binding name="MyService_Binding" type="tns:Fetch_PortType"> 
    <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/> 
    <operation name="Login"> 
     <soap:operation soapAction="http://My.Local.IP/myApp/api/Login"/> 
     <input name="Login"> 
      <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"/> 
     </input> 
     <output name="Login"> 
      <soap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" use="encoded"/> 
     </output> 
    </operation> 
</binding> 

<service name="My_Service"> 
    <documentation>WSDL File MyService</documentation> 
    <port name="Fetch_PortType" binding="tns:MyService_Binding"> 
     <soap:address location="http://My.Local.IP/myApp/api/server.php"/> 
    </port> 
</service> 
    </definitions> 

回答

0

可能是一個PHP錯誤在服務器級或類/函數實現登錄方法。 直接訪問文件會發生什麼?請檢查你的錯誤日誌。

+0

@ Louis ..登錄方法很好。 ($ dsn,$ user,$ password) { \t try { \t \t $ dbh = new PDO($ dsn,$ user,$ password); catch(PDOException $ e){ \t \t return $ result = $ e-> getMessage(); \t} }。 – Sid

+0

wsdl中的SoapAction是否正常? – Sid

-1

我從來沒有自己寫過WSDL。相反,您可以編寫一個鏡像.NET Web服務並使用自動生成的WSDL(通過MS Visual Studio)。

相關問題