Getting in a lather Ian Pearce Sybase Professional Services ipearcesybase'com PowerPoint PPT Presentation

presentation player overlay
1 / 29
About This Presentation
Transcript and Presenter's Notes

Title: Getting in a lather Ian Pearce Sybase Professional Services ipearcesybase'com


1
Getting in a latherIan PearceSybase
Professional Servicesipearce_at_sybase.com
2
Agenda
  • What is it
  • What does it do
  • Why do I need to use it
  • How can I use it

3
What is it
  • SOAP means
  • Simple Object Access Protocol
  • Rationale ?
  • Invented as a language-independent method for
    invoking business methods by wrapping them up as
    XML documents

4
What is it (cont.) ?
  • Operates across process boundaries
  • Uses HTTP as its transport protocol
  • Quite a popular protocol !!!
  • Allows us to do Remote Procedure Calls
  • (Get someone else to do the work !)

5
XML again ???
  • All we hear about these days is XML !!!
  • Good point !
  • Is it any use to me ?

6
Any old data, any old data, any, any, any old
data
Your/Data/0xCC
Your Enterprise (but Legacy format) Application
That you always have to make the changes to
because youre the last one left from the team
that originally wrote it
7
XML cont.
  • OK, good point
  • Why do I need XML when I can just throw an
    Integer or a Blob across the wire ?
  • Portability
  • Byte-swapping

8
Why do I need to use it ?
  • OK, but I dont need that if Im talking to
    EAServer from PowerBuilder, or Java !
  • Agreed, but what if someone chose another
    Application Server ?
  • What if someone has already written some code
    that you can just invoke, with a minimum of
    effort ?

9
eGP Demo
10
eGP Demo
11
How does it do it ?
  • At its most simple level SOAP works like this

Wrap request as XML and dispatch
Invoke Service
SOAP Container
Java Class
Decode
Collect results
Convert to XML and dispatch
12
How does it do it ?
  • The client wraps up a request and sends it to the
    SOAP container
  • The SOAP container then
  • unwraps the request
  • calls the required service
  • wraps up the result and dispatches it
  • The client then unwraps it

13
What we really do
  • To make the call to the SOAP container, we need
    to pass across an ENVELOPE
  • This contains a BODY, which itself contains
  • the request
  • the parameters

14
And the SOAP container is ?
  • The SOAP container can be anything
  • But well use the Apache SOAP server from
    http//xml.apache.org/dist/soap/
  • Easy to install
  • See http//my.sybase.com/detail?id1013352

15
And the SOAP container does ?
  • Once installed, the SOAP service deals with all
    your requests
  • We can easily administer it by using the
    SOAPAdmin web application
  • We can easily define our own services

16
How can I use it ?
  • Here comes the science part

17
Using SOAP with PowerBuilder
  • In order to use SOAP, you need to establish an
    HTTP connection with the SOAP server
  • Luckily, we have that facility, using the GetUrl
    function

18
Using SOAP with PowerBuilder
  • Or do we ????
  • SOAP complains when you use the GET HTTP method
  • it wants you to use the POST HTTP method

19
GET/POST whats the difference ?
  • Brief reminder ..
  • The GET method is used when you want to pass
    parameters over to an HTTP server
  • but these parameters are appended to the URL
  • i.e. http//my.sybase.com/detail?id1013352
  • The id parameter is appended

20
GET/POST whats the difference ?
  • Remember, SOAP wants you to POST parameters
  • Why cant we use GET
  • Because what would happen if were passing a HUGE
    amount of information across to the SOAP Server
  • Overloaded anyone ?

21
GET/POST whats the difference ?
  • We therefore need to use the POST method
  • Internet banking ever seen you UID/PWD in the
    URL ?
  • Unlikely -)
  • So we need to use the POST HTTP method

22
PowerBuilder to the rescue !!
  • Luckily, PowerBuilder has the posturl method
  • Its been there since version 6.0 actually !
  • The postURL method is a method in the inet system
    object

Actually, it might have been an addition to
Version 5 whos counting -)
23
The inet System object
  • The postURL method works like this
  • Where linet_base is an instance of the inet
    object
  • lblob_data is a BLOB that contains the XML
  • ls_headers is the HTTP header set
  • lnv_id is an instance of the internetresult object

24
Catching the response
  • After dispatching the request to the server, we
    just lie back and think of ltinsert_applicable_coun
    trygt
  • When the server responds, we see the response as
    a STRING argument to the internetdata event in
    the internetresult object
  • Et voila !

25
Building a generic PBSoapService
  • If we want to call PB Components from a SOAP
    client, we can do one of two things
  • 1. Wait for the PBWebServices addition to EAS
  • 2. Roll our own !!!!

26
Rolling our own
  • Things to remember
  • 1. We need a skeleton service on the SOAP
    container to handle our requests
  • 2. We only ever want strings passed back

27
Rolling our own
  • Steps
  • Create a PB component that retrieves a row based
    on an argument
  • Generate Java stubs (and compile)
  • Create a Java wrapper which will pass-through any
    requests
  • Create a deployment descriptor for the wrapper
  • Deploy it (using the sample that comes with the
    SOAP service from Apache)

28
More information
  • For more information, please feel free to contact
    me
  • ian.pearce_at_sybase.com
  • 01628 597395
  • 07977 257395

29
Getting in a latherIan PearceSybase
Professional Servicesipearce_at_sybase.com
Write a Comment
User Comments (0)
About PowerShow.com