Thread: XML problems

  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2004
    Rep Power

    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);

    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;

    //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
    //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
    node3 := XMLDocument1.DocumentElement.CloneNode(true);

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

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



    //Imported WSDL file
    unit xQuotes;


    uses InvokeRegistry, SOAPHTTPClient, Types, XSBuiltIns;


    // ************************************************************************ //
    // 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 - ""
    // !:double - ""
    // !:int - ""
    // !:dateTime - ""

    Header = class; { ""[H] }
    Common = class; { "" }
    QuickQuote = class; { "" }
    HTMLResult = class; { "" }
    HistoricalQuote = class; { "" }
    Quote = class; { "" }
    StockQuote = class; { "" }
    StockStatistics = class; { "" }
    StockNews = class; { "" }
    ExtendedQuote = class; { "" }
    FundQuote = class; { "" }
    ExtendedFundQuote = class; { "" }
    Index = class; { "" }
    Indicator = class; { "" }
    MarketSummary = class; { "" }
    Top = class; { "" }
    MarketIndex = class; { "" }

    { "" }
    OutcomeTypes = (Success, SystemError, RequestError, RegistrationError);

    Quote = class(Common)
    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;
    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;

    ArrayOfQuote = array of Quote; { "" }


    Any help would be much appreciated !!!
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2004
    Rep Power


    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 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.

IMN logo majestic logo threadwatch logo seochat tools logo