Building_SoA_city_Ea.. - Logosworld

foregoinggowpenSoftware and s/w Development

Nov 4, 2013 (3 years and 7 months ago)

73 views


Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
1

von
14

1


Panta rhei


nothing is as stable as change



Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
2

von
14

2

The Early Days
: Using basic services

Text taken over to SOA Book Governance 25Dec
2008

Introducing a
Service Oriented
Architecture (
SoA
)

to your enterprise is very much like
architecting a city.
The following
series of documents
will
give you a practical
demonstration of how you can benefit from
the
services that make up the basis of a
SOA
. The challenge we take

on

is tha
t we do not want to spend more than one
h
our in
general
in order
to connect an
y

arbitrary data source to a process flow. This time we
shall invite you into our SoA Garden to see how we break down a real life SoA challenge
and solve it with methods of Agile

and Extreme Programming in a SoA environment.

B
B
u
u
i
i
l
l
d
d
i
i
n
n
g
g


S
S
o
o
A
A


c
c
i
i
t
t
y
y



Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
3

von
14

3

SOA is a wide
-
spread
industry
effort to restructure IT applications in a way that
they

can
be accessed as services from other applications.

This dictates the true essence of a SoA: the Services.
You have reached the state of a
Service Oriented Architecture when

you
have
created a nominal number of services and
it appears easier for developers of new applications to reuse the existing services
rather
than writing
their
own ones again
.

A good example of a working SoA infrastructure is the Windows operating system.
Nearly every application written for Windows is equipped with a full featured
application programming interface that makes it easy for

other applications to automate
the control of it.

T
he following example
demonstrates just
how easy you can control an ActiveX
application. This little VBA script opens an existing Word document and saves it again as
Microsoft HTML archive (.mht).

Public
Sub XConverter()

'

Dim oDocs As Word.Documents

Dim oApp As Word.Application

Dim oDoc As Word.Document

'


Set oApp = New Word.Application


Set oDocs = oApp.Documents


oApp.ChangeFileOpenDirectory "F:
\
BLUEBOOK
\
mySOA
\
word
\
"




Set oDoc = oDocs.Open( _


filename:="current.doc", _


ConfirmConversions:=False, _


ReadOnly:=True, _


AddToRecentFiles:=False, _


Format:=wdOpenFormatAuto, _


XMLTransform:="")




oDoc.SaveAs _


filename:="current.mht", _


FileFormat:=wdFormatWebArchive


oDoc.Close False

End Sub

W
W
h
h
a
a
t
t


i
i
s
s


t
t
h
h
e
e


S
S
e
e
r
r
v
v
i
i
c
c
e
e


O
O
r
r
i
i
e
e
n
n
t
t
e
e
d
d


A
A
r
r
c
c
h
h
i
i
t
t
e
e
c
c
t
t
u
u
r
r
e
e
?
?



Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
4

von
14

4

You can instantiate this script from many powerful scripting languages like Python or
Windows Powershell. The true work is done by the instantiated objec
ts that encapsulate
the processed Word document completely. The Word control is a service, an extremely
powerful
one
as well.

Are we ready for

t
he SoA

era
?

Modern enterprises are well equipped with a rich kaleidoscope of powerful software
applications. Whi
lst the application themselves are extremely powerful and deliver
state
-
of
-
the
-
art features in many respects, the way how data is brought in and out of
those applications is yet extremely awkward. Practically every ERP application uses
their
own proprietar
y interfacing protocols and
their
data models
often
differ heavily
. This is
even true f
or such highly standard application models like a sales order or an order
shipment. As a matter of fact, writing interfaces
for ERP applications is still a specialists’
task. Many may

think that EDI with SAP is a
very
difficult job, but
in actual fact
other ERP
systems are far more awkward in that respect.

Initiatives that tried to build interfacing standards based on a universal ontology


like
EDIFACT


did not deliver
the expect
ed

success. They all suffer from the same deficiency:
they require substantial changes to be

made on the legacy system’s side. Even if we
disregard the fact

that this
typically
costs a nominal amount of money, it is often
pretty
much

