小弟现在需要实现的功能很简单,就是调用一个webservice,传递一个身份证号码进行查询,得到一个结果,webservice方法
如下:
/***********************************************************************
WebClientResult getWebClientResult(java.lang.Integer identityType,
                                   java.lang.String identityId)
查询 
Parameters:
identityType - 证件类型
identityId - 证件号 
Returns:
***********************************************************************/
现在的这个webservice:
http://*******/spring/services/WebClientService?wsdl,webservice需要http验证!
才能调用的!小弟的问题就是
①如何调用webservice的时候通过http验证,从而不需要输入弹出的用户名跟密码框,假设用户名是:admin;密码是:123456;该如何实现②如何得到这个webservice的返回结果小弟由于没有学习过PHP,对这块实在是欠缺,非常的遗憾,但是又接到这样的任务,不得不去做,
麻烦PHP的高手们帮小弟解决一下这个问题,小弟感激不尽!
分少,小弟等会开贴再加分!谢谢各位了先

解决方案 »

  1.   

    <?php
    require_once('../nusoap/lib/nusoap.php');
    $client = new soapclient('http://*******/spring/services/WebClientService?wsdl', 'wsdl');   

    $client->soap_defencoding = 'utf-8';
    $client->decode_utf8 = false;
    $client->setDefaultRpcParams(true);
    $params = array(
        'ickey'    => $keyno,    
    );
    $proxy = $client->getProxy();
    $result = $proxy->getWebClientResult($params);
    $document=$proxy->document;  
    echo $document;
                                    
    ?>
    需要下载一个nusoap包。。
      

  2.   

    都是直接用库的 http://ca3.php.net/manual/en/class.soapclient.php其它的也有
      

  3.   

    麻烦大家帮帮忙啊,给点注释之类的,小弟对PHP实现是不熟悉,谢谢大家了
      

  4.   

    帮我检查一下代码,好像没有返回值,不知道怎么回事!搞了半天都没结果<?php
    require_once('nusoap.php');
    $password = urlencode("123456"); 
    $username = "yxwycx"; 
    $wsdl = "http://".$username.":".$password."@***/spring/services/WebClientService?wsdl";  //这是网上别人处理http验证的,不知道对不对?
    $client = new soapclient($wsdl, true); 
    $client->setCredentials($username, $password); 
    $err = $client->getError();
    if ($err) {
     echo '<h2>对不起!有错误!</h2><pre>' . $err . '</pre>';
    }$param = array('identityType' =>'0','identityId' => '341139399393939');$result = $client->call('getWebClientResult', array('parameters' => $param), '', '', false, true,'document','encoded');   
    if ($client->fault) {   
        echo '<h2>Fault</h2><pre>';   
        print_r($result);   
        echo '</pre>';   
    } else {   
          $err = $client->getError();   
          if ($err) {   
              echo '<h2>Error</h2><pre>' . $err . '</pre>';   
          }    
          else    
          {   
                echo '<h2>Result</h2><pre>';   
                echo print_r($result['out']);   
                echo '</pre>';   
          }   
    }   
    麻烦帮我看看啊
    ?>
      

  5.   

    try:
    $soapClient = new SoapClient("http://*******/spring/services/WebClientService?wsdl",array("login"=>"admin","password"=>"123456"));$result = $soapClient->__soapCall('getWebClientResult',array('identityType' =>'0','identityId' => '341139399393939'));print_r($result);
      

  6.   

    http://username:[email protected]/path/to/serviceps: 用http的话,都是明文的,抓个包就能得到了
      

  7.   

    $client = new soapclient();这个类的文档没给出, 没办法回答  
      

  8.   

    http://218.90.172.130:32009/spring/services/WebClientService?wsdl真是对不起了,真实的地址附上了