Hi , I have this piece of code snippet of SAAJ example from RMH << MessageFactory msgFactory =MessageFactory.newInstance(); SOAPMessage message = msgFactory.createMessage(); message.getSOAPHeader().detachNode(); SOAPBody body=message.getSOAPPart(); SOAPElement getBookPrice=body.addChildElement("getBookPrice","mh","http:/www.Monson-Hafel.com/jwsbook/BookQuote"); getBookPrice.setEncodingStyle(SOAPConstants.URI_NS_SOAP_ENCODING);>>
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 . message.getSOAPHeader().detachNode();
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 D:\jwsdp-1.3\ jaxr\lib\jaxr-api.jar;D:\jwsdp-1.3\jaxr\lib\jaxr-impl.jar;.;D:\jwsdp-1.3\jaxb\li b\jaxb-impl.jar;D:\jwsdp-1.3\jaxb\lib\jaxb-api.jar;D:\jwsdp-1.3\jaxrpc\lib\jaxrp c-impl.jar;D:\jwsdp-1.3\jaxrpc\lib\jaxrpc-api.jar;D:\jwsdp-1.3\saaj\lib\saaj-imp l.jar;D:\jwsdp-1.3\saaj\lib\saaj-api.jar;D:\jwsdp-1.3\jaxb\jaxb-libs.jar;D:\jwsd p-1.3\jaxb\lib\jaxb-libs.jar;D:\jwsdp-1.3\jwsdp-shared\lib\relaxngDatatype.jar;D :\jwsdp-1.3\jwsdp-shared\lib\namespace.jar;D:\jwsdp-1.3\jwsdp-shared\lib\mail.ja r;D:\jwsdp-1.3\jwsdp-shared\lib\activation.jar;D:\jwsdp-1.3\jaxp\lib\xercesImpl. jar;D:\jwsdp-1.3\jaxp\lib\endorsed\xercesImpl.jar;D:\jwsdp-1.3\jaxp\lib\endorsed \dom.jar;D:\jwsdp-1.3\jaxp\lib\xsdlib.jar;D:\jwsdp-1.3\jwsdp-shared\lib\xsdlib.j ar
Java Platform, Enterprise Edition 6 Web Services Developer Certified Expert Exam Study Guide and Quiz Exam 1Z0-810: Upgrade to Java SE 8 Programmer Study Guide and Quiz
Joined: Dec 09, 2003
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.
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. ;-)
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...
Joined: Jun 04, 2002
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.
Joined: Jun 25, 2004
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)