Re: Re: SOAP - return a list of items

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

 



On Sun, Aug 17, 2008 at 8:32 AM, Luke <tinmachin3@xxxxxxxxxxxxxx> wrote:

> why use soap for this? I just use a javascript array for this kind of
> thing...
>
> 2008/8/13 Dan Joseph <dmjoseph@xxxxxxxxx>
>
> Maybe more info will help:
>>
>> Here is what I have so far for the WSDL...
>>
>>    <xsd:complexType name="getQuoteHistory">
>>        <xsd:all>
>>            <xsd:element name="id" type="xsd:string"/>
>>            <xsd:element name="key" type="xsd:string"/>
>>            <xsd:element name="username" type="xsd:string"/>
>>            <xsd:element name="password" type="xsd:string"/>
>>        </xsd:all>
>>    </xsd:complexType>
>>
>>    <xsd:complexType name="getQuoteHistoryResponse">
>>        <xsd:sequence>
>>            <xsd:element minOccurs="0" maxOccurs="1" name="getQuoteResult"
>> type="tns:ArrayOfgetQuoteHistoryResult" />
>>        </xsd:sequence>
>>    </xsd:complexType>
>>
>>    <xsd:complexType name="ArrayOfgetQuoteHistoryResult">
>>        <xsd:sequence>
>>            <xsd:element minOccurs="0" maxOccurs="unbounded"
>> name="getQuoteHistoryResult" nillable="true"
>> type="tns:getQuoteHistoryResult" />
>>        </xsd:sequence>
>>    </xsd:complexType>
>>
>>    <xsd:complexType name="getQuoteHistoryResult">
>>        <xsd:sequence>
>>            <xsd:element name="success" type="xsd:boolean"/>
>>            <xsd:element name="message" type="xsd:string"/>
>>            <xsd:element name="quoteid" type="xsd:string"/>
>>            <xsd:element name="dateentered" type="xsd:string"/>
>>            <xsd:element name="expirationdate" type="xsd:string"/>
>>            <xsd:element name="origin" type="xsd:string"/>
>>            <xsd:element name="destination" type="xsd:string"/>
>>            <xsd:element name="vehicle_type" type="xsd:string"/>
>>            <xsd:element name="price" type="xsd:string"/>
>>        </xsd:sequence>
>>    </xsd:complexType>
>>
>> This validates fine in soapUI, and seems to work fine when the client
>> connects to it.
>>
>> The piece from PHP:
>>
>>            $count = 0;
>>
>>            while ( $data = $this->dbconn->fetchrow( $res ) )
>>            {
>>                foreach ( $data as $key => $value )
>>                {
>>                    $quotes[$count][$key] = $value;
>>                }
>>
>>                $count++;
>>            }
>>
>> return $quotes;
>>
>> This is the soap response:
>>
>> <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="
>> http://schemas.xmlsoap.org/soap/encoding/"; xmlns:SOAP-ENV="
>> http://schemas.xmlsoap.org/soap/envelope/";
>> xmlns:ns1="urn:ursquoteservice"
>> xmlns:ns2="urn:ursquote" xmlns:xsd="http://www.w3.org/2001/XMLSchema";
>> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; xmlns:SOAP-ENC="
>> http://schemas.xmlsoap.org/soap/encoding/";>
>>   <SOAP-ENV:Body>
>>      <ns1:getQuoteHistoryResponse>
>>         <getquotehistoryresponse xsi:type="ns2:getQuoteHistoryResponse"/>
>>      </ns1:getQuoteHistoryResponse>
>>   </SOAP-ENV:Body>
>> </SOAP-ENV:Envelope>
>>
>> It seems like I am just missing something somewhere.
>>
>> Anyone able to help?
>>
>> --
>> -Dan Joseph
>>
>> www.canishosting.com - Plans start @ $1.99/month.
>>
>> "Build a man a fire, and he will be warm for the rest of the day.
>> Light a man on fire, and will be warm for the rest of his life."
>>
>
>
>
> --
> Luke Slater
>

I'm using SOAP because its a web service, in this situation, JavaScript
wouldn't be an option.

I did figure this all out.  The problem was in my WSDL.  I had to add [] to
the end of my responses that return an array list.  Example:

    <message name="getQuoteHistoryResponse">
        <part name="getquotehistoryresponse"
type="tns:getQuoteHistoryResponse[]" />
    </message>

-- 
-Dan Joseph

www.canishosting.com - Plans start @ $1.99/month.

"Build a man a fire, and he will be warm for the rest of the day.
Light a man on fire, and will be warm for the rest of his life."

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux