In my requirement I have to generate SOAP message from a java class.
The sending portion will be handled by a framework [ our firm has a framework built over JMS], so I just need to create a message only.
//Create objects for the message parts
SOAPPart soapPart = message.getSOAPPart();
in a simple program but while running it throws the following exception
xception in thread "main" java.lang.NoClassDefFoundError: com/ibm/ws/ffdc/FFDCFilter
at javax.xml.soap.MessageFactory.newInstance(MessageFactory.java:197)
So, I am thinking I somehow am not proceeding correct.
Can anyone please provide suggestions ?
Thanks
Gaurav Purandare
Greenhorn
Joined: Apr 06, 2009
Posts: 19
posted
0
No Class Def Found Exeption usually means that the class path was not set properly,
Have you checked that all the libraries are included in classpath.
Gaurav
Atul Mishra
Ranch Hand
Joined: Jun 08, 2006
Posts: 140
posted
0
Gaurav,
First thanks for the reply.
I have the j2ee.jar added. But the complaint is about an IBM file.
My enironment is eclipse and I dont have [I dont need to have any IBM dependancy]
So thats why I am confused when it threw an IBM related exception
I want to use javax.xml.soap package.
Thanks
Atul Mishra
Ranch Hand
Joined: Jun 08, 2006
Posts: 140
posted
0
Could anyone please mention on how to generate SOAP message from a Java class.
Thanks for the suggestion, but unfortunately we wont be able to use any external APIs.
Can I achieve this by using SAAJ ?
Thanks
Ivan Krizsan
Bartender
Joined: Oct 04, 2006
Posts: 2193
posted
0
Hi!
You can use SAAJ to create and populate SOAP messages. To make life a little easier, you can use JAXB to marshal and unmarshal the contents of the SOAP body, if you want to. Both these APIs are part of the JRE 6.
The following code shows how to create SOAP messages using SAAJ:
Best wishes!
Atul Mishra
Ranch Hand
Joined: Jun 08, 2006
Posts: 140
posted
0
Thanks for the code Ivan..
Unfortunately have a 1.5 limitation..
Trying your code now.
Please suggest on additional jars needed if using 1.5
in java5, you could add two more jar files: saaj.jar, saaj-api.jar. Then use the code like below:
DocumentBuilder oBuilder = oDocFactory.newDocumentBuilder();
Document oDoc = oBuilder.parse(new File("xxx"));