ok_lilya
asked on
Soap call exception
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.newI nstance();
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(
"enFilterUndeliverableEmai l", "m",
"http://localhost:9080/3m00Undel/undeliverable/EmailParser");
SOAPBodyElement gltp =
body.addBodyElement(bodyNa me);
Name name = envelope.createName("symbo l");
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(bodyNa me);
//SOAPBodyElement bodyElement =
// (SOAPBodyElement)it.next() ;
//String lastPrice = bodyElement.getValue();
System.out.print("The last price for SUNW is ");
//System.out.println(lastP rice);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
It crashes on 3rd line: SOAPConnection con = scFactory.createConnection ();
And this is the error:
java.lang.ExceptionInIniti alizerErro r: java.lang.SecurityExceptio n: Prohibited package name: java.util.logging
at java.lang.ClassLoader.defi neClass(Cl assLoader. java:676)
at java.security.SecureClassL oader.defi neClass(Se cureClassL oader.java :133)
at java.net.URLClassLoader.de fineClass( URLClassLo ader.java: 319)
at java.net.URLClassLoader.ac cess$400(U RLClassLoa der.java:9 2)
at java.net.URLClassLoader$Cl assFinder. run(URLCla ssLoader.j ava:677)
at java.security.AccessContro ller.doPri vileged(Na tive Method)
at java.net.URLClassLoader.fi ndClass(UR LClassLoad er.java:23 8)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:514)
at sun.misc.Launcher$AppClass Loader.loa dClass(Lau ncher.java :441)
at java.lang.ClassLoader.load Class(Clas sLoader.ja va:446)
at com.sun.xml.messaging.saaj .client.p2 p.HttpSOAP Connection .<clinit>( HttpSOAPCo nnection.j ava:37)
at com.sun.xml.messaging.saaj .client.p2 p.HttpSOAP Connection Factory.cr eateConnec tion(HttpS OAPConnect ionFactory .java:25)
at soapcall.SoapCall.main(Soa pCall.java :22)
Exception in thread "main"
Please help!
Thanks,
Lily
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.newI
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(
"enFilterUndeliverableEmai
"http://localhost:9080/3m00Undel/undeliverable/EmailParser");
SOAPBodyElement gltp =
body.addBodyElement(bodyNa
Name name = envelope.createName("symbo
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(bodyNa
//SOAPBodyElement bodyElement =
// (SOAPBodyElement)it.next()
//String lastPrice = bodyElement.getValue();
System.out.print("The last price for SUNW is ");
//System.out.println(lastP
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
It crashes on 3rd line: SOAPConnection con = scFactory.createConnection
And this is the error:
java.lang.ExceptionInIniti
at java.lang.ClassLoader.defi
at java.security.SecureClassL
at java.net.URLClassLoader.de
at java.net.URLClassLoader.ac
at java.net.URLClassLoader$Cl
at java.security.AccessContro
at java.net.URLClassLoader.fi
at java.lang.ClassLoader.load
at sun.misc.Launcher$AppClass
at java.lang.ClassLoader.load
at com.sun.xml.messaging.saaj
at com.sun.xml.messaging.saaj
at soapcall.SoapCall.main(Soa
Exception in thread "main"
Please help!
Thanks,
Lily
ASKER
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
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
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
https://www.experts-exchange.com/questions/20142370/Using-the-java-util-logging-package-from-JDK1-4-in-JDK1-3.html