Adapting to Web Services
By Efrem Litwin
An ever-growing number of companies is adopting Web services as a methodology for sharing information between applications. One of the primary advantages of the Web services architecture is that it allows programs written in different languages on different platforms to communicate with each other
over the Web. A Web Services Description Language (WSDL) file is the standard format for describing a Web service. Expressed in XML, a WSDL definition describes how to access a Web service and what operations it will perform.
Let’s consider the following example: A company might have an application written in Java™ which performs certain complex Business Logic calculations on the data it is accessing. Other applications within the enterprise might have the need to leverage the work already done within that application. Applications
written in non-Java development environments, such as .NET, would have difficulty in reusing the Business Logic. If a Web service were created around the Java application, these other applications would be able to then access the calculations. Certain application servers, such as WebLogic, have utilities that can
turn Java objects into Web services.
With the release of WebFOCUS 5.3, the WebFOCUS Web services Adapter has been added to our adapter suite. This will let WebFOCUS treat access to a Web service as if it were a relational data source. In order for WebFOCUS to read any data source, a connection string, Master File, and access file are required. The
connection string to the database is usually configured in the Web console for the server, and the master and access files usually are created through "create synonym."
To configure access to a Web service, there are similar steps. The WSDL file for the Web service holds all the metadata needed for creating the connection string and master and access files.
To illustrate the process of creating all the appropriate metadata needed by WebFOCUS, a public Web service that retrieves stock quote information will be used as an example. Within the procedures category of data adapters within the Web console, there is now an adapter called Web services. Click it to enter a name
for the connection and the location of the WSDL file.
The stock quote Web service WSDL location is as follows:
http://www.xignite.com/xquotes.asmx?WSDL
The WSDL file contains the information needed to connect to the Web service (see Figure 1).
- <service name="XigniteQuotes">
<documentation>This Web service
provides multiple quote-related operations including
several quote formats (simple, extended), market summary
information, index information, and top market movers,
losers, and gainers.</documentation>
- <port name="XigniteQuotesSoap"
binding="s0:XigniteQuotesSoap">
<soap:address location=
"http://www.xignite.com/xquotes.asmx" />
</port>
- <port name="XigniteQuotesHttpGet"
binding="s0:XigniteQuotesHttpGet">
<http:address location=
"http://www.xignite.com/xquotes.asmx" />
</port>
- <port name="XigniteQuotesHttpPost"
binding="s0:XigniteQuotesHttpPost">
<http:address location=
"http://www.xignite.com/xquotes.asmx" />
</port>
</service>
|
Figure 1
Once the WSDL file location is entered in Web console, the connection information from the WSDL file is displayed:
http://www.xignite.com/xquotes.asmx
When the Configure button is pressed the connection information as well as the location to the WSDL file is written to EDASPROF as one line:
ENGINE SOAP SET CONNECTION_ATTRIBUTES
StockQuote/,:'http://www.xignite.com/
xquotes.asmx
http://www.xignite.com/xquotes.asmx?WSDL'
A Web service can contain many operations. Each operation would have the input parameters for calling it and the output definition described in the WSDL file.
The GetQuotes operation contains definitions within the WSDL File (see Figure 2).
- <s:element name="GetQuotes">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="Symbol" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
- <s:element name="GetQuotesResponse">
- <s:complexType>
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="GetQuotesResult" type="s0:ArrayOfQuote" />
</s:sequence>
</s:complexType>
</s:element>
- <s:complexType name="ArrayOfQuote">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="unbounded"
name="Quote" nillable="true" type="s0:Quote" />
</s:sequence>
</s:complexType>
- <s:complexType name="Quote">
- <s:complexContent mixed="false">
- <s:extension base="s0:Common">
- <s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="Symbol" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="Name" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="Date" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="Time" type="s:string" />
<s:element minOccurs="1" maxOccurs="1"
name="Open" type="s:double" />
<s:element minOccurs="1" maxOccurs="1"
name="High" type="s:double" />
<s:element minOccurs="1" maxOccurs="1"
name="Low" type="s:double" />
<s:element minOccurs="1" maxOccurs="1"
name="Last" type="s:double" />
<s:element minOccurs="1" maxOccurs="1"
name="Volume" type="s:double" />
<s:element minOccurs="1" maxOccurs="1"
name="Change" type="s:double" />
<s:element minOccurs="1" maxOccurs="1"
name="PercentChange" type="s:double" />
<s:element minOccurs="0" maxOccurs="1"
name="Previous_Close" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="Bid" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="Bid_Size" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="Ask" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="Ask_Size" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="High_52_Weeks" type="s:string" />
<s:element minOccurs="0" maxOccurs="1"
name="Low_52_Weeks" type="s:string" />
</s:sequence>
</s:extension>
</s:complexContent>
|
Figure 2
Note that this Web service operation has one input parameter called Symbol and an array of information to describe the output.
In order for WebFOCUS to call a Web service, the metadata in the WSDL file has to be translated to a master and an access file. This is done through Create Synonym. By clicking on the Connection Name and selecting Create Synonym, a list of
operations contained in the Web service will be displayed. Select the operation(s) in which master and access files are to be created.
The Master for the GetQuotes operation will appear as shown in Figure 3.
FILENAME=M6ILO, SUFFIX=SOAP , $
SEGMENT=ROOT, SEGTYPE=S0, $
GROUP=GETQUOTES, ALIAS=GetQuotes, USAGE=A30, ACTUAL=A30, $
FIELDNAME=SYMBOL, ALIAS=Symbol, USAGE=A30, ACTUAL=A30, $
FIELDNAME=__RESPONSE, USAGE=TX80, ACTUAL=TX, $
SEGMENT=RESPONSE, SEGTYPE=S0, SEGSUF=XML ,
PARENT=ROOT, POSITION=__RESPONSE, $
FIELDNAME=RESPONSE, ALIAS=GetQuotesResponse,
USAGE=A1, ACTUAL=A1, $
SEGMENT=GETQUOTESRESULT, SEGTYPE=S0, PARENT=RESPONSE, $
FIELDNAME=GETQUOTESRESULT, ALIAS=GetQuotesResult,
USAGE=A1, ACTUAL=A1,
REFERENCE=RESPONSE, PROPERTY=ELEMENT, $
SEGMENT=QUOTE, SEGTYPE=S0, PARENT=GETQUOTESRESULT, $
FIELDNAME=QUOTE, ALIAS=Quote, USAGE=A1, ACTUAL=A1,
REFERENCE=GETQUOTESRESULT, PROPERTY=ELEMENT, $
FIELDNAME=SYMBOL, ALIAS=Symbol, USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=NAME, ALIAS=Name, USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=DATE1, ALIAS=Date, USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=TIME1, ALIAS=Time, USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=OPEN1, ALIAS=Open, USAGE=D20.2, ACTUAL=A20,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=HIGH, ALIAS=High, USAGE=D20.2, ACTUAL=A20,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=LOW, ALIAS=Low, USAGE=D20.2, ACTUAL=A20,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=LAST, ALIAS=Last, USAGE=D20.2, ACTUAL=A20,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=VOLUME, ALIAS=Volume, USAGE=D20.2, ACTUAL=A20,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=CHANGE, ALIAS=Change, USAGE=D20.2, ACTUAL=A20,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=PERCENTCHANGE, ALIAS=PercentChange,
USAGE=D20.2, ACTUAL=A20,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=PREVIOUS_CLOSE, ALIAS=Previous_Close,
USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=BID, ALIAS=Bid, USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=BID_SIZE, ALIAS=Bid_Size, USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=ASK, ALIAS=Ask, USAGE=A30, ACTUAL=A30,yes
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=ASK_SIZE, ALIAS=Ask_Size, USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=HIGH_52_WEEKS, ALIAS=High_52_Weeks,
USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
FIELDNAME=LOW_52_WEEKS, ALIAS=Low_52_Weeks,
USAGE=A30, ACTUAL=A30,
REFERENCE=QUOTE, PROPERTY=ELEMENT, $
|
Figure 3
Note that the input parameters to Web service operations show up in the first segment. The Text and A1 formats are used for internal use based on the WSDL file and should not be used in the WebFOCUS request.
The access file looks as follows:
SEGNAME=ROOT, CONNECTION=StockQuote,
VERSION=1.1, OBJECT=GetQuotes,
ACTION=http://www.xignite.com/
services/GetQuotes,
TARGETNS=http://www.xignite.com/
services/, STYLE=DOCUMENT, $
Parameters to Web service operations are passed in the form of a WHERE clause.
The following is an example of retrieving stock quote information for Microsoft:
TABLE FILE GETQUOTES
PRINT NAME BID ASK
BY SYMBOL
WHERE (SYMBOL EQ ‘MSFT’)
END
It’s as simple as that. You can JOIN Web services to other Web services and JOIN Web services to other data sources.
You also may consume WebFOCUS Web services. This means that you can create WebFOCUS reports, which report against operations contained in WebFOCUS Web services such as WebFocusListServers and WebFocusList Apps.
The WebFOCUS Web services adapter truly gives you the ability to leverage complex business logic calculations created in other development languages to be used in WebFOCUS reporting.

|
|