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.
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?
The receiver of the service is expecting a "User" object to be returned when the getMember method is invoked.
Here is the WSDL
<?xml version="1.0" encoding="UTF-8"?>
<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/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">
<s:element name="getMember">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="memCode" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getMemberResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="getMemberResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getMemberByUsernameAndPassword">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="username" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="getMemberByUsernameAndPasswordResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="getMemberByUsernameAndPasswordResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="insertMember">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="insertStr" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="insertMemberResponse">
<s:complexType/>
</s:element>
<s:element name="decodeID">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="memCode" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="decodeIDResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="decodeIDResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="encodeID">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="memCode" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="password" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="encodeIDResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="encodeIDResult" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="processPnrInfo">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="pnrXml" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="UserXml" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="extraCosts" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="processPnrInfoResponse">
<s:complexType/>
</s:element>
<s:element name="CancelPNR">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="paxSurname" type="s:string"/>
<s:element minOccurs="0" maxOccurs="1" name="pnrNo" type="s:string"/>
</s:sequence>
</s:complexType>
</s:element>
<s:element name="CancelPNRResponse">
<s:complexType/>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="getMemberSoapIn">
<wsdl:part name="parameters" element="tns:getMember"/>
</wsdl:message>
<wsdl:message name="getMemberSoapOut">
<wsdl:part name="parameters" element="tns:getMemberResponse"/>
</wsdl:message>
<wsdl:message name="getMemberByUsernameAndPasswordSoapIn">
<wsdl:part name="parameters" element="tns:getMemberByUsernameAndPassword"/>
</wsdl:message>
<wsdl:message name="getMemberByUsernameAndPasswordSoapOut">
<wsdl:part name="parameters" element="tns:getMemberByUsernameAndPasswordResponse"/>
</wsdl:message>
<wsdl:message name="insertMemberSoapIn">
<wsdl:part name="parameters" element="tns:insertMember"/>
</wsdl:message>
<wsdl:message name="insertMemberSoapOut">
<wsdl:part name="parameters" element="tns:insertMemberResponse"/>
</wsdl:message>
<wsdl:message name="decodeIDSoapIn">
<wsdl:part name="parameters" element="tns:decodeID"/>
</wsdl:message>
<wsdl:message name="decodeIDSoapOut">
<wsdl:part name="parameters" element="tns:decodeIDResponse"/>
</wsdl:message>
<wsdl:message name="encodeIDSoapIn">
<wsdl:part name="parameters" element="tns:encodeID"/>
</wsdl:message>
<wsdl:message name="encodeIDSoapOut">
<wsdl:part name="parameters" element="tns:encodeIDResponse"/>
</wsdl:message>
<wsdl:message name="processPnrInfoSoapIn">
<wsdl:part name="parameters" element="tns:processPnrInfo"/>
</wsdl:message>
<wsdl:message name="processPnrInfoSoapOut">
<wsdl:part name="parameters" element="tns:processPnrInfoResponse"/>
</wsdl:message>
<wsdl:message name="CancelPNRSoapIn">
<wsdl:part name="parameters" element="tns:CancelPNR"/>
</wsdl:message>
<wsdl:message name="CancelPNRSoapOut">
<wsdl:part name="parameters" element="tns:CancelPNRResponse"/>
</wsdl:message>
<wsdl:portType name="ServiceSoap">
<wsdl:operation name="getMember">
<wsdl:input message="tns:getMemberSoapIn"/>
<wsdl:output message="tns:getMemberSoapOut"/>
</wsdl:operation>
<wsdl:operation name="getMemberByUsernameAndPassword">
<wsdl:input message="tns:getMemberByUsernameAndPasswordSoapIn"/>
<wsdl:output message="tns:getMemberByUsernameAndPasswordSoapOut"/>
</wsdl:operation>
<wsdl:operation name="insertMember">
<wsdl:input message="tns:insertMemberSoapIn"/>
<wsdl:output message="tns:insertMemberSoapOut"/>
</wsdl:operation>
<wsdl:operation name="decodeID">
<wsdl:input message="tns:decodeIDSoapIn"/>
<wsdl:output message="tns:decodeIDSoapOut"/>
</wsdl:operation>
<wsdl:operation name="encodeID">
<wsdl:input message="tns:encodeIDSoapIn"/>
<wsdl:output message="tns:encodeIDSoapOut"/>
</wsdl:operation>
<wsdl:operation name="processPnrInfo">
<wsdl:input message="tns:processPnrInfoSoapIn"/>
<wsdl:output message="tns:processPnrInfoSoapOut"/>
</wsdl:operation>
<wsdl:operation name="CancelPNR">
<wsdl:input message="tns:CancelPNRSoapIn"/>
<wsdl:output message="tns:CancelPNRSoapOut"/>
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getMember">
<soap:operation soapAction="http://tempuri.org/getMember" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getMemberByUsernameAndPassword">
<soap:operation soapAction="http://tempuri.org/getMemberByUsernameAndPassword" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="insertMember">
<soap:operation soapAction="http://tempuri.org/insertMember" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="decodeID">
<soap:operation soapAction="http://tempuri.org/decodeID" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="encodeID">
<soap:operation soapAction="http://tempuri.org/encodeID" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="processPnrInfo">
<soap:operation soapAction="http://tempuri.org/processPnrInfo" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CancelPNR">
<soap:operation soapAction="http://tempuri.org/CancelPNR" style="document"/>
<wsdl:input>
<soap:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:binding name="ServiceSoap12" type="tns:ServiceSoap">
<soap12:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<wsdl:operation name="getMember">
<soap12:operation soapAction="http://tempuri.org/getMember" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="getMemberByUsernameAndPassword">
<soap12:operation soapAction="http://tempuri.org/getMemberByUsernameAndPassword" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="insertMember">
<soap12:operation soapAction="http://tempuri.org/insertMember" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="decodeID">
<soap12:operation soapAction="http://tempuri.org/decodeID" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="encodeID">
<soap12:operation soapAction="http://tempuri.org/encodeID" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="processPnrInfo">
<soap12:operation soapAction="http://tempuri.org/processPnrInfo" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="CancelPNR">
<soap12:operation soapAction="http://tempuri.org/CancelPNR" style="document"/>
<wsdl:input>
<soap12:body use="literal"/>
</wsdl:input>
<wsdl:output>
<soap12:body use="literal"/>
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service">
<wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">
<soap:address location="[byng_wsdl_target]"/>
</wsdl:port>
<wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">
<soap12:address location="[byng_wsdl_target]"/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>
I would be so grateful for anyone who can help.
ADDITIONAL
class User {
public $GuestUserId;
public $Username;
public $FirstName;
public $SurName;
public $Email;
public
function getMember($uid) {
$applicant = new Applicant($uid);
$this->GuestUserId = $applicant->getIdentifier();
$this->Username = $applicant->getEmail();
$this->FirstName = $applicant->getFirstName();
$this->SurName = $applicant->getLastName();
$this->Email = $applicant->getEmail();
return $this;
}
}
At a basic level, you should be able to do the SOAP call with something like this (untested/pseudocode):
$client = new SoapClient("http://somesite/service.wsdl");
$result = $client->getMember();
var_dump($result);