0

我正在编写一个小的 windows phone 7 应用程序。它应该使用网络服务。我在 xammp(本地)环境中成功测试了代码,但如果在免费的 webhoster 上,我收到错误“notFound”。我已经测试了一切,现在我需要帮助。

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();
?>

任何想法?谢谢

4

2 回答 2

0

不确定是不是类似的问题。我也在寻找如何在 WindownsPhone 上进行 SOAP 调用,发现WSDL 是否与 Windows Phone 8 兼容? 我仍在寻找更简单的方法。

于 2013-06-04T05:07:39.007 回答
0

WSDL 链接应该是绝对路径,您确定您的功能正确吗?我记得 web 服务总是希望将 args 放在一个数组中。如:

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

其中WelcomeMessage 是一个函数,name 和surname 的args。

于 2013-06-04T10:12:16.863 回答