Re: Re: SOAP - return a list of items

From: Date: Mon, 18 Aug 2008 13:49:39 +0000
Subject: Re: Re: SOAP - return a list of items
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-278275@lists.php.net to get a copy of this message
On Sun, Aug 17, 2008 at 8:32 AM, Luke <tinmachin3@googlemail.com> wrote: > why use soap for this? I just use a javascript array for this kind of > thing... > > 2008/8/13 Dan Joseph <dmjoseph@gmail.com> > > 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."

« previous php.general (#278275) next »