Delphi Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreDelphi Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old June 4th, 2004, 07:36 AM
Blob Blob is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 12 Blob User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thumbs up XML problems

I am building a CGI program in Delphi that connects to a financial service to retrieve some stock data using SOAP and WSDL binding. Hence in my I want my CGI program to reference an imported WSDL file called xQuotes.

I am getting back an Array of Quote from the website which I have assigned to stockArray of the same datatype. But when I try to process the request to generate a XML document I get an error message reading the following:

[Error] GlobalStockService.pas(83): There is no overloaded version of 'LoadFromXML' that can be called with these arguments

The code is provided below:

//My CGI program
procedure TWebModule1.WebModule1WebActionItem1Action(Sender: TObject;
Request: TWebRequest; Response: TWebResponse; var Handled: Boolean);

var
i: integer;
//declare stock data
//DOMString : wideString;
Name, Symbol, Date, Time, result :wideString;
Last, Open, High_, Low_ :double;
//declare Array of Qutotes
stockArray: ArrayOfQuote;
//Declare a list of XML elements
nodeList: IXMLNodeList;
//Get individual XML elements
node1, node2, node3, node4 : IXMLNode;
found :boolean;
auth: Header;

begin
//code goes here
found := false;
i := 0;
name := 'MSFT'; //change MSFT to something more dynamic
symbol := 'AUD'; //change AUD to soemthing more dynamic

//load from XML schema, should maybe be XMLDocument3 instead of XMLDocument1
//create tree level structure
XMLDocument1.LoadFromXML('<?xml version="1.0"?>' +#10+'<stock>' +#10+'</stock>');

//call getQuotes webservice from xignite.com
//Change MSFT to something more dynamic
stockArray := (HTTPRIO1 as XigniteQuotesSOAP).getQuotes('MSFT');

//read contents from arrayOfQuote into stockArray
Name := stockArray[0].Name;
Symbol := stockArray[1].Symbol;
Date := stockArray[2].Date;
Time := stockArray[3].Time;
Last := stockArray[4].Last;
Open := stockArray[5].Open;
High_ := stockArray[6].High_;
Low_ := stockArray[7].Low_;

//check that the stockArray contains data
if not (stockArray[0].Name = 'Data not found') then
begin
XMLDocument1.LoadFromXML(stockArray);
node3 := XMLDocument1.DocumentElement.CloneNode(true);
//XMLDocument3.DocumentElement.ChildNodes.Add(node3);
end;

//include code from lines 24-45 from airport code example

//From Line 46-49
XMLDocument2.SaveToXML(result);
response.ContentType := 'text/xml';
response.Content := FormatXMLData(result);

end;

end.


//Imported WSDL file
unit xQuotes;

interface

uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;

type

// ************************************************************************ //
// The following types, referred to in the WSDL document are not being represented
// in this file. They are either aliases[@] of other types represented or were referred
// to but never[!] declared in the document. The types from the latter category
// typically map to predefined/known XML or Borland types; however, they could also
// indicate incorrect WSDL documents that failed to declare or import a schema type.
// ************************************************************************ //
// !:string - "http://www.w3.org/2001/XMLSchema"
// !:double - "http://www.w3.org/2001/XMLSchema"
// !:int - "http://www.w3.org/2001/XMLSchema"
// !:dateTime - "http://www.w3.org/2001/XMLSchema"

Header = class; { "http://www.xignite.com/services/"[H] }
Common = class; { "http://www.xignite.com/services/" }
QuickQuote = class; { "http://www.xignite.com/services/" }
HTMLResult = class; { "http://www.xignite.com/services/" }
HistoricalQuote = class; { "http://www.xignite.com/services/" }
Quote = class; { "http://www.xignite.com/services/" }
StockQuote = class; { "http://www.xignite.com/services/" }
StockStatistics = class; { "http://www.xignite.com/services/" }
StockNews = class; { "http://www.xignite.com/services/" }
ExtendedQuote = class; { "http://www.xignite.com/services/" }
FundQuote = class; { "http://www.xignite.com/services/" }
ExtendedFundQuote = class; { "http://www.xignite.com/services/" }
Index = class; { "http://www.xignite.com/services/" }
Indicator = class; { "http://www.xignite.com/services/" }
MarketSummary = class; { "http://www.xignite.com/services/" }
Top = class; { "http://www.xignite.com/services/" }
MarketIndex = class; { "http://www.xignite.com/services/" }

{ "http://www.xignite.com/services/" }
OutcomeTypes = (Success, SystemError, RequestError, RegistrationError);



Quote = class(Common)
private
FSymbol: WideString;
FName: WideString;
FDate: WideString;
FTime: WideString;
FOpen: Double;
FHigh_: Double;
FLow_: Double;
FLast: Double;
FVolume: Double;
FChange: Double;
FPercentChange: Double;
FPrevious_Close: WideString;
FBid: WideString;
FBid_Size: WideString;
FAsk: WideString;
FAsk_Size: WideString;
FHigh_52_Weeks: WideString;
FLow_52_Weeks: WideString;
published
property Symbol: WideString read FSymbol write FSymbol;
property Name: WideString read FName write FName;
property Date: WideString read FDate write FDate;
property Time: WideString read FTime write FTime;
property Open: Double read FOpen write FOpen;
property High_: Double read FHigh_ write FHigh_;
property Low_: Double read FLow_ write FLow_;
property Last: Double read FLast write FLast;
property Volume: Double read FVolume write FVolume;
property Change: Double read FChange write FChange;
property PercentChange: Double read FPercentChange write FPercentChange;
property Previous_Close: WideString read FPrevious_Close write FPrevious_Close;
property Bid: WideString read FBid write FBid;
property Bid_Size: WideString read FBid_Size write FBid_Size;
property Ask: WideString read FAsk write FAsk;
property Ask_Size: WideString read FAsk_Size write FAsk_Size;
property High_52_Weeks: WideString read FHigh_52_Weeks write FHigh_52_Weeks;
property Low_52_Weeks: WideString read FLow_52_Weeks write FLow_52_Weeks;
end;

ArrayOfQuote = array of Quote; { "http://www.xignite.com/services/" }

end.

Any help would be much appreciated !!!

Reply With Quote
  #2  
Old June 6th, 2004, 01:38 AM
talonsmail talonsmail is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jun 2004
Posts: 3 talonsmail User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Xquotes

Maybe I can help a fellow student (curtin assignment no. 2 for development 300 right!) haha

the error you are gettin is coz your are trying to use the loadfromxml method. This method does not accept "arrayofquote" as a parameter. The deal is, you have to separate the arrayofquote into strings, then add the strings to the XMLDocument using nodes etc. to create the final xml document output. Sorta like this:

quotename:= stockquote[0].Name;
quotename:=stockquote[0].Symbol;

quotename is a widestring, and stockquote is the arrayofquote variable. this will take out the name, and symbols from the arrayofquote and put them into widestring format. then you gotta add them using nodes ( sorta modify the domloadcsv program we got earlier this semester). I could give u more, but y'know its an assignment man. Good Luck.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreDelphi Programming > XML problems

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap