troubleshooting Question

Java - Spring Web Service : cannot find the file

Avatar of myjobiscoding
myjobiscoding asked on
Programming Languages-OtherJava
38 Comments1 Solution6482 ViewsLast Modified:
This is my first program to  use Spring. My program is to make a Web Service call over JMS. I have learnt from the following link

http://static.springsource.org/spring-ws/site/reference/html/client.html

but I have encountered the following error and a question myself
I have got the following error:
1. parsing XML document from class path resource [try.xml]; nested exception is java.io.FileNotFoundException:
   class path resource [try.xml] cannot be opened because it does not exist
2. http://localhost:8080/AnotherWebService <== Is this a Web Service Call. For example, I want to make web service call "EnrolStudent" over jms
   Should I put http://xmlns.oracle.com/ui/studentmanagement/EnrolStudent

===========================================================================
public class WebServiceClient  {
    private static final String MESSAGE = "<message xmlns=\"http://tempuri.org\">Hello Web Service World</message>";
    private final WebServiceTemplate webServiceTemplate = new WebServiceTemplate();
    private static final void loadConfig() {
          ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("try.xml");
          context.refresh();
    }
    public void setDefaultUri(String defaultUri) {
        webServiceTemplate.setDefaultUri(defaultUri);
    }
    // send to an explicit URI
    public void customSendAndReceive(String requestXML) {
          StreamSource source = new StreamSource(new StringReader(requestXML));
        StreamResult result = new StreamResult(System.out);
        webServiceTemplate.sendSourceAndReceiveToResult("http://localhost:8080/AnotherWebService", source, result);
    }
   
    public static void main(String[] args) {              
          WebServiceClient webServiceClient = new WebServiceClient();
          loadConfig();
        try {
              webServiceClient.customSendAndReceive(MESSAGE);
        } catch (Exception ex) {
            ex.printStackTrace();
        }
    }  
}
=========================================================================
ASKER CERTIFIED SOLUTION
mccarl
IT Business Systems Analyst / Software Developer
Join our community to see this answer!
Unlock 1 Answer and 38 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 38 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros