wood burning stoves 2.0*
The moose likes Web Services Certification (SCDJWS/OCEJWSD) and the fly likes Cant find the correct SOAPMessage  class for SAAJ eg. RMH Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Services Certification (SCDJWS/OCEJWSD)
Bookmark "Cant find the correct SOAPMessage  class for SAAJ eg. RMH" Watch "Cant find the correct SOAPMessage  class for SAAJ eg. RMH" New topic

Cant find the correct SOAPMessage class for SAAJ eg. RMH

Dhiren Joshi
Ranch Hand

Joined: Dec 09, 2003
Posts: 463
Hi ,
I have this piece of code snippet of SAAJ example from RMH
MessageFactory msgFactory =MessageFactory.newInstance();
SOAPMessage message = msgFactory.createMessage();
SOAPBody body=message.getSOAPPart();
SOAPElement getBookPrice=body.addChildElement("getBookPrice","mh","http:/www.Monson-Hafel.com/jwsbook/BookQuote");

Oddly enough the webservice developer pack 1.3 whihc I have doesnt give me support for this API.
SOAPMessage message = msgFactory.createMessage();
// I cant do message.getSOAPHeader() as that API call is not there .

My SOAPMessage class doesnt have this method call . getSOAPHeader()
Can anyone tell me how to fix this problem.
I semed to have the wrong jar file somehow.

I have all these files in the classpath

Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3199

here is reduced code of SOAPMessage class:

as you can see - there is "getSOAPHeader" method there

another approach -


more details about SAAJ API - here


Free SCDJWS 5.0 Study Guide - SCDJWS 5.0 Quiz (How to get SCDJWS 5.0 Quiz)
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz
Dhiren Joshi
Ranch Hand

Joined: Dec 09, 2003
Posts: 463
Yeah .. That is the issue .
I looked in SAAJ API its there but in my WSAD .It doesnt show up .
getSOAPHeader() method is not there.
And if I add that call to SOAPMessage I get a broken compile showing .
So somehow I have the incorrect jar file.

Any one can help.
Richard Monson-Haefel
Ranch Hand

Joined: Oct 31, 2003
Posts: 92
JWSDP 1.3 uses SAAJ 1.1 while J2EE 1.4 uses SAAJ 1.2. SAAJ 1.2 added the methods in question. In other words, they are defined in SAAJ 1.2 but not SAAJ 1.1. Since you are supposed to know SAAJ 1.2, you should not continue to study the SAAJ 1.1 API in JWSDP 1.3 - why aren't you working with the J2EE 1.4 SDK? (Actually I find that SDK very difficult to work with so there is really no mystery there. ;-)

-- <br />Richard Monson-Haefel<br /><a href="http://www.Monson-Haefel.com" target="_blank" rel="nofollow">http://www.Monson-Haefel.com</a>
matt tee

Joined: Jun 25, 2004
Posts: 2
Sorry to bump this thread but I am getting the same error. I have updated to SaaJ 1.2 (using the saaj jars from JWSDP 1.4) but it *still* comes up with an error message saying 'method not found - getSOAPHeader' when I try to run the servlet in websphere. I've added the jars to the build path of the project. I'm using websphere AD 5.1.

Any ideas why this is happening much appreciated. It's driving me mad. It's probably something really obvious as well...
Mikalai Zaikin
Ranch Hand

Joined: Jun 04, 2002
Posts: 3199
Hello Matt,


As far as I understand, you are using WSAD .

To resolve you problem with methods visibility try to move to the top new SAAJ jar file. It looks like old SAAJ API still in projects CLASSPATH and has higher priority.

To do this:

1. Right Click on project, select "Properties",
2. Then select "Java Build Path" in the left side,
3. Then select Tab "Order and Export",
4. Highlight new SAAJ jar file and move it to the top (button Up)
5. Restart project.


matt tee

Joined: Jun 25, 2004
Posts: 2
Thanks for the reply, and sorry about taking the thread off topic

I'd moved the saaj apis up in the build path order already, but the problem was still there. I figured out it is the server that is the problem - so I put the apis in the server's classpath and got into all sorts of conflicts. I'll tackle that today.

I wonder if anyone knows the answer to this question:
Does SaaJ 1.2 support literal encoding of documents? At the moment my message gets encoded using soap's multiref array encoding, but I want it to send it literally using no soap encoding. If I manage to sort out the classpath problem above, does saaj 1.2 support literal encoding?

Any help much appreciated (and I've sort of brought it back on topic again now)


I agree. Here's the link: http://aspose.com/file-tools
subject: Cant find the correct SOAPMessage class for SAAJ eg. RMH
Similar Threads
HttpSOAPConnectionFactory not found
jwsdp sample wss; unable to run
Exception in thread main
why these file are exist ?
Anyone ever seen this before?