zendframework / zend-soap

Soap component from Zend Framework
BSD 3-Clause "New" or "Revised" License
75 stars 43 forks source link

[AutoDiscover] Use typehinting on PHP7 #58

Open bigfoot90 opened 5 years ago

bigfoot90 commented 5 years ago

Currently AutoDiscover is not using typehint feature from PHP7. The main problem is that currently SoapServer is returning empty resposnse and status code 202 Accepted.

My service class:

class MyService
{
    /**
     * @param string $x
     * @return string
     */
    public function test(string $x): string
    {
        return $x;
    }
}

Expected

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
             xmlns:tns="http://localhost/api/My" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="MyService"
             targetNamespace="http://localhost/api/My">
    <types>
        <xsd:schema targetNamespace="http://localhost/api/My"/>
    </types>
    <portType name="MyServicePort">
        <operation name="test">
            <documentation>test</documentation>
            <input message="tns:testIn"/>
            <output message="tns:testOut"/>
        </operation>
    </portType>
    <binding name="MyServiceBinding" type="tns:MyServicePort">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="test">
            <soap:operation soapAction="http://localhost/api/My#test"/>
            <input>
                <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                           namespace="http://localhost/api/My"/>
            </input>
            <output>
                <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                           namespace="http://localhost/api/My"/>
            </output>
        </operation>
    </binding>
    <service name="MyServiceService">
        <port name="MyServicePort" binding="tns:MyServiceBinding">
            <soap:address location="http://localhost/api/My"/>
        </port>
    </service>
    <message name="testIn">
        <part name="x" type="xsd:string"/>
    </message>
    <message name="testOut">
        <part name="return" type="xsd:string"/>
    </message>
</definitions>

Actual

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
             xmlns:tns="http://localhost/api/My" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap-enc="http://schemas.xmlsoap.org/soap/encoding/"
             xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" name="MyService"
             targetNamespace="http://localhost/api/My">
    <types>
        <xsd:schema targetNamespace="http://localhost/api/My"/>
    </types>
    <portType name="MyServicePort">
        <operation name="test">
            <documentation>test</documentation>
            <input message="tns:testIn"/>
        </operation>
    </portType>
    <binding name="MyServiceBinding" type="tns:MyServicePort">
        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
        <operation name="test">
            <soap:operation soapAction="http://localhost/api/My#test"/>
            <input>
                <soap:body use="encoded" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
                           namespace="http://localhost/api/My"/>
            </input>
        </operation>
    </binding>
    <service name="MyServiceService">
        <port name="MyServicePort" binding="tns:MyServiceBinding">
            <soap:address location="http://localhost/api/My"/>
        </port>
    </service>
    <message name="testIn">
        <part name="x" type="xsd:anyType"/>
    </message>
</definitions>
weierophinney commented 4 years ago

This repository has been closed and moved to laminas/laminas-soap; a new issue has been opened at https://github.com/laminas/laminas-soap/issues/3.