Re: Need help generating a response that matches wsdl

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 6 October 2010 16:42, nick.weavers <nickweavers@yahoo.co.uk> wrote:
>
> Hi Richard, I was using my XAMPP development platform. I have uploaded it and
> the server as it currently stands can be reached here:
> http://www.dealdirectfinancial.co.uk/cms/paaleads/PAALeadServer.php?wsdl
>
> I am studying your suggested framework. This is all fairly new to me so
> thanks for taking the time to help.
>
> Nick.
>
> --
> View this message in context: http://old.nabble.com/Need-help-generating-a-response-that-matches-wsdl-tp29890878p29897994.html
> Sent from the Php - Soap mailing list archive at Nabble.com.
>
>
> --
> PHP Soap Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

Thanks for the live link.

I've just found a problem with wsdl2php because of it.

The ConsumeLeadSoapOut response is message which contains an element
of tns:ConsumeLeadResponse.

This element has a property of a complextype of ConsumeLeadResponse.

wsdl2php cannot differentiate between the 2 types (the tns: prefix is dropped).

<s:element name="ConsumeLeadResponse">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="ConsumeLeadResult"
type="tns:ConsumeLeadResponse"/>
  </s:sequence>
 </s:complexType>
</s:element>
<s:complexType name="ConsumeLeadResponse">
 <s:sequence>
  <s:element minOccurs="1" maxOccurs="1" name="LeadReceived" type="s:boolean"/>
  <s:element minOccurs="0" maxOccurs="1" name="FailureMessage" type="s:string"/>
 </s:sequence>
</s:complexType>

This is causing wsdl2php to only generate 1 class for
ConsumeLeadResponse with only 1 property of ConsumeLeadResponse of
type ConsumeLeadResponse.

EEK.

I'll have to fix this. Differentiate between messages and complex
types. Ideally having separate names would have helpful.

Editing the wsdl file locally certainly helps.

Changing ...

<s:element name="ConsumeLeadResponse">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="ConsumeLeadResult"
type="tns:ConsumeLeadResponse" />
  </s:sequence>
 </s:complexType>
</s:element>

and

<wsdl:message name="ConsumeLeadSoapOut">
 <wsdl:part name="parameters" element="tns:ConsumeLeadResponse" />
</wsdl:message>

to ...

<s:element name="ConsumeLeadResponseMessage">
 <s:complexType>
  <s:sequence>
   <s:element minOccurs="0" maxOccurs="1" name="ConsumeLeadResult"
type="tns:ConsumeLeadResponse" />
  </s:sequence>
 </s:complexType>
</s:element>

and
<wsdl:message name="ConsumeLeadSoapOut">
 <wsdl:part name="parameters" element="tns:ConsumeLeadResponseMessage" />
</wsdl:message>

and the rerunning the wsdl2php conversion to create the new classes ...

<?php
require_once 'LeadConsumerService.php';

try
        {
        $lcs = new LeadConsumerService
                (
                "LocalLeadConsumerService.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->LeadReceived ? 'True':'False'), ' :
', $clResponse->ConsumeLeadResult->FailureMessage, 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;
        }
?>

now works. Or at least I get some output...

ConsumeLead Response : True :


Anyway. Glad you got it working. Thanks for the link (helps me improve
wsdl2php).

Richard.

-- 
Richard Quadling
Twitter : EE : Zend
@RQuadling : e-e.com/M_248814.html : bit.ly/9O8vFY

-- 
PHP Soap Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [PHP Users]     [Kernel Newbies]     [PHP Database]     [Yosemite]

  Powered by Linux