1#!perl -w
2#!d:\perl\bin\perl.exe
3
4# -- SOAP::Lite -- soaplite.com -- Copyright (C) 2001 Paul Kulchenko --
5
6# example that shows how to handle types specified in other schemas
7
8package EncodedTypes;
9
10sub as_TickDirection { $_[1] }
11sub as_Exchanges { $_[1] }
12
13package main;
14
15use SOAP::Lite;
16
17$d = SOAP::Deserializer->new;
18$d->xmlschemas->{'http://marketdata.earthconnect.net/encodedTypes'} = 'EncodedTypes';
19
20$r = $d->deserialize(q!<?xml version="1.0" encoding="utf-8"?>
21<soap:Envelope
22xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
23xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
24xmlns:tns="http://marketdata.earthconnect.net/"
25xmlns:types="http://marketdata.earthconnect.net/encodedTypes"
26xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
27xmlns:xsd="http://www.w3.org/2001/XMLSchema">
28
29<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
30<tns:GetProfessionalQuoteResponse>
31  <GetProfessionalQuoteResult href="#id1" />
32</tns:GetProfessionalQuoteResponse>
33
34<soapenc:Array id="id1" soapenc:arrayType="types:ProfessionalQuote[1]">
35  <Item href="#id2" />
36</soapenc:Array>
37
38<types:ProfessionalQuote id="id2" xsi:type="types:ProfessionalQuote">
39  <CompanyName xsi:type="xsd:string">EarthConnect Corporation</CompanyName>
40  <LastPrice xsi:type="xsd:decimal">66.7</LastPrice>
41  <LastPriceTime xsi:type="xsd:dateTime">2001-07-17T14:19:45.3310450-07:00</LastPriceTime>
42  <Change xsi:type="xsd:decimal">0.34</Change>
43  <Volume xsi:type="xsd:long">23456778</Volume>
44  <Tick xsi:type="types:TickDirection">Down</Tick>
45  <Bid xsi:type="xsd:decimal">88.21</Bid>
46  <Ask xsi:type="xsd:decimal">88.22</Ask>
47  <BidSize xsi:type="xsd:int">300</BidSize>
48  <AskSize xsi:type="xsd:int">5800</AskSize>
49  <DayLow xsi:type="xsd:decimal">64.8987</DayLow>
50  <DayHigh xsi:type="xsd:decimal">68.4356</DayHigh>
51  <Open xsi:type="xsd:decimal">87.43</Open>
52  <PreviousClose xsi:type="xsd:decimal">86.34</PreviousClose>
53  <LastTradeVolume xsi:type="xsd:int">640</LastTradeVolume>
54  <Exchange xsi:type="types:Exchanges"> one of NASDAQ or NYSE or AMEX or INDEX</Exchange>
55  <Valid href="#id3" />
56</types:ProfessionalQuote>
57
58<types:ProfessionalQuoteValues id="id3" xsi:type="types:ProfessionalQuoteValues">
59  <CompanyName xsi:type="xsd:boolean">false</CompanyName>
60  <LastPrice xsi:type="xsd:boolean">false</LastPrice>
61  <LastPriceTime xsi:type="xsd:boolean">false</LastPriceTime>
62  <Change xsi:type="xsd:boolean">false</Change>
63  <Volume xsi:type="xsd:boolean">false</Volume>
64  <Tick xsi:type="xsd:boolean">false</Tick>
65  <Bid xsi:type="xsd:boolean">false</Bid>
66  <Ask xsi:type="xsd:boolean">false</Ask>
67  <BidSize xsi:type="xsd:boolean">false</BidSize>
68  <AskSize xsi:type="xsd:boolean">false</AskSize>
69  <DayLow xsi:type="xsd:boolean">false</DayLow>
70  <DayHigh xsi:type="xsd:boolean">false</DayHigh>
71  <Open xsi:type="xsd:boolean">false</Open>
72  <PreviousClose xsi:type="xsd:boolean">false</PreviousClose>
73  <LastTradeVolume xsi:type="xsd:boolean">false</LastTradeVolume>
74</types:ProfessionalQuoteValues>
75</soap:Body>
76
77</soap:Envelope>!)->result;
78
79print "Tick (types:TickDirection): ", $r->[0]->{Tick}, "\n";
80print "Exchange (types:Exchanges): ", $r->[0]->{Exchange}, "\n";
81