2 Replies Latest reply on Nov 7, 2005 9:43 AM by 843834

    saaj - running out of ideas

      Running J2SE 1.4.2 I need to write a standalone SOAP client.

      Compiles fine, but getting lots of runtime errors. Some MessageFactory does not find some Impl class..
      I install, JAXM just to find out that now some other parts are missing.
      Can somebody please tell me what API's to install to get it to work.

      Already I have installed and my CLASSPATH is pointing to:
      saaj-api.jar(also tried with saaj-1_2-fr-api.jar (difference?)), saaj-impl.jar, mail.jar, imap.jar, mailapi.jar, pop3.jar, smtp.jar, jaxm-api.jar, jaxm-runtime.jar

      Please help.
        • 1. Re: saaj - running out of ideas
          Ok, I realize you need some more info. Here is the prog.:

          import javax.xml.parsers.*;
          import javax.xml.soap.*;

          import org.xml.sax.*;

          import java.io.*;

          import org.w3c.dom.Document;

          import java.net.*;

          public class Testsoap {
          public static void main(String argv[]){

          Document document=null;

          MessageFactory msgFactory=null;
          SOAPMessage soapMessage=null;
          SOAPBody soapBody=null;
          SOAPConnectionFactory soapConnFactory=null;
          SOAPConnection soapConn=null;
          URL servicePoint= null;

          DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
          try {
          DocumentBuilder builder = factory.newDocumentBuilder();
          document = builder.parse( new File("xml.txt") );

          msgFactory = MessageFactory.newInstance();

          soapMessage = msgFactory.createMessage();

          soapBody = soapMessage.getSOAPBody();

          soapConnFactory = SOAPConnectionFactory.newInstance();
          soapConn = soapConnFactory.createConnection();

          servicePoint = new URL("http://v.europeiske.no/Services/EurowizSale.asmx");
          soapConn.call(soapMessage, servicePoint);

          catch (SAXParseException spe) {
          // Error generated by the parser
          System.out.println("\n** Parsing error"
                    + ", line " + spe.getLineNumber()
                    + ", uri " + spe.getSystemId());
          System.out.println(" " + spe.getMessage() );

          // Use the contained exception, if any
          Exception x = spe;
          if (spe.getException() != null)
          x = spe.getException();

          catch (Exception e) {
          } // main


          Compiles just fine, but I get the following runtime error:
          javax.xml.soap.SOAPException: Unable to create message factory for SOAP: Provider com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl not found

          I expand my CLASSPATH to be:

          Now I get the following runtime error:
          Exception in thread "main" java.lang.NoClassDefFoundError: javax/mail/internet/ParseException
               at java.lang.Class.getDeclaredConstructors0(Native Method)
               at java.lang.Class.privateGetDeclaredConstructors(Class.java:1610)
               at java.lang.Class.getConstructor0(Class.java:1922)
               at java.lang.Class.newInstance0(Class.java:278)
               at java.lang.Class.newInstance(Class.java:261)
               at javax.xml.soap.FactoryFinder.newInstance(Unknown Source)
               at javax.xml.soap.FactoryFinder.find(Unknown Source)
               at javax.xml.soap.MessageFactory.newInstance(Unknown Source)
               at Testsoap.main(Testsoap.java:31)

          Well, I dont give up. I download JavaMail and extend my CLASSPATH again which by now looks like:

          Another runtime error stops the show:

          Exception in thread "main" java.lang.NoClassDefFoundError: javax/activation/DataSource
               at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl.createMessage(SOAPMessageFactory1_1Impl.java:27)
               at Testsoap.main(Testsoap.java:33)

          And now I give up..............

          Can someone please tell me what API's to use??

          Thanks in advance
          • 2. Re: saaj - running out of ideas
            This is the classpath I used for my stand-alone web service client. There might be some extras in there but they don't seem to do any harm: