你用的是nusoap扩展类还是用的自带的soap类呢

解决方案 »

  1.   

    这个是nusoap扩展类的用法,你要先去下一个nusoap工具类$soapClient = new nusoap_client("http://218.245.0.236:7880/sms?WSDL",true);
    $parameters=array(**,**,**);
    $outString = $soapClient->call("webserviceName", $parameters);
    //一般是这样调的
    //call方法里还可以配很多参数,你根据自己的需要来配,有问题的话,去下个抓包工具来看发送和接收到的包就行
      

  2.   

    我下载了一个nusoap-0.9.5.zip,用的里面lip里的nusoap.php。
    我代码是这样写的include('nusoap.php');
    // 创建一个soapclient对象,参数是server的WSDL 
    $client = new soapclient('http://218.245.0.236:7880/sms?WSDL', 'wsdl');
    // 参数转为数组形式传递
    $aryPara = array('spID'=>'922017', 'Password'=>MD5('admin41501012'));
    // 调用远程函数
    $aryResult = $client->call('RetrieveAll',$aryPara);echo $aryResult;
    我在网页上运行后他返回的是Array,这是什么意思呢?我得返回值应该是RESULTCODE #@#BALANCE#@#
    RDFLAG#@#MID#@#SPID#@#ACCESSCODE#@#MOBILE#@#STAT#@#DELIVERTIME#@#        RDFLAG#@#MID#@#SPID#@#ACCESSCODE#@#MOBILE#@#MSGCONTENT#@#DELIVERTIME#@#
    这种形式的!
    还有我在网上看得例子上面有这个
    $document=$client->document;
    echo <<<SoapDocument
    <?xml version="1.0" encoding="GB2312"?>
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd">
       <SOAP-ENV:Body>
       $document
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    SoapDocument;
    这又是什么意思呢?谢谢指教!
      

  3.   

    如果你调用成功了,返回的就是那个webservice执行后的结果呀
      

  4.   

    首先你要确认下,返回的是不是webservice返回的正确的结果集
      

  5.   

    编码也要设置下        $soapClient->soap_defencoding = 'utf-8';
            $soapClient->decode_utf8 = false;
            $soapClient->xml_encoding = 'utf-8';调用前加这段代码
    可以解决乱码问题 
      

  6.   

    他输出的是Array,我返回值的形式应该是1#@#0#@#这种形式的!
    我在代码里加上
    $document=$client->document;
    echo <<<SoapDocument
    <?xml version="1.0" encoding="GB2312"?>
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:si="http://soapinterop.org/xsd">
       <SOAP-ENV:Body>
       $document
       </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    SoapDocument;

    ?>这些后,就出现一个Array 3#@#-1#@#,这是什么意思呢?加上这段代码是什么意思呢?
      

  7.   

    我用的时候没有加这一串东西。
    他这样写的意思应该是构造发送过去的包吧。你不用写这段代码啊
    而且我发觉你用的soapclient方法,这个是PHP 5.0+自带的soap类中的方法,并不是你使用的nusoap扩展类。
    如果你要使用soap类要修改php.int中的配置,然后重启服务器。
    你就这样写include('nusoap.php');
    // 创建一个soapclient对象,参数是server的WSDL 
    $client = new nusoap_client('http://218.245.0.236:7880/sms?WSDL', true);
    // 解决编码(如果需要的话就加上)
    /*
    $soapClient->soap_defencoding = 'utf-8';
    $soapClient->decode_utf8 = false;
    $soapClient->xml_encoding = 'utf-8';
    */
    // 参数转为数组形式传递
    $aryPara = array('spID'=>'922017', 'Password'=>MD5('admin41501012'));
    // 调用远程函数
    $aryResult = $client->call('RetrieveAll',$aryPara);echo $aryResult;就这样调用 其它不用加
      

  8.   

    我把你的代码加上怎么提示我$client = new nusoap_client('http://218.245.0.236:7880/sms?WSDL', true);语法错误呢?
    你是用什么软件编写的呢?我用的dreamerweaver,环境是warm
      

  9.   

    你搜一下你的nusoap.php 文件,client方法具体命名是什么,之前你写的soapclient,是soap类中的方法,如果nusoap类里面的也是叫这个名字可能会产生冲突的
      

  10.   

    顺便推荐你个PHP IDE 叫做PHPSTORM 非常好用
      

  11.   

    谢谢你的帮忙了!我现在使用代理方式调用可以出来值了,直接调用还是没出来。第一次接触PHP什么都不懂,郁闷!
    还有,我使用代理方式调用的时候换必须有这段代码才可以<?xml version=”1.0″ encoding=”GB2312″?>
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/” xmlns:SOAP-ENV=”http://schemas.xmlsoap.org/soap/envelope/” xmlns:xsd=”http://www.w3.org/2001/XMLSchema” xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:SOAP-ENC=”http://schemas.xmlsoap.org/soap/encoding/” xmlns:si=”http://soapinterop.org/xsd“>
    <SOAP-ENV:Body>
    $document
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    SoapDocument;
    ?>如果没有这段代码直接输出的话只能出现一个Array,郁闷。我在看下吧!
      

  12.   

    楼主能给一下具体代码吗?因为我php都没学过但现在在一周之内必须完成,时间急,求解救!麻烦您把包和php代码发到我邮箱:[email protected]   谢谢!