I am at the point of pulling my hair out for this one. So I have setup a SOAP server and a SOAP Client to test my soap server.
Calling a method on the SOAP Server with using a wsdl gives the expected result, but as soon as I tell the client and server to make use of the wsdl, it every call comes back with the follwoing error:
SoapFault exception: [Client] looks like we got no XML document in C:\\inetpub\\wwwroot\\matieadvantage\\root\\api\ est_service.php:7 Stack trace: #0 [internal function]: SoapClient->__call('validate_studen...', Array) #1 C:\\inetpub\\wwwroot\\matieadvantage\\root\\api\ est_service.php(7): SoapClient->validate_studentcard(Array) #2 {main}
Never the soap response headers or the soap response is sent back to the client.
here is my server code:
// web service
$soap = new SoapServer($wsdl, array('uri' => "http://localhost/matieadvantage/validate_studentcard", 'features' => SOAP_SINGLE_ELEMENT_ARRAYS));
$soap->setClass("webservice_handler");
$soap->handle();
my client code:
$client = new SoapClient("http://localhost/matieadvantage/root/api/validate_studentcard.wsdl", array("uri" => "http://localhost/matieadvantage/validate_studentcard"));
try {
$params = array("studentnumber" => "1090", "matiecardnumber" => "125863521459");
$result = $client->validate_studentcard($params);
print_r($result) ;
} catch (SoapFault $exception) {
echo $exception;
// DEBUG
var_dump($client->__getFunctions());
var_dump($client->__getLastResponseHeaders());
var_dump(htmlspecialchars($client->__getLastResponse()));
// END DEBUG
}
and my wsdl :
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions name="matieadvatange" targetNamespace="http://www.example.org/matieadvatange/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://www.example.org/matieadvatange/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.example.org/matieadvatange/">
<xsd:element name="validate_studentcard">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="studentnumber" type="xsd:string"></xsd:element>
<xsd:element name="matiecardnumber" type="xsd:string"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="validate_studentcardResponse" type="tns:validate_studentcardResponseType"></xsd:element>
<xsd:complexType name="validate_studentcardResponseType">
<xsd:sequence>
<xsd:element name="status" type="xsd:string" maxOccurs="1" minOccurs="1"></xsd:element>
<xsd:element name="initials" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element>
<xsd:element name="lastname" type="xsd:string" maxOccurs="1" minOccurs="0"></xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="validate_studentcardRequest">
<wsdl:part name="parameters" element="tns:validate_studentcard"></wsdl:part>
</wsdl:message>
<wsdl:message name="validate_studentcardResponse">
<wsdl:part name="parameters" element="tns:validate_studentcardResponse"></wsdl:part>
</wsdl:message>
<wsdl:portType name="port_matieadvatange">
<wsdl:operation name="validate_studentcard">
<wsdl:input message="tns:validate_studentcardRequest"></wsdl:input>
<wsdl:output message="tns:validate_studentcardResponse"></wsdl:output>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="port_matieadvatange" type="tns:port_matieadvatange">
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
<wsdl:operation name="validate_studentcard">
<soap:operation soapAction="http://www.example.org/matieadvatange/student_enquiry.php" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="matieadvatange">
<wsdl:port name="matieadvatange" binding="tns:port_matieadvatange">
<soap:address location="http://www.example.org/" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I hope some one can help me determine what the problem is. The wsdl files is accessable.