impossible to implement the changes (
if we deal with a grown, old application
)
.
This is e
specially
true for
the critical applications that
were designed according to

custom needs, like those famous AS/400 application
s

that drive whole factories
. These
app
lications
are often untouchable for the sole risk that it might bring down the whole
production service with a key stroke.

What does SOA
do
differently?

SOA goes
in with
a different approach. Instead of forcing legacy applications to adopt a
licentious sta
ndard, SOA provides for generic mechanisms to allow adaptation of legacy
applications. An
Enterprise Service Bus (
ESB
)

is not set for one single standard but
rather
provides a place where every intere
sted party can plug i
n

an

appropriate converter.
Once th
e messages are in a readable format, they can be proce
ssed by uniform
algorithms.
SOA

does this and
more: it offers services and encourages applications to
abandon home
-
made solutions and replace them by common services.

Workflow is one area where a SOA c
an show the highest benefit
s. Currently no ERP suite
has

set a workflow messaging standard and none of them
are

able to provide a
satisfactory collaboration framework with respect to integration of third party products.

Workflow means executing a serious o
f single tasks in sequence, with the possibility to
halt the flow to request user decisions and to control the flow depending on the content
of the message.

Imagine how difficult it
is to successfully fulfill the following scenario:



Email a message from
SAP R/3 to an Outlook email box



The
email
message should be prepared in such a way that

it allows
the user to
“tick
a decision

box”

or fill out some missing
information or
figures and then
“submit” the message back t
o SAP in such a

format
that the
user
decision can be
processed by the workflow

engine
.


Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
5

von
14

5

Here we
can
see the advantages of a SOA framework: Instead of preparing your message
as a form, you would send the message with a list of questions and possible answers to
the SOA framework. The SOA framewo
rk will then prepare the message for Outlook and
return the received answers in a previously agreed format.

It is just like if you wanted to drink some good fine beer. You could buy some recipe
books, the latest micro
-
brewery
-
tool
-
kit and some fine ingred
ients if you are able to find
a store that sells hop and malt and start experimenting. Those who have tried
it have
told me unisono,
and
that it ended up in some sort of disaster and
that
the result was
everything but
the furthest thing from

beer. So you m
ight consider simply going to a
store and choosing from the variety of ready
-
brewed beers.

The Business Challenge

It was not even two years ago when the expression SoA was quite an exotic term and
only something for visionary CIOs. This has
completely
cha
nged

in 2007.

Now, the SoA
hype
has
reache
d

new heights and the number of

wannabe SoA consultants


is widely
on the rise.

It is now

important

to distance

yourself

from the many theoretical
pieces of
advice and
rather
hook onto more practical way of seeing SoA. It is always the unknown and
uncertain that appears to us as difficult and dangerous. And mostly it turns out that the
expected obstacle is a trivial path to go.

We are now determined to demonstrate that you can

build the essentials of SoA in
a
ridiculous
ly

small

amount of

time
. But this is only achieved by choosing the correct,

pragmatic strategy and reusing the right components to be orchestrated by the right
utilities. We shall show you extreme SoA in a minute
,
but first let us
expose the business
challenge a bit by reflecting some real life examples (of course all identities are
randomized)

Business cases

Here we have three individual business cases. The challenges for the respective IT forces
may vary, but th
ey have a common pattern. They are
all
tied up in their old fashioned
understanding of IT and IT governance and
are
blind
to the new possibilities out there.

This does not mean that these guys were totally wrong all the time. It is truly
a
fact that
the fo
undation to build a SoA has been created w
ithin the past five years
.
At the same
time it is also
clear that building
a
SoA city
would have been
much more difficult

to
accomplish

a couple years
ago

than today. Today SoA is a straight forward and lightning
f
ast experience.

Mission impossible in Johannesburg

Paul Hunter sat at his desk in a pretty desperate mood. He just came back from a
meeting wit
h his CTO in Houston/Texas. H
e came back with a challenge that seemed to
him fairly unsolvable. His idea was that

using the

