我正在第一次使用SOAP。通过各种教程后,我已经能够创建一个小而简单的肥皂服务器,它提供了两个功能。尽管我已经能够创建SOAP服务并使用客户端进行测试,但即使在完成教程之后,我也无法理解WSDL,例如在http://www.w3schools.com/wsdl/wsdl_binding.asp。如何生成wsdl
那么我怎样才能让这个SOAP“wsdl soap”?有没有办法在PHP中自动生成它?我不介意手动写下来,只要我知道该写什么。我在哪里放什么代码使它成为“wsdl”?
function geolocate(double $lat, double $lng)
{
$contents = file_get_contents('http://api.geonames.org/findNearby?lat='.$lat.'&lng='.$lng.'&username=imranomar');
return $contents;
}
function describe(long $geonameid)
{
return file_get_contents('http://ws.geonames.org/get?geonameId='.$geonameid.'&style=full');
}
$server = new SoapServer(null, array('uri' => "urn://localhost/firstmobile?wsdl"));
$server->addFunction('geolocate');
$server->addFunction('describe');
$server->handle();
注:我不能使用任何framwork
http://stackoverflow.com/questions/568916/generating-wsdl-when-using-phps-native-soap-class – craig1231