Additional Blogs by Members
Showing results for 
Search instead for 
Did you mean: 
Former Member
0 Kudos

Most of interfaces in a company dealing with emails  have to have an email body together with the attachement. To accomplish this straight with an email adapter I always had to go, round about ways of manipulating the message payload using XSLT mapping or JAVA mapping . And it did work all the time . But i always wondered why can't SAP add a very simple feature in email adapter , where you can specify your file path and name  and make it easier to handle attachments.

I realised it would be easier and much reusable if i write a Java webservice with a method that can handle an email body ,  attachment path , fromaddress , toaddress , subject line etc.

The SMTP class in the inet jscape factory has some very simple methods which can be used to compose en email easily.



public void sendEmail(
        String fromAddress,
        String toAddress,
        String directory,
        String emailBody,
        String subject) {

           Smtp mail = new Smtp();
            {    File f = new File(directory);


All you have to do is to create an EJB with one method with the above lines of code .

If you create a bean using NWDS (eclipse based ) it already provides you with an easy to use webservice creation wizard . Once you create all the necessary components for the webservice build the jar file out of it .


Next you create an EAR for the JAR and deploy it on the XI server .


Now you have an email service running on your XI server , ready to use,  which can invoked within any interface in XI using a SOAP receiver communication channel .

If you login to the wsnavigator of the XI server you would be able to see it there .

There you can download the wsdl . After you download it extract the archive . Go to the folder - porttypes  .

the file you see here can be used as the webservice external definition inside XI .