详细描述是,一个用其他程序的web 项目 想通过输入一些参数来获得php web项目上的数据(查询结果集),请问用什么方式呢。我选择web service但是传字符串还可以,传结果集还没有尝试过。我的代码如下: header("Content-Type:text/html;charset=gb2312");
    include_once('./common.php');
    @include_once (S_ROOT.'./source/nusoap.php');//插入文件
    
    $server = new soap_server();
    $server->configureWSDL('hellowsdl', 'urn:hellowsdl');
    $server->wsdl->schemaTargetNamespace = 'urn:hellowsdl';
    
    $server->register('hello',                 // method name
    array('username'=>'xsd:string'),         // input parameters
    array('return' => 'xsd:array()'),       // output parameters
    'urn:hellowsdl',                       // namespace
    'urn:hellowsdl#hello',                 // soapaction
    'rpc',                                 // style
    'encoded',                             // use
    'Says hello to the caller'             // documentation
    );
    
    function hello($username) {
          $staut = '';
    $uid = GetArray($username);
    return $staut;
    }
    
    $HTTP_RAW_POST_DATA = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : '';
    
    $server->service($HTTP_RAW_POST_DATA);

解决方案 »

  1.   

    webservice可行,可以考虑把结果集序列化,或者采用json数据传输或者考虑在php项目里做个api接口,把获取参数后得到的结果集输出到页面,用其它程序获取页面内容就可以了,安全上说,没有webservice 好
      

  2.   

    我正考虑json呢,不过web service还是首选
      

  3.   

    既然你打算用 SOAP,那么就该用 XML 文档了