Java Proxy WebDAV client for SAP PI

Hello everybody. Few weeks ago I was looking how I can connect SAP XI/PI with WebDAV server. I found a lot of posts where people ask how to work with WebDAV, however I didn’t find any ready to use solutions, only suggestion that the best solution is the Java Proxy. From my work experience, I know that Java coding is not a strong side of many XI/PI consultants. That’s why I am writing this post how to make a simple WebDAV client.

First, I choose Java library for WebDAV. I choose Sardine (the library and it’s description you can find here), because this library looks pretty simple and it can do everything I need. In addition, it’s better to download other necessary libraries now:

The second step, I created Outbound Synchronous Service Interface. It is universal, so I can use it for any WebDAV actions. For Request and Response I’ve used the same structure, however I’ve used different Message Type names. My Data Type looks like that (the Message Element contains the message which should be received/sent):

The third step, open NWDS and create EJB Project. In this project you should add EAR file.

The next step is open Enterprise Service Browser Perspective (Window/Open Perspective) , log in to the SAP XI/PI system and Generate JavaBean Skeleton.

And the final step is adding libraries into the project and writing code:

The main class SardineClient in sardineclient package (it takes message and does the action which was set in the response:

The SAXHandler_4_Get class in sardineclient package (I use for Get action, in other words my program reads XML from a WebDAV server using this class, so it’s just an example how to make your own class):