• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ayyappa1

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,
When iam trying the java program which includes import javax.xml.soap.*;
when I am trying to compile I am getting error at javac Request.java
I also have jwsdp 1.3
How to solve this problem.
Thaks.
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
^
code 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();
}
}
}
 
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Obviously, you're missing something from your classpath. You should just include everything in the JWSDP's lib directory.
Also, "nknknknkn nkafnkfnfs" is definitely not in compliance with our naming policy so you'll need to change it into something compliant. Who knows, you just might win a web services book by doing just that
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Furthermore, a topic titled "ayyappa1" is a very efficient help repellent around here. It has pretty much the same effect on anyone browsing the forum as putting "URgENT!!!" (note the capital letters and a number of exclamation marks) in the post title...
 
Lasse Koskela
author
Posts: 11962
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry to bother you again, but our naming policy clearly states that both a first name (or initials) and a last name is required for a display name.
reply
    Bookmark Topic Watch Topic
  • New Topic