why does soapserver always returns a null object?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • mjed01@googlemail.com

    why does soapserver always returns a null object?

    hi,

    i am trying to implement a web service using php. it should return a
    complex type, but it is always null.

    i have the following wsdl:
    <?xml version="1.0" encoding="utf-8"?>

    <wsdl:definitio ns xmlns:soap="htt p://schemas.xmlsoap .org/wsdl/soap/"
    xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
    xmlns:soapenc=" http://schemas.xmlsoap .org/soap/encoding/"
    xmlns:mime="htt p://schemas.xmlsoap .org/wsdl/mime/"
    xmlns:tns="http ://www.test.co.uk/soap/"
    xmlns:s="http://www.w3.org/2001/XMLSchema"
    xmlns:soap12="h ttp://schemas.xmlsoap .org/wsdl/soap12/"
    xmlns:http="htt p://schemas.xmlsoap .org/wsdl/http/"
    targetNamespace ="http://www.test.co.uk/soap/"
    xmlns:wsdl="htt p://schemas.xmlsoap .org/wsdl/">

    <wsdl:types>

    <s:schema elementFormDefa ult="qualified"
    targetNamespace ="http://www.test.co.uk/soap/">

    <s:element name="func">

    <s:complexTyp e>

    <s:sequence>

    <s:element minOccurs="0" maxOccurs="1" name="a"
    type="tns:thing " />

    </s:sequence>

    </s:complexType>

    </s:element>

    <s:complexTyp e name="thing">

    <s:sequence>

    <s:element minOccurs="0" maxOccurs="1" name="a"
    type="s:string" />

    </s:sequence>

    </s:complexType>

    <s:element name="funcRespo nse">

    <s:complexTyp e>

    <s:sequence>

    <s:element minOccurs="0" maxOccurs="1" name="funcResul t"
    type="tns:thing " />

    </s:sequence>

    </s:complexType>

    </s:element>

    </s:schema>

    </wsdl:types>

    <wsdl:message name="funcSoapI n">

    <wsdl:part name="parameter s" element="tns:fu nc" />

    </wsdl:message>

    <wsdl:message name="funcSoapO ut">

    <wsdl:part name="parameter s" element="tns:fu ncResponse" />

    </wsdl:message>

    <wsdl:portTyp e name="testSoap" >

    <wsdl:operati on name="func">

    <wsdl:input message="tns:fu ncSoapIn" />

    <wsdl:output message="tns:fu ncSoapOut" />

    </wsdl:operation>

    </wsdl:portType>

    <wsdl:binding name="testSoap" type="tns:testS oap">

    <soap:binding transport="http ://schemas.xmlsoap .org/soap/http" />

    <wsdl:operati on name="func">

    <soap:operati on soapAction="htt p://www.test.co.uk/soap/func"
    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="testSoap1 2" type="tns:testS oap">

    <soap12:bindi ng transport="http ://schemas.xmlsoap .org/soap/http" />

    <wsdl:operati on name="func">

    <soap12:operati on soapAction="htt p://www.test.co.uk/soap/func"
    style="document " />

    <wsdl:input>

    <soap12:body use="literal" />

    </wsdl:input>

    <wsdl:output>

    <soap12:body use="literal" />

    </wsdl:output>

    </wsdl:operation>

    </wsdl:binding>

    <wsdl:service name="test">

    <wsdl:port name="testSoap" binding="tns:te stSoap">

    <soap:address location="http://localhost/test.php" />

    </wsdl:port>

    <wsdl:port name="testSoap1 2" binding="tns:te stSoap12">

    <soap12:addre ss location="http://localhost/test.php" />

    </wsdl:port>

    </wsdl:service>

    </wsdl:definition s>


    i then have the following php script:
    <?php

    class thing
    {
    public $a;
    }

    class test
    {
    public function func($a)
    {
    $a->a = "returning" ;
    return $a;
    }
    }

    $wsdl = "test.wsdl" ;

    ini_set("soap.w sdl_cache_enabl ed", "0");
    $server = new SoapServer( $wsdl, array('soap_ver sion' =SOAP_1_2));

    $server->setClass("test ");
    $server->handle();

    ?>

    however, whatever i pass to the web method i get:
    <?xml version="1.0" encoding="UTF-8"?>
    <SOAP-ENV:Envelope
    xmlns:SOAP-ENV="http://schemas.xmlsoap .org/soap/envelope/"
    xmlns:ns1="http ://www.test.co.uk/soap/">
    <SOAP-ENV:Body>
    <ns1:funcRespon se/>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>

    ie. funcResponse is null.

    i'm sure i'm missing something simple so any help would be much
    appreciated.

    many thanks,
    mike.

Working...