dongwo5940 2016-11-22 16:59
浏览 58
已采纳

PHP SOAP服务器 - 函数不能获取所有元素

Hi i've a WSDL with an argument as input, and 3 arguments as output.

But when i use a client, i get only one argument!

Here my WSDL:

<?xml version="1.0" encoding="UTF-8"?>
<definitions name="gestioneAssistitiDefinitions" targetNamespace="http://test.it/test/soapServer/" xmlns:tns="http://test.it/test/soapServer/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://schemas.xmlsoap.org/wsdl/">
<types>
    <xsd:schema elementFormDefault="qualified">
        <xsd:complexType name="assistito">
            <xsd:all>           
              <xsd:element name="cognome" type="xsd:string" />
              <xsd:element name="nome" type="xsd:string" />
              <xsd:element name="codiceFiscale" type="xsd:string" />
            </xsd:all>
        </xsd:complexType>
    </xsd:schema>       
</types>
<message name="gestioneAssistiti">
  <part name="codFiscale" type="xsd:string" />
</message>
<message name="gestioneAssistitiRisposta">
  <part name="assistito" type="tns:assistito" />
</message>
<portType name="gestioneAssistitiPortType">
  <operation name="gestioneAssistiti">
    <documentation>Ottiene i dati dell'assitito partendo dal codice fiscale</documentation>
    <input message="tns:gestioneAssistiti"/>
    <output message="tns:gestioneAssistitiRisposta"/>
  </operation>
</portType>
<binding name="gestioneAssistitiBinding" type="tns:gestioneAssistitiPortType">
  <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
  <operation name="gestioneAssistiti">
    <soap:operation soapAction="ottieniAssistito" style="rpc"/>
    <input><soap:body use="encoded" namespace="http://test.it/test/soapServer/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></input>
    <output><soap:body use="encoded" namespace="http://test.it/test/soapServer/" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/></output>
  </operation>
</binding>
<service name="gestioneAssistiti">
  <port name="gestioneAssistitiPort" binding="tns:gestioneAssistitiBinding">
    <soap:address location="http://test.it/test/soapServer/richiesta.php"/>
  </port>
</service>
</definitions>

Here my php server function:

$server= new SoapServer("server.wsdl", array('soap_version' => SOAP_1_2));
$server->addFunction("gestioneAssistiti");
$server->handle();

function gestioneAssistiti($codFiscale){

    $variabili = array(
        'cognome' => 'Test',
        'nome' => 'Stefano',
        'codiceFiscale' => $codFiscale
    );



    return $variabili;
}

And at the end my only result argument is: "nome".

Why? Where is the mistake?

  • 写回答

1条回答 默认 最新

  • doubi1818 2016-11-24 15:49
    关注

    Ok, my error was on the php part... Using class, it works! :)

    $oggetto = new stdClass();
    
    $oggetto->cognome = 'Venneri';
    $oggetto->nome = 'Stefano';
    $oggetto->codiceFiscale = $codFiscale;
    
    return $oggetto;
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 电脑出问题了,说是usbmom注册表没
  • ¥20 需要步骤截图(标签-服务器|关键词-map)
  • ¥50 gki vendor hook
  • ¥15 灰狼算法和蚁群算法如何结合
  • ¥15 这是一个利用ESP32自带按键和LED控制的录像代码,编译过程出现问题,请解决并且指出错误,指导如何处理 ,协助完成代码并上传代码
  • ¥20 stm32f103,hal库 hal_usart_receive函数接收不到数据。
  • ¥20 求结果和代码,sas利用OPTEX程序和D-efficiency生成正交集
  • ¥50 adb连接不到手机是怎么回事?
  • ¥20 抓取数据时发生错误: get_mooncake_data() missing 1 required positional argument: 'driver'的问题,怎么改出正确的爬虫代码?
  • ¥15 vs2022无法联网