Skip to Content
Author's profile photo Michal Krawczyk

Michal’s PI tips: Exchange Rates from an XML file on a web page – REST, AXIS

One, quite common requirement on the PI forum has always been a getting an XML file from a web page (in most cases with exchange rates but it can be any other XML file of course). Solution to this issue was in most cases:

– building a java proxy which had to be called inside a ccBPM from a scheduled sender adapter.

– using an external tool (script) – as shown in my other article – PI/XI: how to get an XML file from a web page without own development

Both approaches required either additional development or using some non PI tools – so not very clean. I’ve started wondering if there’s anything else that we could use. It seems that the very old AXIS adapter (available as of XI 3.0) can greatly help in this case.

SOAP sender adapter allows using AXIS extensions and one of the task classes HTTPGetter allows getting an XML file from a URL. In the example below I’m showing how to get the XML file with exchange rates from a web page using a scheduled Axis task.

XML file with exchange rates from http://www.voip.ms/rates/xmlapi.php?dest=United%20States%

What you need to do is to specify:

a) task class,

b) URL (and authentication if exists)

c) interval im miliseconds which will be used to pool the XML file (so once a day for example)

One parameter you need to set for the static URL is the enableREST parameter – you need to set it to true. This will allow proper creation of the PI message from the XML file.

Please have a look at the screenshot below:

And that’s it – there is nothing more you need to do apart from a standard PI flow development.

 

Possible extensions:

Sometimes it’s required to call a sync WS to get a message and there is no special request message for that WS. In such a case the same class (or extension to this class) can be used to do the same thing and you don’t need to use external tools or build special java proxies for such purposes.

 

Please let me know if anyone has already been using this method.

