Created
December 30, 2011 11:59
-
-
Save aminin/1539513 to your computer and use it in GitHub Desktop.
PHP SoapServer ignores invalid enum value
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ns1="test-service-namespace"> | |
<SOAP-ENV:Body> | |
<ns1:TestOperation> | |
<ns1:firstArgument> | |
<!-- Wrong enum --> | |
<ns1:timeGroup>FooBar</ns1:timeGroup> | |
<!-- Good enum --> | |
<ns1:customerType>CHILD</ns1:customerType> | |
</ns1:firstArgument> | |
</ns1:TestOperation> | |
</SOAP-ENV:Body> | |
</SOAP-ENV:Envelope> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version='1.0' encoding='UTF-8'?> | |
<wsdl:definitions | |
xmlns:xs="http://www.w3.org/2001/XMLSchema" | |
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" | |
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" | |
targetNamespace="test-service-namespace" | |
name="TestService"> | |
<wsdl:types> | |
<xs:schema targetNamespace="test-service-namespace" elementFormDefault="qualified"> | |
<xs:simpleType name="TimeGroupEnum"> | |
<xs:restriction base="xs:string"> | |
<xs:enumeration value="NOGROUP"/> | |
<xs:enumeration value="DAY"/> | |
<xs:enumeration value="WEEK"/> | |
<xs:enumeration value="MONTH"/> | |
<xs:enumeration value="QUARTER"/> | |
<xs:enumeration value="YEAR"/> | |
</xs:restriction> | |
</xs:simpleType> | |
<xs:simpleType name="CustomerTypeEnum"> | |
<xs:restriction base="xs:string"> | |
<xs:enumeration value="CHILD"/> | |
<xs:enumeration value="ADULT"/> | |
</xs:restriction> | |
</xs:simpleType> | |
<xs:complexType name="TestStructure"> | |
<xs:sequence> | |
<xs:element name="timeGroup" type="tns:TimeGroupEnum"/> | |
<xs:element name="customerType" type="tns:CustomerTypeEnum"/> | |
</xs:sequence> | |
</xs:complexType> | |
<xs:complexType name="TestOperation"> | |
<xs:sequence> | |
<xs:element name="firstArgument" type="tns:TestStructure"/> | |
</xs:sequence> | |
</xs:complexType> | |
<xs:complexType name="TestOperationResponse"> | |
<xs:sequence> | |
<xs:element name="TestOperationResult" type="xs:string" minOccurs="0" nillable="true"/> | |
</xs:sequence> | |
</xs:complexType> | |
<xs:element name="TestStructure" type="tns:TestStructure"/> | |
<xs:element name="TestOperation" type="tns:TestOperation"/> | |
<xs:element name="TestOperationResponse" type="tns:TestOperationResponse"/> | |
</xs:schema> | |
</wsdl:types> | |
<wsdl:message name="TestOperation"> | |
<wsdl:part name="TestOperation" element="tns:TestOperation"/> | |
</wsdl:message> | |
<wsdl:message name="TestOperationResponse"> | |
<wsdl:part name="TestOperationResponse" element="tns:TestOperationResponse"/> | |
</wsdl:message> | |
<wsdl:portType name="TestService"> | |
<wsdl:operation name="TestOperation" parameterOrder="TestOperation"> | |
<wsdl:input name="TestOperation" message="tns:TestOperation"/> | |
<wsdl:output name="TestOperationResponse" message="tns:TestOperationResponse"/> | |
</wsdl:operation> | |
</wsdl:portType> | |
<wsdl:binding name="TestService" type="tns:TestService"> | |
<soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> | |
<wsdl:operation name="TestOperation"> | |
<soap:operation soapAction="TestOperation" style="document"/> | |
<wsdl:input name="TestOperation"> | |
<soap:body use="literal"/> | |
</wsdl:input> | |
<wsdl:output name="TestOperationResponse"> | |
<soap:body use="literal"/> | |
</wsdl:output> | |
</wsdl:operation> | |
</wsdl:binding> | |
<wsdl:service name="TestService"> | |
<wsdl:port name="TestService" binding="tns:TestService"> | |
<soap:address location="http://localhost/test/service"/> | |
</wsdl:port> | |
</wsdl:service> | |
</wsdl:definitions> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Проверка упадёт ли SOAP сервер от неправильного енума | |
// reportType из request.xml не соответствует определению service.wsdl.xml | |
function TestOperation($params) | |
{ | |
print_r($params); | |
die(); | |
return array('TestOperationResult' => 42); | |
return 42; | |
} | |
$soapServer = new SoapServer('service.wsdl.xml'); | |
$soapServer->addFunction('TestOperation'); | |
$request = file_get_contents('request.xml'); | |
print_r($soapServer->handle($request)); | |
die("\n\n"); |
Thanks for a detailed list of php soap server's limitations.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
There's actually quite a bit it doesn't support, have a look at the TODO from the source
General
to return structures instead of strings
SOAP
Encoding
? full support for standard simple types (
? language, (pattern: "[a-zA-Z]{1,8}(-[a-zA-Z0-9]{1,8})")
? NMTOKEN, (pattern: "\c+") (\c: [a-zA-Z0-9.-:])
? NMTOKENS, (list: NMTOKEN, minLength: 1)
? Name, (pattern: "\i\c_") (\i: [a-zA-Z_:]
? NCName, (pattern: "[\i-[:]][\c-[:]]*")
? ID, (base: NCName)
? IDREF, (base: NCName)
? IDREFS, (list: IDREF; minLength: 1)
? ENTITY, (base: NCName)
? ENTITIES, (list: ENTITY; minLength: 1)
? duration)
? full support for standard date/time types (
? dateTime,
? time,
? date,
? gYearMonth,
? gYear,
? gMonthDay,
? gDay,
? gMonth)
? full support for arrays
SOAP 1.2 doesn't support partially transmitted and sparse arrays
? support for "nillable" and "nil"
? default values of
? provide schema 1999/2001 support???
? make internal refrences for soap encoding (use seralization logic)???
? provide user space overriding of serialization certin objects and types???
WSDL
? server part support for "document" style encoding
? support for , soap:fault
? soap:headerfault
Schema
Transport
? HTTP status codes
? HTTP chunked Transfer-Encoding
? support for HTTP compression (gzip,x-gzip,defalte)
Interop Testing
UDDI