File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes webservice package javax.xml.soap does not exist Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "webservice package javax.xml.soap does not exist" Watch "webservice package javax.xml.soap does not exist" New topic
Author

webservice package javax.xml.soap does not exist

Ayyappa
Greenhorn

Joined: Dec 03, 2003
Posts: 2
Hi All and Kshola,
while complie the code Request.java
Please let me know how to set path or include some stuff is jwsdp.lib
error is
C:\Request.java:1: package javax.xml.soap does not exist
import javax.xml.soap.*;
^
C:\Request.java:8: cannot resolve symbol
symbol : class SOAPConnectionFactory
location: class Request
SOAPConnectionFactory soapConnectionFactory =
^
C:\Request.java:9: cannot resolve symbol
Program is import javax.xml.soap.*;
import java.util.*;
import java.net.URL;
public class Request {
public static void main(String[] args) {
try {
SOAPConnectionFactory soapConnectionFactory =
SOAPConnectionFactory.newInstance();
SOAPConnection connection =
soapConnectionFactory.createConnection();
SOAPFactory soapFactory =
SOAPFactory.newInstance();
MessageFactory factory =
MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
SOAPHeader header = message.getSOAPHeader();
SOAPBody body = message.getSOAPBody();
header.detachNode();
Name bodyName = soapFactory.createName(
"GetLastTradePrice", "m",
"http://wombats.ztrade.com");
SOAPBodyElement bodyElement =
body.addBodyElement(bodyName);
Name name = soapFactory.createName("symbol");
SOAPElement symbol =
bodyElement.addChildElement(name);
symbol.addTextNode("SUNW");
URL endpoint = new URL
("http://wombat.ztrade.com/quotes");
SOAPMessage response =
connection.call(message, endpoint);
connection.close();
SOAPBody soapBody = response.getSOAPBody();
Iterator iterator =
soapBody.getChildElements(bodyName);
SOAPBodyElement bodyElement =
(SOAPBodyElement)iterator.next();
String lastPrice = bodyElement.getValue();
System.out.print("The last price for SUNW is ");
System.out.println(lastPrice);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}
Pradeep bhatt
Ranch Hand

Joined: Feb 27, 2002
Posts: 8919

Please get started with Suns WS tutorial.


Groovy
somkiat puisungnoen
Ranch Hand

Joined: Jul 04, 2003
Posts: 1312
Please check CLASSPATH in system.
This error is occur when its can't find this package in classpath.
i think, it will help you.


SCJA,SCJP,SCWCD,SCBCD,SCEA I
Java Developer, Thailand
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: webservice package javax.xml.soap does not exist