Assigned tags

      60 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member
      Hi Michal,

      I have tested this feature last year on PI 7.11 SP03 but an unsuccessful attempt.

      Get to know, this is supported for PI 7.1 Ehp1 only from SP06 onwards. Source:SAP & Note-1448849.

      It will be nice to have, if you can update PI version with SP patch level information on which it has been successfully tested from your side.

      Thanks,
      Anoop

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author
      hi Anoop,

      thank you for the note but it does not say anything about EhP1 for 7.1 as there are also patches for PI 7.0 so it should work with 7.0

      also the idea is not only to show that the standard task works but that you can use Axis to implement similar things (using own task classes)
      but more on that soon 🙂

      Thank you for the comment,

      Regards,
      Michal Krawczyk

      Author's profile photo Former Member
      Former Member

      My Scenario is to call a rest service, iam using SOAP(Axis) as sender to get the details from the rest service and update in Z table.

      I did the same config as shown in the blog, it seems that the channel is not doing anything.

      Is there any additional config to be done inorder the channel to work. We are on SAP PI 7.1 EHP1.

      Thanks

      Srini

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author

      Hi,

      no there is no additional config which needs to be done - only the one from the blog

      Regards,

      Michal Krawczyk

      Author's profile photo Former Member
      Former Member

      Yes I am getting the same error. 😕 . It is does not throw any proper error nor picks up any data from the site.

      Regards

      Sreeram

      Author's profile photo Former Member
      Former Member

      This is a great feature you highlighted Michal!

      Do you know how to find more information on the Task Class options? (e.g. HTTPGetter and enableREST parameter in your case)

      I would like to schedule a polling interval just like this but against a SOAP based web service instead of a simple URL which generates an XML file. I need to pass a <ws: parameter to the web service function to get my XML back. I read help on this but I need more detailed documentation on the Connection Parameters options for the SOAP Axis Task.

      http://help.sap.com/saphelp_nwpi71/helpdata/en/45/a39e244b030063e10000000a11466f/frameset.htm

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author

      Hi,

      >>>Do you know how to find more information on the Task Class options? (e.g. HTTPGetter and enableREST parameter in your case)

      yes 🙂 just decompile and check - this is that I did 😉

      >>>SOAP based web service instead of a simple URL which generates an XML file.

      this is pretty easy - you just need to copy the standard class and change it accordingly and you're done - it's pretty easy with Axis

      Regards,

      Michal Krawczyk

      Author's profile photo Former Member
      Former Member

      Thanks again for the advice. I'm having some trouble getting this basic AXIS scenario going. If you have ideas can you please respond to this forum question?

      http://scn.sap.com/thread/3160126

      Author's profile photo Former Member
      Former Member

      Hi Michal,

      Do you know what Jar the HTTPGetter class resides in? Our Basis team has installed Axis, we see the HTTPSender class and many others living in the Jar files. However, HTTPGetter class is not anywhere to be found!

      Many thanks for any advice on this.

      -Aaron

      Author's profile photo Former Member
      Former Member

      Sorry, our version of PI service packs was not high enough to use this feature. Although the AXIS protocol/driver option for SOAP has been around for some time, for the HTTPGetter class we must have at least PI 7.11 EHP1 SP6 loaded and we are only at SP3.

      Author's profile photo Former Member
      Former Member

      Hi Michael,

      I implemented just like what you mentioned above.

      My requirement is as per this thread -> http://scn.sap.com/message/13255135

      Sender channel created does not pick exchnage rate from the URL.

      Can you please suggest solution.

      Thanks & Regards,

      Vishal K

      Author's profile photo Former Member
      Former Member

      Hi Michael,

      I have a requirement on similar lines. I have a website, which wants data out of ECC. The request from the website is a URL https://abc.com/custid=xyz.  The custid field is dynamic, and would change with every call.  There  is no payload in the inbound http request.  The output is an XML response, based on the custid field

      Can the above solution be used for that,  or we need to implement it as a rest service in ECC ( via SICF handlers)

      Any help would be appreciated.

      Regards,

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author

      Hi,

      the solution above can be used for static calls (there's not preceeding call as you see)

      but you can also use AXIS adapter to call rest services in the receiver adapter

      Regards,

      Michal Krawczyk

      Author's profile photo Former Member
      Former Member

      I added this on SAP Idea Place. If you like the idea of a scheduled or polling SOAP Sender (without installing Axis), please go there and vote.

      https://cw.sdn.sap.com/cw/ideas/12158

      Thanks again Michal for the great blogs and forum contributions.

      Author's profile photo Juergen Grallert
      Juergen Grallert

      Hi Michal,

      we're on PI 7.11 SP10 and I've to implement a scenario for polling exchange rates from the web page of the ecb. I was glad to find your blog and did exactly what you describe.

      But when starting the channel, it's doing nothing but also no error message. So I restarted the channel and used the XPI Inspector for logging. In the trace, I've found the following entry: 

      ~XISOAPAdapterPool.notifyAxisAdapter axis adapter manager is inactive

      Do you have any idea what could be the issue? We have never used Axis before, so could it be that we need to install anything before?

      I've also checked the JAR file which Aaron mention above and the HTTPGetter is available.

      Many thanks for any advice in advance!

      Juergen

      Author's profile photo Former Member
      Former Member

      Hi Juergen,

      Did you try to verify your Axis installation by going to:

      http://[your pi server]:[your port]/XIAxisAdapter/MessageServlet

      Also, there are some SAP notes on this Axis setup.

      Author's profile photo Juergen Grallert
      Juergen Grallert

      Hi Aaron,

      thank you for your comment. I've tried the Test-URL before, but always got an error message.

      In the meanwhile I've found the information, that I need to create the ...axisprovider.sda file first, according to help.sap.com.

      After deploying, the channel is polling working fine.

      Thank you,

      Juergen

      Author's profile photo Former Member
      Former Member

      Hi !

      I have a problem that I used your blog for my schenario.

      But I have a problem that about coming XML encoding type.

      For example :

      from PI payload : <Type>��zel</Type>

      true form:<Typezel</Type>

      How can I change encoding type?

      All of configuration same with you.

      Hatice ÖZBEK


      Author's profile photo Former Member
      Former Member

      changing encoding/codepage : use

      TextCodepageConversionBean

      Author's profile photo Former Member
      Former Member

      Thanks Vishal;

      But problem not solved.

      I added AF_Modules/TextCodepageConversionBean Conversion.charset utf-8 before call sap adapter.

      But I wrote the file also same encoding.

      I saw �� when Turkish characters were came.

      Hatice ÖZBEK

      Author's profile photo Former Member
      Former Member

      Hi, Ozbek.

      Did you resolve this? I`ve faced with same problem.

      Regards, Sergey.

      Author's profile photo Former Member
      Former Member

      Hi Juergen,

      Can you give me some more details concerning the resolution of your issue ? I do have exactly the same issue : configured as Michael's blog, channel is in "started" status in CC monitoring but nothing is polling.  PI 7.11 SP06. I have deployed the axis librairies, mandatory components are OK.

      Many Thanks,

      Guislain

      Author's profile photo Juergen Grallert
      Juergen Grallert

      Hi Guislain,

      my issue was, that I didn't deploy the axis installation before. If you have done this and the check with URL http://<host>:<port>/XIAxisAdapter/MessageServlet is successful, then there seems to be a different issue.

      Any further information in the XPI Inspector?


      Kind regards,

      Juergen

      Author's profile photo Former Member
      Former Member

      Hi Juergen,

      Actualy I found where the issue comes from : I redeployed the axis librairies, but I also removed the * in the PARTY field of my Communication Channel, it seems that it does not work with that character.

      Thanks for your quick reply,

      Guislain

      Author's profile photo Neha Verma
      Neha Verma

      Hi,

      Can you please let me know where i can check if Axis Adapter Manager is active or not?

      Thanks

      neha

      Author's profile photo S Kumar
      S Kumar

      Hi Experts,

      I got to know from above blog that HTTPGetter class can work only above SP6 for SAP PI 7.1. So, could you please confirm if HTTPGetter class can work for SAP PI 7.31 SP 3.

      Thanks,

      Kumar

      Author's profile photo M. J. M. Cornelissen
      M. J. M. Cornelissen

      Hi Michal,

      For the HTTPGetter to go outside the network, it needs to use the network-proxy. Does it support that? And if so, how to configure proxy address and portnumber?

      Thanks for your help.

      Michel

      Author's profile photo Michal Krawczyk
      Michal Krawczyk
      Blog Post Author

      hi Michel,

      no idea to be honest if this is supported (I'd need to check the available parameters but as far as I remember I didn't see anything like this) but as it's a simple class you can always add proxy support I guess, 

      Regards,

      Michal Krawczyk

      Author's profile photo Former Member
      Former Member

      Hi Michel!

      Please, check note 1788595. Also keep in mind, that there is an issue with proxy authentication described in note 1884289.

      Regards, Sergey.

      Author's profile photo Former Member
      Former Member

      Great blog!

      This will come in handy for an upcoming flow at my current customer! Just wish I had learned about this a few years earlier! 😉

      Author's profile photo Former Member
      Former Member

      Nice Blog as usual

      Author's profile photo Former Member
      Former Member

      Hi all.

      Does anybody know, is it possible to get zipped xml via HTTPGetter? For example, zipped xml file.xml.gz ?

      It seems like HTTPGetter tries to parse file as is, that causes the error like An invalid XML character (Unicode: 0x1f) was found in the element content of the document.

      Best regards,

      Sergey.

      Author's profile photo Leonardo Rodrigues Lemos
      Leonardo Rodrigues Lemos

      Hi Sergey,

      I have the same problem. Did you solve?

      I'm trying to get this file : http://www.fazenda.rj.gov.br/portal/rjcontrib.zip

             SAP PI 7.31 SP12

      Regards

      Leonardo Lemos

      Author's profile photo Former Member
      Former Member

      I have the same problem while downloading the ZIP file from a URL.

      Any idea how to fix it.

      Author's profile photo Leonardo Rodrigues Lemos
      Leonardo Rodrigues Lemos

      try this SAP Note : 2346990

      Author's profile photo Former Member
      Former Member

      Hi Michael,

      I configured the scenario as you described in the blog, But my data is not XML, it is in text format in the webpage.

      I got the following error in the communication channel, do you have any idea about this error?

      error during receive: class org.apache.axis.message.Text:library:com.sap.aii.af.axisproviderlib@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@2a859dc9@alive incompatible with class org.apache.axis.message.SOAPBodyElement:library:com.sap.aii.af.axisproviderlib@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@2a859dc9@alive; nested exception is: java.lang.ClassCastException: class org.apache.axis.message.Text:library:com.sap.aii.af.axisproviderlib@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@2a859dc9@alive incompatible with class org.apache.axis.message.SOAPBodyElement:library:com.sap.aii.af.axisproviderlib@com.sap.engine.boot.loader.ResourceMultiParentClassLoader@2a859dc9@alive

      Author's profile photo Former Member
      Former Member

      hi Srinivas,

      I have a similar requirement to download a flat file from a website. from the website URL, manually i need to input a date to extract a file which is a flat file. The website not reachable through FTP/FTPS and no web service option available.Does anything of this sort acheivable in PI? and How?

      putting here as found your comment, close to the requirement.

      Thanks

      Pradeep

      Author's profile photo Roberto Cantero
      Roberto Cantero

      Hi experts,

      How can I see active tasks? I trying create an SOAP Axis and looks something is worng:

      SOAPAxis.PNG

      Channel error: "Adapter has not provided any status information about this channel"

      Thanks in advance,

      Roberto.

      Author's profile photo S Kumar
      S Kumar

      Hi Roberto,

      I am also facing same issue. Did you get any solution for this.

      Thansk,

      Kumar

      Author's profile photo Roberto Cantero
      Roberto Cantero

      We decided  upgrate to PI 7.31 SP09 and errors disappears!

      Author's profile photo Former Member
      Former Member

      I am getting an error in Channel Monitoring which says "Scanner State 24 Not Recognized " .

      Can anyone help me with this error ?

      Author's profile photo Roberto Cantero
      Roberto Cantero

      No idea about the error but there is an standard program in SAP to do it directly:Update Foriegn Exchange Rates from Internet on daily basis

      you just need to create a RFC connection and open connectivity from ECC to ECB webpage.

      I hope it help you.

      Roberto.

      Author's profile photo Monikandan Panneerselvam
      Monikandan Panneerselvam
      Author's profile photo Former Member
      Former Member

      Hello Michael,

      I configured this scenario, but the chanel return the error above:

      "error during receive: (406)Not Acceptable"

      can you help me?

      tks

      João Dovigo

      Author's profile photo pavan thiruveedula
      pavan thiruveedula

      Hi Michael,

      Nice blog, I have a requirement where i need to connect to my target application using restful web services( It is a synchronous interface).

      Is it possible to use SOAP axis adapter for my scenario? If yes, please provide some inputs.

      Author's profile photo Former Member
      Former Member

      Hi Michael

      Can we use the http_aee adapter with get method for the same requirement?

      please suggest if my understanding is correct

      Regards

      sandeep

      Author's profile photo Neha Verma
      Neha Verma

      Hi All,

      I have followed this blog and configured Sender Axis adapter.

      My scenario is to pull XML file from a URL which is of a RESTful Webservice API. I have deployed required AXIS components and all is in OK status now.

      MY PI version is 7.3 SP 5 and Axis adapter m using is 1.4.

      Now, the adapter is not polling anything nor giving any error. PFB the screenshot.

      Can anyone let me know how to troubleshoot it further and make the channel poll.

      Thanks

      Neha Verma

      Author's profile photo Rashmi Joshi
      Rashmi Joshi

      Hi Michal,

      While trying the sender soap axis channel, I am getting communication channel status in error -

      Adapter has not provided any status information about this channel

      Do we need to install axis jar files for using this?

      Currently we do not have axis jar files deployed on PI server -

      Axis Adapter Message Servlet

      Component Versions

      Adapter Common Library Version: 1.7.3114.20141031130932.0000, NW731EXT_14_REL (2014-11-14T22:56:57+0000)
      Adapter Application Version: 1.7.3114.20141031130932.0000, NW731EXT_14_REL (2014-11-14T22:57:38+0000)
      Axis Version: ???

      Required Components

      • Apache-Axis
        Error: required component missing --- looking for org.apache.axis.AxisEngine in com.sap.aii.af.axisproviderlib/axis.jar; see http://ws.apache.org/axis/
      • Jakarta-Commons Discovery
        Error: required component missing --- looking for org.apache.commons.discovery.Resource in com.sap.aii.af.axisproviderlib/commons-discovery.jar; see http://jakarta.apache.org/commons/discovery/
      • Jakarta-Commons Logging
        Error: required component missing --- looking for org.apache.commons.logging.Log in com.sap.aii.af.axisproviderlib/commons-logging.jar; see http://jakarta.apache.org/commons/logging/

      Number of Missing Components: 3
      Status: Error



      BR,

      Rashmi


      Author's profile photo Maheswarareddy Konda
      Maheswarareddy Konda

      Hi Rashmi,

      irrespective of Axis sender or receiver , we need to deploy those jar in our server.

      those missing three has to be installed.once you deply those you can see status OK.

      Author's profile photo Rashmi Joshi
      Rashmi Joshi

      Hi Konda,

      Thanks for your reply.

      Where can I get these jar files from?

      BR,

      Rashmi

      Author's profile photo Maheswarareddy Konda
      Maheswarareddy Konda

      you can refer this link , here explained where you should and how deploy

      Building Axis Framework Package

      hit: once you open specific jar path, u could see many Zip files ,  you have to download something like below name from each path 🙂

      axis-src-1_4.zip

      Note: dont forget to convert all zip files(i mean your case three zip files) in to single SDA file(explained same blog)

      Author's profile photo Rashmi Joshi
      Rashmi Joshi

      Can you please guide me where to find these jar files from ZIP folders?

      I have downloaded

      1. axis-src-1_4.zip

      2. commons-discovery-0.4.zip

      3. commons-logging-1.1.3-src.zip

      I extracted these folders but couldnt find jar files in axis-src-1_4.zip.

      BR,

      Rashmi

      Author's profile photo Khaja Sk
      Khaja Sk

      hi,

      Once I do all development, This Sender channel not triggering or not pulling data from REST web service, it is not showing error not pulling data. How to trigger this?

      i set interval =300 also

      quality of service = exactly once.

      regards,

      Khaja.

      Author's profile photo Antony FERMINUS
      Antony FERMINUS

      Hi Michel,

      Thanks for the blog.

      I tried the Soap to file configuration.

      There are no errors but nothing happens. The soap should pull the result to the ftp location as result file.

      I am using PO 7.4.

      Michal's PI tips: Exchange Rates from an XML file on a web page - REST, AXIS

      Pulling Data From Webservice using Sender SOAP Adapter with AXIS protocol

      Could you give some hint where can it go wrong.

      Thanks in advance.

      Regards,

      Antony.

      Author's profile photo Former Member
      Former Member

      Hi Michael,

      Thanks for this great blog, but I am trying to download the ZIP file from a URL and its giving a error.

      So probably we need to change class. Any idea to reslove it quick.

      An invalid XML character (Unicode: 0x3) was found in the element content of the document.

      Author's profile photo Miguel Garcia Velasco
      Miguel Garcia Velasco

      Please check this note:

      2346990 - Error in Axis HTTPGetter task for binary data responses

      Regards.

      Author's profile photo Former Member
      Former Member

      Hi

      I know this is a very old post, but I will comment anyway for those who do not know.

      With the REST adapter (at least the version in 7.5) it is now possible to poll http url for xml content without use of axis or any other stuff than the REST adapter itself.

      Author's profile photo Former Member
      Former Member

      Hey Michael I have a requirement to call another web-service using SOAP AXIS(Task) sender similar to what you have said in your possible extenstions. I used your blog and the call is made to the other webservice however the service is failing as it is expecting an XML payload. Do you have any idea how to achieve this? 

      Author's profile photo Aprajita Pandey
      Aprajita Pandey

      Hey Michael,

       

      I have a requirement to expose a CRM SOAP service to Portal. But Portal can not connect to SAP PI system and wishes that PI pulls the request from Portal. Currently we are on SAP PI 7.4 SP 8 dual stack. Can this solution be used, if so how? Also, if you could suggest any other solution it would be great.

      Author's profile photo Philipp Balasch
      Philipp Balasch

      Hi,

      Thank you for this blog post. It has been really helpful. It took me a while to figure out that the Service Interface needs to use Interface Pattern “Stateless (XI30-Compatible).

      The error thrown was: InterfaceDetermination did not yield any actual interface.