title: Creating PHP SOAP service from given WSDL
body: <p>This may come across as a terribly lazy question, but I assure you it is not. I have tried for days to get this working but I just cannot.</p>
  
  <p>I have been given a WSDL file and I need to create a SOAP service for it in PHP. Could any one tell me what the correct way of doing it is?</p>
  
  <p>The receiver of the service is expecting a "User" object to be returned when the getMember method is invoked.</p>
  
  <p>Here is the WSDL</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"&gt;
      &lt;wsdl:types&gt;
          &lt;s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/"&gt;
              &lt;s:element name="getMember"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="memCode" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="getMemberResponse"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="getMemberResult" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="getMemberByUsernameAndPassword"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="getMemberByUsernameAndPasswordResponse"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="getMemberByUsernameAndPasswordResult" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="insertMember"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="insertStr" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="insertMemberResponse"&gt;
                  &lt;s:complexType/&gt;
              &lt;/s:element&gt;
              &lt;s:element name="decodeID"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="memCode" type="s:string"/&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="decodeIDResponse"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="decodeIDResult" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="encodeID"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="memCode" type="s:string"/&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="encodeIDResponse"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="encodeIDResult" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="processPnrInfo"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="pnrXml" type="s:string"/&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="UserXml" type="s:string"/&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="extraCosts" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="processPnrInfoResponse"&gt;
                  &lt;s:complexType/&gt;
              &lt;/s:element&gt;
              &lt;s:element name="CancelPNR"&gt;
                  &lt;s:complexType&gt;
                      &lt;s:sequence&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="paxSurname" type="s:string"/&gt;
                          &lt;s:element minOccurs="0" maxOccurs="1" name="pnrNo" type="s:string"/&gt;
                      &lt;/s:sequence&gt;
                  &lt;/s:complexType&gt;
              &lt;/s:element&gt;
              &lt;s:element name="CancelPNRResponse"&gt;
                  &lt;s:complexType/&gt;
              &lt;/s:element&gt;
          &lt;/s:schema&gt;
      &lt;/wsdl:types&gt;
      &lt;wsdl:message name="getMemberSoapIn"&gt;
          &lt;wsdl:part name="parameters" element="tns:getMember"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="getMemberSoapOut"&gt;
          &lt;wsdl:part name="parameters" element="tns:getMemberResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="getMemberByUsernameAndPasswordSoapIn"&gt;
          &lt;wsdl:part name="parameters" element="tns:getMemberByUsernameAndPassword"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="getMemberByUsernameAndPasswordSoapOut"&gt;
          &lt;wsdl:part name="parameters" element="tns:getMemberByUsernameAndPasswordResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="insertMemberSoapIn"&gt;
          &lt;wsdl:part name="parameters" element="tns:insertMember"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="insertMemberSoapOut"&gt;
          &lt;wsdl:part name="parameters" element="tns:insertMemberResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="decodeIDSoapIn"&gt;
          &lt;wsdl:part name="parameters" element="tns:decodeID"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="decodeIDSoapOut"&gt;
          &lt;wsdl:part name="parameters" element="tns:decodeIDResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="encodeIDSoapIn"&gt;
          &lt;wsdl:part name="parameters" element="tns:encodeID"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="encodeIDSoapOut"&gt;
          &lt;wsdl:part name="parameters" element="tns:encodeIDResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="processPnrInfoSoapIn"&gt;
          &lt;wsdl:part name="parameters" element="tns:processPnrInfo"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="processPnrInfoSoapOut"&gt;
          &lt;wsdl:part name="parameters" element="tns:processPnrInfoResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="CancelPNRSoapIn"&gt;
          &lt;wsdl:part name="parameters" element="tns:CancelPNR"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:message name="CancelPNRSoapOut"&gt;
          &lt;wsdl:part name="parameters" element="tns:CancelPNRResponse"/&gt;
      &lt;/wsdl:message&gt;
      &lt;wsdl:portType name="ServiceSoap"&gt;
          &lt;wsdl:operation name="getMember"&gt;
              &lt;wsdl:input message="tns:getMemberSoapIn"/&gt;
              &lt;wsdl:output message="tns:getMemberSoapOut"/&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="getMemberByUsernameAndPassword"&gt;
              &lt;wsdl:input message="tns:getMemberByUsernameAndPasswordSoapIn"/&gt;
              &lt;wsdl:output message="tns:getMemberByUsernameAndPasswordSoapOut"/&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="insertMember"&gt;
              &lt;wsdl:input message="tns:insertMemberSoapIn"/&gt;
              &lt;wsdl:output message="tns:insertMemberSoapOut"/&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="decodeID"&gt;
              &lt;wsdl:input message="tns:decodeIDSoapIn"/&gt;
              &lt;wsdl:output message="tns:decodeIDSoapOut"/&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="encodeID"&gt;
              &lt;wsdl:input message="tns:encodeIDSoapIn"/&gt;
              &lt;wsdl:output message="tns:encodeIDSoapOut"/&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="processPnrInfo"&gt;
              &lt;wsdl:input message="tns:processPnrInfoSoapIn"/&gt;
              &lt;wsdl:output message="tns:processPnrInfoSoapOut"/&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="CancelPNR"&gt;
              &lt;wsdl:input message="tns:CancelPNRSoapIn"/&gt;
              &lt;wsdl:output message="tns:CancelPNRSoapOut"/&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:portType&gt;
      &lt;wsdl:binding name="ServiceSoap" type="tns:ServiceSoap"&gt;
          &lt;soap:binding transport="http://schemas.xmlsoap.org/soap/http"/&gt;
          &lt;wsdl:operation name="getMember"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/getMember" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="getMemberByUsernameAndPassword"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/getMemberByUsernameAndPassword" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="insertMember"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/insertMember" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="decodeID"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/decodeID" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="encodeID"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/encodeID" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="processPnrInfo"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/processPnrInfo" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="CancelPNR"&gt;
              &lt;soap:operation soapAction="http://tempuri.org/CancelPNR" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap"&gt;
          &lt;soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/&gt;
          &lt;wsdl:operation name="getMember"&gt;
              &lt;soap12:operation soapAction="http://tempuri.org/getMember" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="getMemberByUsernameAndPassword"&gt;
              &lt;soap12:operation soapAction="http://tempuri.org/getMemberByUsernameAndPassword" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="insertMember"&gt;
              &lt;soap12:operation soapAction="http://tempuri.org/insertMember" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="decodeID"&gt;
              &lt;soap12:operation soapAction="http://tempuri.org/decodeID" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="encodeID"&gt;
              &lt;soap12:operation soapAction="http://tempuri.org/encodeID" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="processPnrInfo"&gt;
              &lt;soap12:operation soapAction="http://tempuri.org/processPnrInfo" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
          &lt;wsdl:operation name="CancelPNR"&gt;
              &lt;soap12:operation soapAction="http://tempuri.org/CancelPNR" style="document"/&gt;
              &lt;wsdl:input&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:input&gt;
              &lt;wsdl:output&gt;
                  &lt;soap12:body use="literal"/&gt;
              &lt;/wsdl:output&gt;
          &lt;/wsdl:operation&gt;
      &lt;/wsdl:binding&gt;
      &lt;wsdl:service name="Service"&gt;
          &lt;wsdl:port name="ServiceSoap" binding="tns:ServiceSoap"&gt;
              &lt;soap:address location="[byng_wsdl_target]"/&gt;
          &lt;/wsdl:port&gt;
          &lt;wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12"&gt;
              &lt;soap12:address location="[byng_wsdl_target]"/&gt;
          &lt;/wsdl:port&gt;
      &lt;/wsdl:service&gt;
  &lt;/wsdl:definitions&gt;
  </code></pre>
  
  <p>I would be so grateful for anyone who can help.</p>
  
  <p><strong>ADDITIONAL</strong>  </p>
  
  <pre><code>class User {
      public $GuestUserId;
      public $Username;
      public $FirstName;
      public $SurName;
      public $Email;
      public
      function getMember($uid) {
          $applicant = new Applicant($uid);
          $this-&gt;GuestUserId = $applicant-&gt;getIdentifier();
          $this-&gt;Username = $applicant-&gt;getEmail();
          $this-&gt;FirstName = $applicant-&gt;getFirstName();
          $this-&gt;SurName = $applicant-&gt;getLastName();
          $this-&gt;Email = $applicant-&gt;getEmail();
          return $this;
      }
  }
  </code></pre>