1 / 40

PWB509: Web Services in PowerBuilder

PWB509: Web Services in PowerBuilder. Guobi Wu Senior Software Engineer guo-bi.wu@sybase.com July 8, 2003. Jinyou Zhu Senior Software Engineer jyzhu@Sybase.com. Web Services in PowerBuilder. Summary. What is Web Services How to Create Web Services How to Register Web Services

abner
Download Presentation

PWB509: Web Services in PowerBuilder

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. PWB509: Web Services in PowerBuilder Guobi WuSenior Software Engineerguo-bi.wu@sybase.comJuly 8, 2003 Jinyou ZhuSenior Software Engineerjyzhu@Sybase.com

  2. Web Services in PowerBuilder Summary • What is Web Services • How to Create Web Services • How to Register Web Services • How to Find Web Sevrices • How to Write PB Web Services Client • How to Write JSP Web Services Client • Demo • Q&A

  3. What is Web Services Summary • Web Services is … • Web Services enable PB to interact with other languages, such as Java, .NET • SOAP • SOAP stands for Simple Object Access Protocol, it is a lightweight protocol for exchange of information in a decentralized, distributed environment. • http://www.w3.org/TR/soap12 • WSDL • WSDL stands for Web Services Decription Language, it is an XML format for describing network services as a set of endpoints operating on messages containing either document-oriented or procedure-oriented information. • http://www.w3.org/TR/wsdl

  4. What is Web Services Summary • UDDI • UDDI stands for Universal Description, Discovery and Integration, it enables businesses to quickly, easily, and dynamically find and transact with one another. • http://www.uddi.org

  5. WSDL Elements of WSDL • Types: a container for data type definitions using some type system (such as XSD). • Message: an abstract, typed definition of the data being communicated. • Operation: an abstract description of an action supported by the service. • Port Type: an abstract set of operations supported by one or more endpoints. • Binding: a concrete protocol and data format specification for a particular port type. • Service:a collection of related endpoints. • Port: a single endpoint defined as a combination of a binding and a network address.

  6. WSDL Let’s Read a WSDL Sample • <types> <schema ... > <element name="TradePriceRequest"> <complexType> <all> <element name="tickerSymbol" type="string"/> </all> </complexType> </element> <element name="TradePrice"> <complexType> <all> <element name="price" type="float"/> </all> </complexType> </element> </schema></types>

  7. WSDL Let’s Read a WSDL Sample • <message name="GetLastTradePriceInput"> <part name="body" element="xsd1:TradePriceRequest"/></message><message name="GetLastTradePriceOutput"> <part name="body" element="xsd1:TradePrice"/></message><portType name="StockQuotePortType"> <operation name="GetLastTradePrice"> <input message="tns:GetLastTradePriceInput"/> <output message="tns:GetLastTradePriceOutput"/> </operation></portType><binding name="StockQuoteSoapBinding" type="tns:StockQuotePortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/></binding>

  8. SOAP Let’s Read a SOAP Request Sample • POST /StockQuote HTTP/1.1Host: www.stockquoteserver.comContent-Type: text/xml; charset="utf-8"Content-Length: nnnnSOAPAction: "Some-URI"<SOAP-ENV:Envelopexmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <SOAP-ENV:Body> <m:GetLastTradePrice xmlns:m="Some-URI"> <symbol>SYBASE</symbol> </m:GetLastTradePrice> </SOAP-ENV:Body></SOAP-ENV:Envelope>

  9. SOAP Let’s Read a SOAP Response Sample • HTTP/1.1 200 OKContent-Type: text/xml; charset="utf-8"Content-Length: nnnn<SOAP-ENV:Envelopexmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/> <SOAP-ENV:Body> <m:GetLastTradePriceResponse xmlns:m="Some-URI"> <Price>20.0</Price> </m:GetLastTradePriceResponse> </SOAP-ENV:Body></SOAP-ENV:Envelope>

  10. Web Services in PowerBuilder Summary • What is Web Services • How to Create Web Services • How to Register Web Services • How to Find Web Sevrices • How to Write PB Web Services Client • How to Write JSP Web Services Client • Demo • Q&A

  11. How to Create Web Services Create Web Services in PB 9 • Write PB NVO • Deploy PB NVO to EAServer 4.x • Generate Java Stub and Skeleton in Jaguar Manager • Expose Component as Web Services in Web Services Toolkit

  12. Create Web Services in PB 9 Expose component as Web Services in Web Services Toolkit • Create WSDL Document

  13. Create Web Services in PB 9 Expose component as Web Services in Web Services Toolkit • New Web Service

  14. Create Web Services in PB 9 Expose component as Web Services in Web Services Toolkit • Add Addresses and Select Operations

  15. Create Web Services in PB 9 Expose component as Web Services in Web Services Toolkit • Copy generated 2 wsdl files (implementation and interface) from \\EAServer\Webservices\work\wsdlto a place which user can access

  16. How to Create Web Services Create Web Services in PB 10 • Write PB NVO • Set NVO as Web Services component • Deploy PB NVO to EAServer 5.x • Manage Web Services Component in Sybase Management Console

  17. Create Web Services in PB 10 Write PB NVO • Set NVO as Web Services Component in EAServer Component Wizard

  18. Create Web Services in PB 10 Write PB NVO • Set NVO as Web Services component in Properties for EAServer Component Generator

  19. Create Web Services in PB 10 Manage Web Services Component in Sybase Management Console • Sybase Management Console Replaces Web Services Toolkit in EAServer 5.x

  20. Create Web Services in PB 10 Manage Web Services Component in Sybase Management Console • Sybase Management Console Replaces Web Services Toolkit in EAServer 5.x

  21. Web Services in PowerBuilder Summary • What is Web Services • How to Create Web Services • How to Register Web Services • How to Find Web Sevrices • How to Write PB Web Services Client • How to Write JSP Web Services Client • Demo • Q&A

  22. How to Register Web Services Manage Web Services Component in Sybase Management Console • Publish Web Services Component to UDDI server

  23. Web Services in PowerBuilder Summary • What is Web Services • How to Create Web Services • How to Register Web Services • How to Find Web Sevrices • How to Write PB Web Services Client • How to Write JSP Web Services Client • Demo • Q&A

  24. How to Find Web Services Search Web Services from UDDI server in PB 10 • UDDI Search in PB and JSP Web Services Proxy Wizard

  25. How to Find Web Services Search Web Services from UDDI server in PB 10 • UDDI Search in PB and JSP Web Services Proxy Wizard

  26. How to Find Web Sevrices Search Web Services from UDDI Server in PB 10 • UDDI Search in PB and JSP Web Services Proxy Wizard

  27. Web Services in PowerBuilder Summary • What is Web Services • How to Create Web Services • How to Register Web Services • How to Find Web Sevrices • How to Write PB Web Services Client • How to Write JSP Web Services Client • Demo • Q&A

  28. How to Write PB Web Services Client Summary • Generate Web Services Proxy using Web Services Proxy Wizard • Add pbsoapclient90.pbd to PB Target • pbsoapclient90.pbd defines 2 new objects (SoapConnection and soapexception) to handle soap message • Write PowerScript Code

  29. How to Write PB Web Services Client Write PowerScript Code • SoapConnection cnncnn = Create SoapConnectionws_pkg_customer_n_customerserviceport wsobjcnn.CreateInstance(wsobj,"ws_pkg_customer_n_... ")try li_return = wsobj.of_getcustomer(li_custid,...)catch (SoapException e) MessageBox("Exception",e.text)end trydestroy cnn

  30. How to Write PB Web Services Client Write PowerScript Code • Turn on Log if Something Is Wrong • cnn = Create SoapConnectioncnn.setOptions("SoapLog='d:\webservice.log’”) • Let’s Read a Log File

  31. How to Write PB Web Services Client Write PowerScript Code • How to Pass HTTP Authentication • cnn = Create SoapConnectioncnn.setOptions("SoapLog=’’ ,Userid='xxx', Password='yyy'”) • How to Pass a Proxy Server Which Requires Username and Password • cnn = Create SoapConnectioncnn.setProxyServerOptions(“Address=‘proxy.sybase.com’, Userid='xxx', Password='yyy'”)

  32. Web Services in PowerBuilder Summary • What is Web Services • How to Create Web Services • How to Register Web Services • How to Find Web Sevrices • How to Write PB Web Services Client • How to Write JSP Web Services Client • Demo • Q&A

  33. How to Write JSP Web Services Client Summary • Generate Custom Tag using JSP Web Services Proxy Wizard • Write JSP page • Deploy to JSP Server

  34. How to Write JSP Web Services Client Summary Generate Custom Tag using JSP Web Services Proxy Wizard • Do You Want to See How Custom Tag is Implemented: • Open the generated tld file • Extract java files from the generated jar file • Let’s Read TLD File • Let’s Read Java Implementation

  35. How to Write JSP Web Services Client Write JSP page <%-- Add custom tag to this page --%> <%@ taglib uri="WEB-INF/tlds/pkg_customer_n_...tld" prefix="cust" %> <%-- Define variable to pass into custom tag --%> <%! Short custid = new Short((short)107); org.omg.CORBA.StringHolder address = new org.omg.CORBA.StringHolder(); ... %> <%-- Run custom tag --%> <cust:of_getcustomer address="<%= address %>" cust_fname="<%= cust_fname %>" ... /> <%-- Print return results --%> <%= address.value %></TD> <%= pkg_customer_n_customerService_of_getcustomer_returnValue %>

  36. How to Write JSP Web Services Client Deploy to JSP Server • Deployment Server Can Be Any JSP Server

  37. Web Services in PowerBuilder Summary • What is Web Services • How to Create Web Services • How to Register Web Services • How to Find Web Sevrices • How to Write PB Web Services Client • How to Write JSP Web Services Client • Demo • Q&A

  38. Web Services Demo • All Source Codes in This Demo Are Here • Many Thanks to Azeez Abdul, He Wrote Most Samples for This Demo

  39. Q&A ?

  40. SDN Presents CodeXchange Share PowerBuilder 9 Code and Tools • New SDN feature enables community collaboration • Download samples created by Sybase • Leverage contributions of others to exploit PBNI (i.e. PBNI CommonDialog, PBNI OLEObject utilities) • Contribute your own code or start your own collaborative project with input from other PowerBuilder experts • Any SDN member can participate • Log in using your MySybase account via SDN • Join the collaboration already underway • http://powerbuilder.codexchange.sybase.com or via SDN at www.sybase.com/developer • SDN & CodeXchange at TechWave • Technology Boardwalk • Sybase Booth Theater

More Related