我用php调用一个接口可是却总掉不到方法,
它给的wsdl文档是这样的:<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://aaa.ws.boss.huashu.com" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://aaa.ws.boss.huashu.com" xmlns:intf="http://aaa.ws.boss.huashu.com" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<!--WSDL created by Apache Axis version: 1.2.1
Built on Aug 08, 2005 (11:49:10 PDT)-->   <wsdl:message name="authenticationRequest">      <wsdl:part name="in0" type="xsd:string"/>   </wsdl:message>   <wsdl:message name="authenticationResponse">      <wsdl:part name="authenticationReturn" type="xsd:string"/>   </wsdl:message>   <wsdl:portType name="AAAService">      <wsdl:operation name="authentication" parameterOrder="in0">         <wsdl:input message="impl:authenticationRequest" name="authenticationRequest"/>         <wsdl:output message="impl:authenticationResponse" name="authenticationResponse"/>      </wsdl:operation>   </wsdl:portType>   <wsdl:binding name="AAAServiceSoapBinding" type="impl:AAAService">      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>      <wsdl:operation name="authentication">         <wsdlsoap:operation soapAction=""/>         <wsdl:input name="authenticationRequest">            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://aaa.ws.boss.huashu.com" use="encoded"/>         </wsdl:input>         <wsdl:output name="authenticationResponse">            <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://aaa.ws.boss.huashu.com" use="encoded"/>         </wsdl:output>      </wsdl:operation>   </wsdl:binding>   <wsdl:service name="AAAServiceService">      <wsdl:port binding="impl:AAAServiceSoapBinding" name="AAAService">         <wsdlsoap:address location="http://10.26.111.240:10001"/>      </wsdl:port>   </wsdl:service></wsdl:definitions>
我的php代码是这样的:require_once($mosConfig_absolute_path."/includes/shinyv/nusoap.php");
$s=new soapclient($this->_serviceUrl);
//echo $this->_serviceUrl;exit;
$s->soap_defencoding = 'ISO-8859-1';
$s->decode_utf8 = false;
$s->xml_encoding = 'ISO-8859-1';
$result=$s->call('authentication', $this->getXml());
可是总掉不到authentication的方法,服务器地址也对,但是报错,
错误如下:
SOAP-ENV:Client: Method 'ns4951:authentication' not implemented: method name or namespace not recognized<xmp

解决方案 »

  1.   

    似乎你应该调用的方法是AAAService,传入参数是authenticationRequest(即:array('authenticationRequest'=>'值'))
      

  2.   

    我写的webserver  貌似和你的不一样 - -
    我的文档很简单。
    <?php $client = new SoapClient("http://localhost/ldapService.do?wsdl");
     $handle1 = $client->authUser(array("in0" => "userName","in1" =>"password")); 
     $handle2 = $client->getAttr(array("in0" => "userName","in1" =>"password","in2"=>"givenName"));
     echo ((int)($handle1->out)); echo $handle2->out;
     ?>
      

  3.   

    <?php $client = new SoapClient("http://localhost/ldapService.do?wsdl");
     $handle1 = $client->authUser(array("in0" => "userName","in1" =>"password")); 
     $handle2 = $client->getAttr(array("in0" => "userName","in1" =>"password","in2"=>"givenName"));
     echo ((int)($handle1->out)); echo $handle2->out;
     ?>
      

  4.   

    Boolean authUser(String userName, String password)
    功能:認證使用者帳號與密碼的函式。
    說明:如果帳號密碼正確則傳回Boolean-True,否則傳回Boolean-False。
    參數 :userName : 使用者帳號 password : 使用者密碼String getAttr(String userName,String password,String attr)
    功能:取得使用者所在單位名稱。
    說明:如果帳號密碼正確則傳回所欲取得的屬性,否則傳回空字串。
    參數 :userName : 使用者帳號 password : 使用者密碼
    attr : 欲回傳的屬性