麻烦在Java和PHP之间通过SOAP进行通信

时间:2011-02-09 22:41:40

标签: java php soap

这是用Java编写的SOAP中最重要的(我认为)部分:

@WebService()
public class VremeaServerModule {

    /**
     * Web service operation
     */
    @WebMethod(operationName = "getWeatherForCity")
    public String getWeatherForCity(@WebParam(name = "city") String city) throws IOException {

这是发出SOAP请求的PHP代码:

function getWeather($cityName)
{
  $wsdl_url = "some_url";
  $WSDL = new SOAP_WSDL($wsdl_url);
  $client = $WSDL->getProxy();
  $params = array("city" => $cityName);
  print_r($params);
  $result = $client->getWeatherForCity($params);
  return $result;
}
事实是,Java总是将城市视为空。有什么我想念的吗?

1 个答案:

答案 0 :(得分:0)

你试过这个:     $ result = $ client-> getWeatherForCity($ cityName);