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.
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.
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.
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,
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.
no there is no additional config which needs to be done - only the one from the blog
Yes I am getting the same error. 😕 . It is does not throw any proper error nor picks up any data from the site.
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.
>>>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
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?
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.
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.
I implemented just like what you mentioned above.
My requirement is as per this thread ->
Sender channel created does not pick exchnage rate from the URL.
Can you please suggest solution.
Thanks & Regards,
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.
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
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.
Thanks again Michal for the great blogs and forum contributions.
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!
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.
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.
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>
How can I change encoding type?
All of configuration same with you.
changing encoding/codepage : use
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.
Did you resolve this? I`ve faced with same problem.
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.
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?
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,
Can you please let me know where i can check if Axis Adapter Manager is active or not?
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.
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.
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,
Please, check note 1788595. Also keep in mind, that there is an issue with proxy authentication described in note 1884289.
This will come in handy for an upcoming flow at my current customer! Just wish I had learned about this a few years earlier! 😉
Nice Blog as usual
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.
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
I have the same problem while downloading the ZIP file from a URL.
Any idea how to fix it.
try this SAP Note : 2346990
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:email@example.com.ResourceMultiParentClassLoader@2a859dc9@alive incompatible with class org.apache.axis.message.SOAPBodyElement:library:firstname.lastname@example.org.ResourceMultiParentClassLoader@2a859dc9@alive; nested exception is: java.lang.ClassCastException: class org.apache.axis.message.Text:library:email@example.com.ResourceMultiParentClassLoader@2a859dc9@alive incompatible with class org.apache.axis.message.SOAPBodyElement:library:firstname.lastname@example.org.ResourceMultiParentClassLoader@2a859dc9@alive
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.
How can I see active tasks? I trying create an SOAP Axis and looks something is worng:
Channel error: "Adapter has not provided any status information about this channel"
Thanks in advance,
I am also facing same issue. Did you get any solution for this.
We decided upgrate to PI 7.31 SP09 and errors disappears!
I am getting an error in Channel Monitoring which says "Scanner State 24 Not Recognized " .
Can anyone help me with this error ?
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.
Kindly refer the below blog
I configured this scenario, but the chanel return the error above:
"error during receive: (406)Not Acceptable"
can you help me?
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.
Can we use the http_aee adapter with get method for the same requirement?
please suggest if my understanding is correct
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.
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
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: ???
Error: required component missing --- looking for org.apache.axis.AxisEngine in com.sap.aii.af.axisproviderlib/axis.jar; see http://ws.apache.org/axis/
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/
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
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.
Thanks for your reply.
Where can I get these jar files from?
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 🙂
Note: dont forget to convert all zip files(i mean your case three zip files) in to single SDA file(explained same blog)
Can you please guide me where to find these jar files from ZIP folders?
I have downloaded
I extracted these folders but couldnt find jar files in axis-src-1_4.zip.
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.
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.
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.
Please check this note:
2346990 - Error in Axis HTTPGetter task for binary data responses
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.
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?
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.
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.