SOAP-Server don't validate request
[email protected] (Jörg Werner)
| Newsgroups | php.soap |
|---|---|
| Message-ID | <[email protected]> |
Hello,
I have a problem with the validation of the SOAP-request.
First my Serverconfig:
Debian etch, PHP 5.2-CGI, Apache 2.2, Standard-PHP SOAP Extension.
I have an valid WSDL-File bind to the SoapServer-Class:
PHP-CODE-START --------------------------------------------------------
ini_set("soap.wsdl_cache_enabled", "0");
error_reporting( E_ALL );
use_soap_error_handler(true);
class Webservice{
public function HelloWorld($in_FirstName, $in_SurName){
return new SoapParam(utf8_encode("Hello $in_FirstName
$in_SurName"), 'ResponseClause');
}
}
try{
$GLOBALS['soapServer'] = new SoapServer(
"test.wsdl"
);
$GLOBALS['soapServer']->setClass('Webservice');
$GLOBALS['soapServer']->handle();
} catch (SOAPFault $f) {
print $f->faultstring;
}
PHP-CODE-END --------------------------------------------------------
If i leave out an Parameter (here "$in_FirstName") in the request, the
soap-server may give me an Error about the wrong parameter-count.
I will remember the first time I play with PHP-SOAP, that this errors
where shown. If I use the tool SoapUI and submit the same Request, I got
no warnings too. The request-validation with SoapUI gives me the
warnings I want.
The same situation happens with validation of Request-Soap-WSDL-Types.
If I send an Wrong Parameter for FirstName, I don't get an warning. Now
it doesn't matter what I submit in the request. The server don't give any
errors or warnings.
Following is the WSDL-File:
WSDL-CODE-START --------------------------------------------------------
<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://new.webservice.namespace"
xmlns:ns="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://new.webservice.namespace">
<wsdl:types>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:ns1="http://schemas.xmlsoap.org/soap/encoding/"
targetNamespace="http://new.webservice.namespace"
elementFormDefault="qualified">
<xsd:simpleType name="MyNMTOKEN">
<xsd:restriction base="xsd:NMTOKEN">
<xsd:enumeration value="JOERG"/>
<xsd:enumeration value="GEORG"/>
</xsd:restriction>
</xsd:simpleType>
</xsd:schema>
</wsdl:types>
<wsdl:message name="HelloWorldRequest">
<wsdl:part name="FirstName" type="tns:MyNMTOKEN"/>
<wsdl:part name="SurName" type="xs:NMTOKEN"/>
</wsdl:message>
<wsdl:message name="HelloWorldResponse">
<wsdl:part name="ResponseClause" type="xs:string"/>
</wsdl:message>
<wsdl:message name="NewMessage"/>
<wsdl:portType name="HelloWorldType">
<wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldRequest"/>
<wsdl:output message="tns:HelloWorldResponse"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="HelloWorldBinding" type="tns:HelloWorldType">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="HelloWorld">
<soap:operation soapAction="dhd:#HelloWorld"/>
<wsdl:input>
<soap:body use="literal" wsdl:required="true"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="HelloWorldService">
<wsdl:port name="HelloWorldPort" binding="tns:HelloWorldBinding">
<soap:address location="http://intern.joewe74/soap/dhd_soap2.htm"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
WSDL-CODE-END --------------------------------------------------------
The PEAR-Package SOAP or NuSOAP I don't want to use, because I need the
best performance Standard-PHP Soap-Extension.
Thanks and best regards
Joerg