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="" xmlns:tns="" xmlns:soap="" xmlns:soapenc="" xmlns:wsdl="" xmlns:xsd="" xmlns="">
    <xsd:schema elementFormDefault="qualified">
        <xsd:complexType name="assistito">
              <xsd:element name="cognome" type="xsd:string" />
              <xsd:element name="nome" type="xsd:string" />
              <xsd:element name="codiceFiscale" type="xsd:string" />
<message name="gestioneAssistiti">
  <part name="codFiscale" type="xsd:string" />
<message name="gestioneAssistitiRisposta">
  <part name="assistito" type="tns:assistito" />
<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"/>
<binding name="gestioneAssistitiBinding" type="tns:gestioneAssistitiPortType">
  <soap:binding style="rpc" transport=""/>
  <operation name="gestioneAssistiti">
    <soap:operation soapAction="ottieniAssistito" style="rpc"/>
    <input><soap:body use="encoded" namespace="" encodingStyle=""/></input>
    <output><soap:body use="encoded" namespace="" encodingStyle=""/></output>
<service name="gestioneAssistiti">
  <port name="gestioneAssistitiPort" binding="tns:gestioneAssistitiBinding">
    <soap:address location=""/>

Here my php server function:

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

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;
    打赏 评论

相关推荐 更多相似问题