Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Correcting the SAP Business Connector

by DrHyde (Prior)
on Jul 29, 2003 at 08:22 UTC ( #278765=CUFP: print w/replies, xml ) Need Help??

SAP has an "easy" to use tool called the Business Connector for querying your SAP system. You throw some XML at a URL, it does Java-ish things to poke and prod SAP, and gives you XML back. It - correctly - dies if you give it bad XML. Unfortunately, it returns broken XML itself. So I use a little shell script to fetch the data and clean it with perl. I use perl instead of sed because I also need to do a few other transformations on the data for which my sed-fu is not strong enough:

if test `curl -s -w %{http_code} -u $SAP_USER:$SAP_PASS -d $BC_XMLDAT +A -o $TEMPFILE $BC_URL` == 200 ; then echo Successfully retrieved data, now correcting it (cat $TEMPFILE && echo -n '</xml>') | perl -pne ' s/&/&amp;/g; # and a few other corrections ' > corrected.xml else echo Error fetching data from Business Connector exit 1 fi
In the long term I want to switch to using sap::rfc so I don't have to do this - and hopefully avoid all that XML nastiness.

Now I'll admit that the perl involved is utterly trivial, but I think this demonstrates just how good a "glue" perl can be for sticking other languages and software packages together. The shell script above is in fact embedded in a Makefile, and the resulting XML file is later munged with more perl.

NB, the perl code here originates with a colleague; the shell and make wrapper is mine.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: CUFP [id://278765]
Approved by ybiC
[stevieb]: Jeff Healey cut of My guitar gently weeps
[stonecolddevin]: you don't recognize Prince. Prince tells you it's him.
[erix]: Alvin Lee (Ten Years After) played a jazzguitar ("Big Red"), a good warm sound
[stonecolddevin]: I think Stevie Ray is one of maybe 2 or 3 people that could take a Hendrix song and make you go "...huh. this is close." https://open. 0UVM9trirBK5s1xBwL oVhZ
[stonecolddevin]: https://open. 0UVM9trirBK5s1xBwL oVhZ rather
[Corion]: Sadly I must go to bed now :-| See y'all!
[erix]: I really loved/love this "Recorded Live" record, 1973 (yes, I'm that old)
[stonecolddevin]: goodnight Corion
[erix]: cya Corion :)
[stevieb]: Joan Jett, Hendrix, Neil Young, Dave Keuning (The Killers)... I have my mind elsewhere so I'm limited in my capacity to think about this righ tnow ;)

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (6)
As of 2017-06-22 21:33 GMT
Find Nodes?
    Voting Booth?
    How many monitors do you use while coding?

    Results (531 votes). Check out past polls.