full cycle defined by Moore's law he
wanted at least 80% of the customers connected electronically to the ordering and
supply chain system..
.

H2O has a branch that produces sterile papers for medical sciences and laboratories.
The customers are
widely spread all over the world and the texture of these customers

Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
6

von
14

6

goes from huge industrial clients to small individual labs. While the industrial companies
are mostly linked through classical EDI standards like EDIFACT and X.12
,

Hunter
had
been
working
now for more than five years in getting the smaller labs
connected
somehow
.

They were writing regular letters to the clients, asking them to
please

deliver data
electronically. They

even

got the key accounters to add a penalty on the price tag for
those no
t connected via EDI. They offered longer payment terms. Nothing worked. The
answers were always the same: "our software does not support EDIFACT or X.12", "we
have no way
sending

data to an X.400 Telebox", "we have no money to pay the
programmers".

How sho
uld Hunter

achieve in
o
nly nine months time what they did not
even
vaguely
achieve in the many years
prior
? Hunter's hope had

always been that more and more
customers
would
eventually change their software and would then
be able to
jump on
to

the bandwagon
for automation. But there were no clouds that ind
icated that this would
ever happen
. Under these circumstances Hunter's day as head of IT infrastructures in
South Africa seemed to be numbered.

Champagne with RFID in Copenhagen

The Research and Development
at the University was quite exhilarated. After a couple
of frustrating night shifts they finally managed to get the ne
w RFID based conveyor belt

running

properly
. Whenever a truck enters the hall all the containers on the truck are
automatically scanned
and recognized by a myriad of RFID antennas. The data is then
used by a small local application to open and close some wedges that are installed on
the top of the conveyor belt. The champagne was

bubbling over
after this great success.

Only Niels Holgersso
n


no, not that one


seemed to be more contemplative in contrast
to the serene hardware team. His duty was more to demonstrate what they finally could
do with the new expected affluence of
the
RFID data from the production sites. They
had an IDES SAP sys
tem running and they wanted to use this as
a
data sink for the
collected data to kick off some business processes like sending goods receipt
notifications and update the warehouse's stock quantities in real
-
time.

But Niels knew
only
too well that it would
not be
as easy as it appears
. The idea of the
demo centre was amongst other
things

to prepare some prêt
-
à
-
porter solutions for
specific industries to
could
connect the RFID world to the ERP universe in a plug
-
'n
-
play
manner. But this meant that they needed

to be prepared for so
me worst case scenarios
as well. This would include
customers running old, outdated or home
-
made software
solutions that cannot be expected to comply with much of a modern communication
standard. And if the programmer of such an old s
ystem
has resigned

(
as he knows many
AS/400 production systems
)
, there is trouble ahead.

First of all,
Niels

expected a greater variety of customers still running older SAP releases.
The presence of a middleware
product
like
SAP
XI would rather be the exceptional case.
So his unsolved work for the coming three months was to find a way
on
how to connect
the RFID toys with the most common real life scenarios.

Mutiny in Texas

Heidelberg, Germany, March 2007


Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
7

von
14

7

Peter Hartmann hit the han
dset back to the fork so that it was audible all over the open
office. He had an unpleasant talk with the head of the sales force team, Heidi Bayer.
Mrs. Bayer

had just

returned the other day from the CeBIT computer fair in Hannover.
There
s
he met some peo
ple who demonstrated
to her
how easy it was with Microsoft
Dynamics to create sales order documents and either print them out or send them
directly via telefax or
even
email as PDF, TIF or ZIP
-
File. That was something that Mrs.
Bayer had

had

in
her mind fo
r so many years and she had

run this
exact
request
by
Peter
Hartmann

numerous times before as he

was responsible for the SAP driven ERP
landscape.

This time Heidi Bay
er made it very clear. Either Peter

would have a solution for
this
exact scenario

up and r
unning

in a couple of weeks or
she would withdraw her

signature
for funding the new SAP consolidation project.

While he still mulled over this threat he got another email that gave him

confusion for

the rest for the day: the CIO of the Texas affiliation of H2O decided to refrain from the
SAP consolidation project and signed a
nother

