|
Posted by mjed01 on 10/16/06 21:04
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:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://www.test.co.uk/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://www.test.co.uk/soap/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://www.test.co.uk/soap/">
<s:element name="func">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="a"
type="tns:thing" />
</s:sequence>
</s:complexType>
</s:element>
<s:complexType name="thing">
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="a"
type="s:string" />
</s:sequence>
</s:complexType>
<s:element name="funcResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="funcResult"
type="tns:thing" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="funcSoapIn">
<wsdl:part name="parameters" element="tns:func" />
</wsdl:message>
<wsdl:message name="funcSoapOut">
<wsdl:part name="parameters" element="tns:funcResponse" />
</wsdl:message>
<wsdl:portType name="testSoap">
<wsdl:operation name="func">
<wsdl:input message="tns:funcSoapIn" />
<wsdl:output message="tns:funcSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="testSoap" type="tns:testSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="func">
<soap:operation soapAction="http://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="testSoap12" type="tns:testSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="func">
<soap12:operation soapAction="http://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:testSoap">
<soap:address location="http://localhost/test.php" />
</wsdl:port>
<wsdl:port name="testSoap12" binding="tns:testSoap12">
<soap12:address location="http://localhost/test.php" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
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.wsdl_cache_enabled", "0");
$server = new SoapServer( $wsdl, array('soap_version' => 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:funcResponse/>
</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.
[Back to original message]
|