45

I am facing problems in invoking a method present in a web service. The wsdl was created using AXIS.

When I try to invoke it using my java code, I am getting null values from the service response.

I am getting the warning message getting printed in my console:

Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.

While trying to solve this, I added activation.jar and mail.jar in my workspace build path, restarted the server.

EDIT:

Right Click on the WSDL ==> Generate CLient

Then I got a proxy class, using it I wrote this to invoke the service method:

public class CallingWebService1 {

public static void main(String[] args) throws Exception {

    WebService1Proxy proxy1 = new WebService1Proxy();
    proxy1.setEndpoint("http://localhost:8045/WebService1/services/WebService1");

    EmployeeDetails details = proxy1.getDetails();
    System.out.println("Employee Id: " + details.getEmpId());
    System.out.println("Employee Name: " + details.getEmpName());
    System.out.println("Dept Id: " + details.getDeptId());
    System.out.println("Dept Name" + details.getDeptName());
    System.out.println("Age: " + details.getAge());
}

But still the problem persists :(

Further Info:

The getDetails() method is performing a DB operation fetching some records from the Oracle DB. For performing the DB operation, class12.jar is used. Does it have something to do with invoking the service method the way I am doing?

ROMANIA_engineer
  • 54,432
  • 29
  • 203
  • 199
user182944
  • 7,897
  • 33
  • 108
  • 174

3 Answers3

45

In order to fix the javax.activation.DataHandler issue you must add the JavaBeans Activation Framework activation.jar in your classpath.

In order to fix the javax.mail.internet.mimeMultipart issue you must add the Java Mail API mail.jar in your classpath.

The warning messages printed in your console shows that the above jars are not in the classpath.

Apostolos Emmanouilidis
  • 7,179
  • 1
  • 24
  • 35
  • I did it in my 1st attempt before posting this in the forum.please read the bottom part of my question. – user182944 Sep 01 '12 at 11:10
  • Were the warnings disappeared after including the jars in the classpath? – Apostolos Emmanouilidis Sep 01 '12 at 11:12
  • NO, adding the jars did not removed the warnings. I have edited the original post to show how i am trying to invoke the web service method. Please suggest. – user182944 Sep 01 '12 at 11:17
  • The JavaBeans activation framework is included in Java SE (since Java 6, maybe even since Java 5; not sure). – Mark Rotteveel Sep 01 '12 at 11:21
  • the jars are in my classpath........i mentioned this in my initial question several times....i checked this even before posting this question. – user182944 Sep 01 '12 at 11:34
  • 3
    @user182944, a little late to the party, but the message indicates that _at least one_ of the jars mentioned in the answer is missing, but not necessarily both. As activation is part of Java SE now, it is most likely that javax.mail is missing... – Lucas Oct 01 '13 at 20:12
  • @TolisEmmanouilidis - Does not work anymore even after adding activation.jar to the build path. Is it okay if I ignore the warning ? – Erran Morad Jun 11 '14 at 07:30
27

Only one jar (mail.jar) is enough to fix this problem. This jar should present in your class path.

MADHAIYAN M
  • 2,028
  • 25
  • 22
6

Unfortunately, wsdl is still in use:( You can solve this warn via adding dependencies below.

    <dependency>
        <groupId>javax.mail</groupId>
        <artifactId>mail</artifactId>
        <version>1.4.7</version>
    </dependency>
    <dependency>
        <groupId>javax.activation</groupId>
        <artifactId>activation</artifactId>
        <version>1.1.1</version>
    </dependency>
Gostil
  • 61
  • 1
  • 2