contract with Microsoft and IBM to equip
the nearly 50 locations in North America with an ERP software.

Peter Hartmann considered this plan as insane. They
had
invested 10 years of work
in
order
to get all the SAP systems running according to business demands and now they
have
refrained from revamping the solution into a single consolidated instance. What
Pe
ter Hartmann never understood was the fact that the business never went for his
technical arguments and found his financial calculations quite absurd and unrealistic.
But
that was not the
worst part: business felt permanently dependent on the good will
of
the IT and hence
became
indignant.

They were looking for freedom and so they
headed
back on the markets.

Extreme SoA

They are numerous vendors out their like SAP, IBM and Oracle that most certainly have
very impressive integration products, but just how lo
ng does it really take to get a
integration scenario up and running with the ability to change it rapidly on demand? We
keep hearing things like:

“companies need to be agile in order to remain competitive
in the dynamic marketplace these days” or

“with o
ur product all you do is drag and drop and voila,
there you go”.

Well that sounds all good and true but in utter honesty how long does it typically take an
integration specialist or programmer to change a technical business process? One week?
Two weeks? I

would say that the majority of products out there are all bark and no bite,
I want to see results and I want to see them now!

Putting up the stakes: a SOA in four weeks

Let’s dive straight into this…how long would you expect the following to take?



Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
8

von
14

8

1.

Insta
ll a “message orchestration” product

2.

Orchestrate a business scenario that does the following:

a.

Receive an IDoc

i.

Email the received IDoc to someone when there is a special
malicious content

ii.

Convert the IDoc to PDF

iii.

Email the PDF to some designated receiver

iv.

Ha
ndover the PDF to an attached archiving system using
XMLRPC

b.

Branch off and
also
do the following:

i.

Send
the
IDoc to a remote message queue service via HTTP (like
the “Amazon Simple Queue Service”)

ii.

Send an IDoc to an ABAP message queue on a SAP server (via
H
TTP interface)

iii.

Send IDoc to another message queue on a SAP server (via RFC
interface)

iv.

Invoke an ABAP web service and pass it the incoming IDoc and
get a response IDoc that becomes the result of running the
process

3.

Test and deploy the process

4.

Change the
process by adding in a new service


The following depicts part of the above mentioned process in ActiveBPEL Designer
1
.

Figure
1
: A sample BPEL process in ActiveBPEL Designer


Realistic Figures

How does the following sound?

1.

Install a “message orchestration” product

-

15

min
utes

2.

Orchestrate the business scenario


-

30 minutes

**Orchestrate only, no service code




1

ActiveBPEL designer is probably the best and easiest to use SOA orchestration tool in
the marketplace today. (
http://www.active
-
endpoints.com/
)


Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
9

von
14

9

3.

Test and deploy the process



-

30 minutes

4.

Change the process by adding in a new service

-

1 hour


You think these
are realist
ic figures? Absolutely! We did
it! And we
also did it
on partly
totally new ground. The components we used have

most certainly

not been our daily
dish so far:



ActiveBPEL was completely new to us



Python we knew, but ho
nestly, we had never written

mo
ré than a “Hello
World”



Well, the rest was more or less downloads from the wide
fund of the
OpenSource community


We basically found the compon
ents for a proper working SOA in

the WWW. The WWW
is a huge society of communities and the
se

communities are dedicated to service. They
develop things and attribute them to the public and in return they get some
other
great
things back
.
After all not everything need to be about money...

A side
-
mark: It is remarkable and predictable that the compa
nies
that

sell utilities
and
services for money only will become

extinct
faster

than anybody may believe.

In our case we

decided to use Python as the scripting
language
, simply
because we got

most
of the
working snippets from the community. But Python was
only our

today’s
dish

. Right this minute a good friend
has just come in
and show
n me

s
ome neat PERL
scripts

that

monitor his EDI messages. Nice work he did, we do not ever think of
rewriting this, we shall just use it.

Why scripting languages? Scripting
languages like Python are designed for “gluing”
together applications as they assume that there already exists a useful collection of
other useful components written in other languages. The main advantage of scripting
languages is their high degree of prog
rammer productivity and software reuse.

One small thing

should not remain unmentioned: as cute and smart
as the following
may appear,

i
t depends heavily on the functions provided by the Microsoft windows
operating system. This is not necessarily the .NET f
ramework,
in fact
most features we
use run safely on top of the Windows API. But why Windows? Isn’t it treason towards
the wide community? Not really, we chose best of breed approach, and most
components we chose had no corresponding part in the Linux
world.

But back to our SoA garden. Integration does not need to always be a painful, time
wasting and expensive exercise. By giving up the single vendor and single architecture
approach

we achieve a complete new dimension of agility and speed
in developme
nt.


Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
10

von
14

10

Day 1 in SoA Garden

Now let see
this

all
fits together
and step into the SoA Garden
. On the first day of out
SoA building exercise we shall start with some easy to understand examples

in order to
warm up
.

All examples and strategies are done in the sp
irit of the Agile Manifesto that drives
Extreme Programming
,
Scrum

and
Hologramming

as

its essence. For now we shall
ignore any error handling or any step that distracts our concentration on the really
essential.

Routing data

When c
omparing SoA
to
the time
s when cities
were built, we find ourselves in the
period where the teleph
on
e

was invented and became
widely

used.
The basic challenge
of a

SoA is to serve the data
at the right place in the correct format
to an application
with limited interfacing capabil
ities. SAP R/3 is such an application. We try to avoid using
SAP
XI for now and work on a plain vanilla SAP ABAP stack.

We want

to



Receive some data in a folder of the file system



Push the data to SAP by calling a specific function module



Push the data to

SAP via HTTP interface



Push the data to SAP via ABAP web service



Common tasks



ZIP and UNZIP files



Create

EXCEL file

We have decided to do all this in Python, a popular scripting language with the power to
change its interface like a chameleon. We chose
it because there are so many ready to
use snippets and utilities out there, that we could reuse.

Receive some data in a folder of the file system

Here is the simple Python
piece of
code that
polls a direc
tory and reads the first line of
data from a

new fil
e

(assuming the file contains an IDoc for example)

import os

import time

import datetime

poll_dir = 'c:
\
\
tmp
\
\
idoc_in
\
\
'

before_list = dict ([(file, None) for file in os.listdir (poll_dir)])


while 1:


time.sleep(5)


print datetime.datetime.now().strftime("%d/%m/%Y %H:%M:%S") + "





Watching directory " + poll_dir


after_list = dict ([(file, None) for file in os.listdir (poll_dir)])


new_file = [file for file in after_list if not file in before_list]


Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
11

von
14

11


i
f new_file:


print "File added: ", ", ".join (new_file)


full_path = poll_dir + new_file[0]


myfile = open(full_path, 'r')


idoc = myfile.readline()


print "File contents: " + idoc


myfile.close()


before_list = after_list

And here is the Python Shell output after dropping a file

New_IDoc_File.txt
” into the
“hot folder”.


Push the data to SAP by calling a specific function module

Here is
some
Python
code that passes the

IDoc

data”

v
ia

a remote function module call

to SAP.

import pysap

conn=pysap.Rfc_connection()

print "Connecting to SAP system..."

