Solved

Soap call exception

Posted on 2004-08-11
5
395 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

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
scoresIncreasing challenge 10 57
countHi challenge 25 84
word0 challenge 4 53
Java Loop 4 20
If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
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 …

762 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

20 Experts available now in Live!

Get 1:1 Help Now