Re: [SOAP] Need help generating a response that matches wsdl
| From: | Richard Quadling | Date: | Wed, 06 Oct 2010 13:52:22 +0000 |
| Subject: | Re: [SOAP] Need help generating a response that matches wsdl | ||
| References: | 1 2 3 4 | Groups: | php.soap |
| Request: | Send a blank email to php-soap+get-3116@lists.php.net to get a copy of this message | ||
On 6 October 2010 13:58, nick.weavers <nickweavers@yahoo.co.uk> wrote:
>
> Hi Richard,
>
> I would not build a WSDL from scratch by hand either. The one I am using
> would have been generated automatically by the company whose services I am
> consuming, and so of course I must conform to it, hence the request for help
> on getting my response to work with it.
>
> Thanks for the info on wsdl2php. I didn't think to look for something that
> could do that!
>
> Nick.
Using the previous classes, I'd do something like this ...
<?php
require_once 'LeadConsumerServiceClasses.php';
try
{
$lcs = new LeadConsumerService
(
"LeadConsumerService.wsdl",
$options = array
(
'encoding' => 'ISO-8859-1',
'exception' => True,
'trace' => True,
)
);
$cl = new ConsumeLead;
$cl->request = new ConsumeLeadRequest;
$cl->request->LeadType = LeadType::Mortgage;
$clResponse = $lcs->ConsumeLead($cl);
echo 'ConsumeLead Response : ', $clResponse->ConsumeLeadResult, PHP_EOL;
}
catch(Exception $e)
{
echo 'Request Headers', PHP_EOL, '---------------', PHP_EOL,
$lcs->__getLastRequestHeaders(), PHP_EOL;
echo 'Request', PHP_EOL, '-------', PHP_EOL,
$lcs->__getLastRequest(), PHP_EOL;
echo 'Response Headers', PHP_EOL, '----------------', PHP_EOL,
$lcs->__getLastResponseHeaders(), PHP_EOL;
echo 'Response', PHP_EOL, '--------', PHP_EOL,
$lcs->__getLastResponse(), PHP_EOL, PHP_EOL;
echo 'Exception', PHP_EOL, '---------', PHP_EOL,
$e->getMessage(), PHP_EOL;
}
?>
This is currently reporting an error ...
Request Headers
---------------
Request
-------
<?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:ConsumeLead><ns1:request><ns1:LeadType>Mortgage</ns1:LeadType></ns1:request></ns1:ConsumeLead></SOAP-ENV:Body></SOAP-ENV:Envelope>
Response Headers
----------------
Response
--------
Exception
---------
Could not connect to host
So, currently, I can't test the code, but this structure is working
for me and others who I've helped here and on E-E.com
Richard.
--
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY