2013-05-15 53 views
0

我正在編程一個小小的windows phone 7應用程序。它應該消費Web服務。我在xammp(local)環境中成功測試了代碼,但是如果在免費webhoster上,我會收到錯誤「notFound」。我測試了一切,現在我需要幫助。windows手機,wsdl函數「not found」錯誤

wsdl文件

<?xml version="1.0" encoding="UTF-8"?> 
<wsdl:definitions 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" 
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" 
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" 
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
xmlns:tns="http://schwarzes-imperium.de/witzeAppWp" 
targetNamespace="http://schwarzes-imperium.de/witzeAppWp"> 
<wsdl:types> 
<xs:schema targetNamespace="http://schwarzes-imperium.de/witzeAppWp.wsdl" elementFormDefault="qualified"/> 
</wsdl:types> 
<wsdl:message name="loginCheckRequest"> 
<wsdl:part name="name" type="xs:string"/> 
<wsdl:part name="password" type="xs:string"/> 
</wsdl:message> 
<wsdl:message name="loginCheckResponse"> 
<wsdl:part name="Result" type="xs:string"/> 
</wsdl:message> 
<wsdl:message name="ausgabeRequest"> 
<wsdl:part name="text" type="xs:string"/> 
</wsdl:message> 
<wsdl:message name="ausgabeResponse"> 
<wsdl:part name="Result" type="xs:string"/> 
</wsdl:message> 
<wsdl:portType name="witzeAppWpPortType"> 
<wsdl:operation name="loginCheck"> 
    <wsdl:input message="tns:loginCheckRequest"/> 
    <wsdl:output message="tns:loginCheckResponse"/> 
</wsdl:operation> 
<wsdl:operation name="ausgabe"> 
    <wsdl:input message="tns:ausgabeRequest"/> 
    <wsdl:output message="tns:ausgabeResponse"/> 
</wsdl:operation> 
</wsdl:portType> 
<wsdl:binding name="witzeAppWpBinding" type="tns:witzeAppWpPortType"> 
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> 
<wsdl:operation name="loginCheck"> 
    <soap:operation soapAction="urn:#loginCheck" style="document"/> 
    <wsdl:input> 
    <soap:body use="literal"/> 
    </wsdl:input> 
    <wsdl:output> 
    <soap:body use="literal"/> 
    </wsdl:output> 
</wsdl:operation> 
<wsdl:operation name="ausgabe"> 
    <soap:operation soapAction="urn:#ausgabe" style="document"/> 
    <wsdl:input> 
    <soap:body use="literal"/> 
    </wsdl:input> 
    <wsdl:output> 
    <soap:body use="literal"/> 
    </wsdl:output> 
</wsdl:operation> 
</wsdl:binding> 
<wsdl:service name="witzeAppWpService"> 
<wsdl:port name="witzeAppWpPort" binding="tns:witzeAppWpBinding"> 
    <soap:address location="http://schwarzes-imperium.de/witzeAppWp.php"/> 
</wsdl:port> 
</wsdl:service> 
</wsdl:definitions> 

PHP文件

<?php 
include 'sql.php'; 
function loginCheck($name, $password){ 
if ($password == "test") 
{ 
    return "JA"; 
}else 
{ 
    return "NEIN"; 
} 
} 
function ausgabe($id){ 
#$result = sqlQuery("SELECT * FROM witze_tb"); 
#return mysql_result($result, $id, 1); 
return $id; 
} 
$server = new SoapServer("witzeAppWp.wsdl"); 
$server->addFunction("loginCheck"); 
$server->addFunction("ausgabe"); 
$server->handle(); 
?> 

任何想法? Thx

回答

0

WSDL鏈接應該是一個絕對路徑,你確定你的功能正確嗎? 我記得webservices總是希望有一個數組中的參數。如:

$webserivce = new SoapClient('http://localhost:8080/Service.svc?wsdl'); 
$welcome = array('name' => 'Marijke', 
      'surname' => 'Hakvoort'); 
$response = $webservice->WelcomeMessage($welcome); 
echo $response->WelcomeMessageResult; 

其中WelcomeMessage是一個函數,名字和姓氏的參數。

相關問題