請教一下php的pear soap的問題

liang1022 2008-10-30
請教一下php調用java webservice的問題,不知道我的參數那裏錯呢?
結果總是出現:The named parameter value is not in the call parameters.
我的php 代碼如下
<?php   
require_once('SOAP/Client.php');   
$client = new SOAP_Client('http://localhost:8080/axis2/services/HelloWorldService?wsdl');   
  
$params = array('echoRequest'=>'World');   
$return = $client->call('echo',$params);   
echo $return;   
?>  

使用工具查看這支webservice的WSDL如下:
<?xml version="1.0" encoding="utf-16"?>   
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://joeyta.test" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" targetNamespace="http://joeyta.test" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">   
  <wsdl:types>   
    <s:schema attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://joeyta.test">   
      <s:element name="echo">   
        <s:complexType>   
          <s:sequence>   
            <s:element minOccurs="0" name="value" nillable="true" type="s:string" />   
          </s:sequence>   
        </s:complexType>   
      </s:element>   
      <s:element name="echoResponse">   
        <s:complexType>   
          <s:sequence>   
            <s:element minOccurs="0" name="return" nillable="true" type="s:string" />   
          </s:sequence>   
        </s:complexType>   
      </s:element>   
    </s:schema>   
  </wsdl:types>   
  <wsdl:message name="echoRequest">   
    <wsdl:part name="parameters" element="tns:echo" />   
  </wsdl:message>   
  <wsdl:message name="echoResponse">   
    <wsdl:part name="parameters" element="tns:echoResponse" />   
  </wsdl:message>   
  <wsdl:portType name="HelloWorldServicePortType">   
    <wsdl:operation name="echo">   
      <wsdl:input message="tns:echoRequest" />   
      <wsdl:output message="tns:echoResponse" />   
    </wsdl:operation>   
  </wsdl:portType>   
  <wsdl:binding name="HelloWorldServiceSoap11Binding" type="tns:HelloWorldServicePortType">   
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />   
    <wsdl:operation name="echo">   
      <soap:operation soapAction="urn:echo" style="document" />   
      <wsdl:input>   
        <soap:body use="literal" />   
      </wsdl:input>   
      <wsdl:output>   
        <soap:body use="literal" />   
      </wsdl:output>   
    </wsdl:operation>   
  </wsdl:binding>   
  <wsdl:binding name="HelloWorldServiceSoap12Binding" type="tns:HelloWorldServicePortType">   
    <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" />   
    <wsdl:operation name="echo">   
      <soap12:operation soapAction="urn:echo" style="document" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" />   
      <wsdl:input>   
        <soap12:body use="literal" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" />   
      </wsdl:input>   
      <wsdl:output>   
        <soap12:body use="literal" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" />   
      </wsdl:output>   
    </wsdl:operation>   
  </wsdl:binding>   
  <wsdl:binding name="HelloWorldServiceHttpBinding" type="tns:HelloWorldServicePortType">   
    <http:binding verb="POST" />   
    <wsdl:operation name="echo">   
      <http:operation location="HelloWorldService/echo" />   
      <wsdl:input>   
        <mime:content part="echo" type="text/xml" />   
      </wsdl:input>   
      <wsdl:output>   
        <mime:content part="echo" type="text/xml" />   
      </wsdl:output>   
    </wsdl:operation>   
  </wsdl:binding>   
  <wsdl:service name="HelloWorldService">   
    <wsdl:port name="HelloWorldServiceHttpSoap11Endpoint" binding="tns:HelloWorldServiceSoap11Binding">   
      <soap:address location="http://192.168.0.102:8080/axis2/services/HelloWorldService.HelloWorldServiceHttpSoap11Endpoint/" />   
    </wsdl:port>   
    <wsdl:port name="HelloWorldServiceHttpSoap12Endpoint" binding="tns:HelloWorldServiceSoap12Binding">   
      <soap12:address location="http://192.168.0.102:8080/axis2/services/HelloWorldService.HelloWorldServiceHttpSoap12Endpoint/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" />   
    </wsdl:port>   
    <wsdl:port name="HelloWorldServiceHttpEndpoint" binding="tns:HelloWorldServiceHttpBinding">   
      <http:address location="http://192.168.0.102:8080/axis2/services/HelloWorldService.HelloWorldServiceHttpEndpoint/" />   
    </wsdl:port>   
  </wsdl:service>   
</wsdl:definitions>  


liang1022 2008-10-31
自己研究出來了
原來是要抓這一行的name
<s:element minOccurs="0" name="value" nillable="true" type="s:string" /> 

謝謝各位
Global site tag (gtag.js) - Google Analytics