Solved

Soap call exception

Posted on 2004-08-11
5
399 Views
Last Modified: 2012-08-14
Hi,

I'm trying to create a simple client to make a soap call to Websphere 5 server.
Here is my code:

package soapcall;

import javax.xml.soap.*;
import java.util.*;
import java.net.URL;

public class SoapCall {
      
  public static void main(String[] args)  {
    try {
      SOAPConnectionFactory scFactory =
          SOAPConnectionFactory.newInstance();
      SOAPConnection con = scFactory.createConnection();

      MessageFactory factory =
          MessageFactory.newInstance();
      SOAPMessage message = factory.createMessage();
 
      SOAPPart soapPart = message.getSOAPPart();
      SOAPEnvelope envelope = soapPart.getEnvelope();
      SOAPHeader header = envelope.getHeader();
      SOAPBody body = envelope.getBody();
      header.detachNode();
 
      Name bodyName = envelope.createName(
              "enFilterUndeliverableEmail", "m",
              "http://localhost:9080/3m00Undel/undeliverable/EmailParser");
      SOAPBodyElement gltp =
              body.addBodyElement(bodyName);
 
      Name name = envelope.createName("symbol");
      SOAPElement symbol = gltp.addChildElement(name);
      symbol.addTextNode("SUNW");
 
      URL endpoint = new URL
                ("http://localhost:9080/3m00Undel/undeliverable/EmailParser");
      SOAPMessage response = con.call(message, endpoint);
 
      con.close();
 
      SOAPPart sp = response.getSOAPPart();
      SOAPEnvelope se = sp.getEnvelope();
      SOAPBody sb = se.getBody();
 
      //Iterator it = sb.getChildElements(bodyName);
      //SOAPBodyElement bodyElement =
        //      (SOAPBodyElement)it.next();
      //String lastPrice = bodyElement.getValue();
 
      System.out.print("The last price for SUNW is ");
      //System.out.println(lastPrice);
 
    } catch (Exception ex) {
      ex.printStackTrace();
    }
  }
}

It crashes on 3rd line: SOAPConnection con = scFactory.createConnection();
And this is the error:
java.lang.ExceptionInInitializerError: java.lang.SecurityException: Prohibited package name: java.util.logging
      at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
      at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:133)
      at java.net.URLClassLoader.defineClass(URLClassLoader.java:319)
      at java.net.URLClassLoader.access$400(URLClassLoader.java:92)
      at java.net.URLClassLoader$ClassFinder.run(URLClassLoader.java:677)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(URLClassLoader.java:238)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:514)
      at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:441)
      at java.lang.ClassLoader.loadClass(ClassLoader.java:446)
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.<clinit>(HttpSOAPConnection.java:37)
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnectionFactory.createConnection(HttpSOAPConnectionFactory.java:25)
      at soapcall.SoapCall.main(SoapCall.java:22)
Exception in thread "main"

Please help!

Thanks,

Lily



0
Comment
Question by:ok_lilya
5 Comments
 
LVL 3

Expert Comment

by:Belthazor
ID: 11783101
0
 

Author Comment

by:ok_lilya
ID: 11783978
Hi,

The solution that they are describing is "This is a security thing. You just arent allowed to put classes in the java.* package. This is to prevent "fake" classes."
However, I'm not putting any classes in the java.*package. All I'm trying to do is create a soap call. I read instruction on some of the websites that listed all the jars that are needed and I have all of them:
commons-logging.jar
mail.jar
activation.jar
xercesImpl.jar
dom.jar
sax.jar
xalan.jar
rt.jar
saaj-api.jar
saaj-impl.jar

All I'm trying to do is to run that program to make a soap call. But it crashes at the second line. (The program that I'm using is mentioned in the previous message) I'm really lost as to what I should do about this problem.

Thanks,

Lily
0
 
LVL 1

Accepted Solution

by:
zeus_akkali earned 500 total points
ID: 11793991
The problem could be that these jars could be compiled in JDK1.4. Usually all providers like apache , sourceforge provide two sets of sources one for pre jdk1.4 and one for before. What you want to do is to use the same set of jars. Ones that has been compiled with jdk 1.3 and your code also in jdk1.3 , or else both in jdk1.4

Hope it helps.

-Zeus
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
bunnyEars challenge 6 100
recursion example 16 111
Plain Text Editor for iPad 6 59
"Black Box" Testing of Control System Software 2 22
Displaying an arrayList in a listView using the default adapter is rarely the best solution. To get full control of your display data, and to be able to refresh it after editing, requires the use of a custom adapter.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

911 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now