Home » Php » How to use XSD files with PHP SOAP server/client?

How to use XSD files with PHP SOAP server/client?

Posted by: admin August 13, 2018 Leave a comment


I’m new to SOAP and I’ve been tasked with creating a SOAP server that receives messages that are a part of the papiNet standard.

Sample XSD:
Sample message:

The standard only defines XSD files.

I’ve set up a test Zend-SOAP server following this: https://dev.to/dopitz/implementing-a-soap-api-with-php-a3n

How would I transfer objects that are specified in the XSD? I’ve seen people importing the XSD in a manually created WSDL file: https://stackoverflow.com/a/12125913

I managed to bodge together a WSDL from the auto generated methods and the above importing example.

<?xml version="1.0" encoding="UTF-8"?>
        <xsd:schema targetNamespace="http://test.loc/api/soap">
            <xsd:import namespace="http://www.papinet.org/v2r40" schemaLocation="http://www.papinet.org/fileadmin/user_upload/v2r40/DeliveryMessageV2R40.xsd" />
    <portType name="SoapEndpointPort">
        <operation name="storeDeliveryMessage">
            <documentation>Store and process a DeliveryMessage</documentation>
            <input message="tns:storeDeliveryMessageIn" />
            <output message="tns:storeDeliveryMessageOut" />
    <binding name="SoapEndpointBinding" type="tns:SoapEndpointPort">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http" />
        <operation name="storeDeliveryMessage">
            <soap:operation soapAction="http://test.loc/api/soap#storeDeliveryMessage" />
                <soap:body use="literal" />
                <soap:body use="literal" />
    <message name="storeDeliveryMessageIn">
        <part name="parameters" element="pn:DeliveryMessage" />

I have no idea if I’m on the right track. The DeliveryMessage type now appears in getTypes of a Zend-SOAP client. How would the client use the type information to construct the message body? How would a server receive the object?