怎样通过soap 得到对方传到web service 上的参数值?

解决方案 »

  1.   

    那你是在做 web service 了?
      

  2.   

    就和普通的http request类似
    也是用$_GET或者$_POST来获取
      

  3.   

    百度PHP SOAP,很多简单的例子的,不过你的配置里一定要有PHP_SOAP.DLL,这个文件,并且保证开启,否则测试不了!有分带WSDL,和不带WSDL的例子!简单例子的测试不难的。
      

  4.   

    不过PHP5做WEBSERVER,好象网上资料不全,而且不太适合,做CLIENT端倒是还可以!
    现在6就要出来了。你看看可否考虑用6来做SERVER端,在这方面。NET确实比PHP要强些!纯个人浅见!
      

  5.   

    你是要写服务器端吧?
    function InterfaceName($params)
    {
    //$params里面是参数,类型是对象//这样就可以看到参数,die不可少.
    var_dump($params);die;
    }
    客户端的话,你拼一个XML字串,通过post发过去就行了.XML字串的格式,可以用软件soapui看。
      

  6.   


    $client = new SoapClient("http://www.xxx.com/service/service.asmx?WSDL");
    $param=array();
    $arr = $client->__soapCall('ServiceMethod',array('parameters' => $param));
    print_r($arr);这是先传值 ,然后得到返回值 。
    我现在的操作是和它相反的
      

  7.   

    还是的,我问你是不是要做 web service ,你却不回答我服务器端
    function add($a, $b) {
    return $a + $b;
    }$server = new SoapServer(null, array('uri'=>'http://127.0.0.1'));
    $server->addFunction("add");
    $server->handle();
    客户端$client = new SoapClient ( null,  
    array ('uri' => 'http://127.0.0.1', 'location' => 'http://127.0.0.1/soap/hello.php', 'trace'=>true) );
    echo $client->add ( 3, 4 );
    客户端传来的数据被 SoapServer 自动分配给了调用的方法
      

  8.   

    开启php_soap.dll,下载nusoap放到一个文件夹里然后:server.php<?phpfunction getTime($str)
    {
       return "abc".$str;
    }$sv = new SoapServer(null,array('uri'=>'http://soap.test.test/'));
    $sv->addFunction('getTime');
    $sv->addFunction(SOAP_FUNCTIONS_ALL);
    $sv->handle();
    ?>client.php<?php
    try
    {
    $opts = array('location'=>'http://localhost/server.php','uri'=>'http://soap.test.test/');
    $client = new SoapClient(null, $opts);
    $str = "abcdedf";
    $data = $client->getTime($str);
    echo $data;
    }
    catch (SOAPFault $e)
    {
    echo "Fault! code:",$e;
    }
    ?>