conn.open(conn_string='ASHOST=
<some_sap_server>

SYSNR=00 CLIENT=000 USER=bcuser
PASSWD=
<some_password>
')

print "Retrieving function module
interface ZLOGOSZMQ_PROXY"

func=conn.get_interface('ZLOGOSZMQ_PROXY')

func['HEADER']="IDOC_HEADER"

func['DATA']="SOME_IDOC_DATA"

print "Executing function module..."

result=func()

print "Result from function module call is: " + func['GUID']

And here is the Python Shell output after
executing the code above.



Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
12

von
14

12

Push the data to SAP
via HTTP interface

Below if some simple Python code that demonstrates just how easy it is to send data via
HTTP to a SAP system.

import urllib2

idoc = 'SOME_IDOC_DAT
A'

result = urllib2.urlopen("http://
cerberos
.logosworld.com:8200/mq/receive?sap
-
client=000", idoc)

str = result.read()

print str

Push the data to SAP via ABAP Web Service

Creating ABAP web services is simple, really simple...and invoking a web service from

Python is even simpler.

from SOAPpy import WSDL

wsdlFile
= 'http://
<sap_server>
:8010/sap/bc/srt/rfc/sap/ZLOGOS_MATERIAL_PUT?sap
-
client=010&wsdl=1.1&style=rpc'

server = WSDL.Proxy(wsdlFile)

idoc = 'SOME_IDOC_DATA'

response =
server.ZlogosMaterialPut(IvIdocIn = idoc)

print "Response from ABAP web service: " + response

And here is the result in the Python Shell after running the above code.


Common tasks

After this little warm up round we want to add some
extra processing like
ZIPPING file
for archiving purposes or UNZIPPING
files

read in from a
n

email message
. No
problem...simple!

Below is a small piece of Python code that shows how simple it is to ZIP a file.

import zipfile

myfile = zipfile.ZipFile('test.zip','w',zipfile.ZIP_
DEFLATED)

myfile.write('My_BIG_File.txt')

myfile.close()

And on the other end the following piece of code shows just how easy it is to UNZIP a
file.

import zipfile

myfile = zipfile.ZipFile('test.zip','r')

for filename in myfile.namelist():


Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
13

von
14

13


data = myfile.read(filename)


file = open(filename, 'w+b')


file.write(data)


file.close()


Let’s face it, most people love getting data in EXCEL format. So would it not be nice to
create EXCEL files with absolute ease using the standard COM i
nterface? The following
code shows just how easy it is to create
an EXCEL file using Python and pass it some
arbitrary cell value.

import os

import win32com.client


filename = 'myfile.xls'

filepath = os.path.abspath(filename)


excel = win32com.client.Dispa
tch('Excel.Application')

excel.Visible = False

workbook = excel.Workbooks.Add()

sheet=workbook.Worksheets(1)

sheet.Cells(1,1).Value = "Hello Excel from Python"

workbook.SaveAs(Filename=filepath)

excel.Quit()


These
sorts

of useful pieces of code could easily be added to some sort of “utility class”
that could be accessed by multiple other applications requiring the same sort of
functionality.

The Later Days

All we had here was
just a small demonstration
on
how
easy it is
to accomplish
data
routing and some manipulation by reusing great routines written by some other people.
The essential lies here on reusing components. If we need some more work to be done,
we should simply look out for a great utility to do the job.

For
example,

if we need to create a TIF
image
from our document we may make use of
the GraphicMagick libraries, that are written in PHP but
that also allow access to
most
of
the
features
via

an XMLRPC web service. Converting to PDF may be done using
Ghostscrip
t or the genuine Adobe Acrobat library. En
crypting or decrypting files can be

handled by PGP services. So there are many other requirements and services out there.
We are approaching a city state soon: the
re are more and more services out there
nowadays an
d the
consumers of the services
are continuing to
grow in number just as
well.


Blue Elephant League



logosworld.com




C:
\
Program Files
\
neevia.com
\
docConverterPro
\
temp
\
NVDC
\
C8C9E959
-
B032
-
4
4F8
-
BA0D
-
7224E67AA18A
\
foregoinggowpen_2789f06f
-
a76f
-
4e93
-
b510
-
f37d0a047881.docx

Erstelldatum
23.10.2008 16:11:00

Page
14

von
14

14

What is next?

In the next instalment, we shall show you a more complete scenario where we
demonstrate and explain how useful and powerful message queues

(MQ’s)

are in
practice.
It shall involve Microsoft MQ, a self
-
coded and stunning ABAP MQ, the Amazon
SQS queue service; it shall

also

show you how to use the file system and an email system
as an MQ
. The
scenario
will

shuffle data around from queue to queue

and will be
or
chestrat
ed by some BPEL utility.

Getting a SOA in place is not difficult, and this
scenario

will show just that!