Solved

Soap call exception

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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
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 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 seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

809 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