Solved

Soap call exception

Posted on 2004-08-11
5
430 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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.
Whether you’re a college noob or a soon-to-be pro, these tips are sure to help you in your journey to becoming a programming ninja and stand out from the crowd.
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…
Progress

691 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