Re: [SOAP] Need help generating a response that matches wsdl
| From: | Richard Quadling | Date: | Wed, 06 Oct 2010 10:02:15 +0000 |
| Subject: | Re: [SOAP] Need help generating a response that matches wsdl | ||
| References: | 1 2 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-3113@lists.php.net to get a copy of this message | ||
On 6 October 2010 09:14, nick.weavers <nickweavers@yahoo.co.uk> wrote:
>
> It appears that the response array should not contain the top output wsdl
> message element, but start with the first child element.... changing my
> server to the following solved my problem:
>
> [quote]
> function ConsumeLead($data)
>
> $response =
> array('ConsumeLeadResult' =>
> array(
> 'LeadReceived' => 'true'
> )
> );
>
> return $response;
> }
> [/quote]
> The response is now working:
> [quote]
> Response: <?xml version="1.0" encoding="UTF-8"?>
> <SOAP-ENV:Envelope
>
> xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
>
> xmlns:ns1="http://www.paaleads.com/LeadConsumerService/"><SOAP-ENV:Body><ns1:ConsumeLeadResponse><ns1:ConsumeLeadResult><ns1:LeadReceived>true</ns1:LeadReceived></ns1:ConsumeLeadResult></ns1:ConsumeLeadResponse></SOAP-ENV:Body></SOAP-ENV:Envelope>
> [/quote]
> That only took me 4 hours to solve using the Monte Carlo problem solving
> technique %-|
I must admit, I've never had to build a server to match a wsdl file,
only a client (and then I use wsdl2php from sourceforge with the
mods/patches by RazorsEdgeUK).
But building a server. Well, the classes built by wsdl2php (ignoring
the client class) would act as the basis for this.
class ConsumeLead {
public $request; // ConsumeLeadRequest
}
class ConsumeLeadRequest {
public $LeadType; // LeadType
public $LeadXml; // string
public $AuthenticationUsername; // string
public $AuthenticationPassword; // string
}
class LeadType {
const Unknown = 'Unknown';
const Mortgage = 'Mortgage';
const TermAssurance = 'TermAssurance';
const Travel = 'Travel';
const PMI = 'PMI';
const SecuredLoan = 'SecuredLoan';
const CreditHelp = 'CreditHelp';
const Stakeholder = 'Stakeholder';
const TermPostal = 'TermPostal';
const Pension = 'Pension';
const Savings = 'Savings';
const Investments = 'Investments';
const UnsecuredLoan = 'UnsecuredLoan';
const OverseasMortgage = 'OverseasMortgage';
const Debt = 'Debt';
const ASU = 'ASU';
const LegalServices = 'LegalServices';
}
class ConsumeLeadResponse {
public $ConsumeLeadResult; // ConsumeLeadResponse
}
From there it is a case of building the appropriate framework.
My server classes deal with supplying the wsdl file and the end-user
docuementation (http://site.com/service, http://site.com/service?wsdl,
http://site.com/service?help or doc or documentation or
man or manual,
etc.).
But I never build XML files by hand for anything more than the most
simplest of files.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY