I'm trying to work though some SOAP samples but keep hitting the same problem. I've created my SOAP message, sent it, and got a response back. I can print the response using response.writeTo(System.out) and see that I get a good response. Now I'm trying to do something with the response. All the examples show getting the body of the response with response.getSOAPBody(). However I keep getting a NoSuchMethod exception.
I am running J2RE 1.4.1.
I am using jwsdp-1.6 with the following classpath:
</SOAP-ENV:Body> </SOAP-ENV:Envelope> before getSOAPBody Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.parsers.SAXPar serFactory: method getSchema()Ljavax/xml/validation/Schema; not found at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.<init>(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl.newSAXPa rser(Unknown Source) at com.sun.xml.messaging.saaj.util.ParserPool.get(ParserPool.java:42) at com.sun.xml.messaging.saaj.soap.EnvelopeFactory.createEnvelope(Envelo peFactory.java:62) at com.sun.xml.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl.createEnvelope FromSource(SOAPPart1_1Impl.java:39) at com.sun.xml.messaging.saaj.soap.SOAPPartImpl.getEnvelope(SOAPPartImpl .java:98) at com.sun.xml.messaging.saaj.soap.MessageImpl.getSOAPBody(MessageImpl.j ava:768) at SendSOAP.main(SendSOAP.java:55)
I haven't tried this so don't know whether it will work
Joined: Aug 08, 2001
Thanks for the alternate code.
I have sort of solved the problem for now.
Rather than using jwsdp 1.6 I have downloaded v 1.4. Using the 1.4 jaxp and saaj classes I was able to get the getSOAPBody method work. I am still bothered that my v 1.6's jaxp and saaj do not work in harmony for getSOAPBody.
Even i faced the same problem. But i resolved it. Pls follow the below steps to resolve this problem. 1. Create the below directory where JDK installed in your machine. <JAVA_HOME>/jre/lib/endorsed 2. Copy the jar files from the below directory where WSDP 1.6 installed in your machine. <WSDP_HOME>/jaxp/lib <WSDP_HOME>/jaxp/lib/endorsed 3. Paste all the jar files newly created directory <JAVA_HOME>/jre/lib/endorsed
I still facing the same problem even after following your suggestions.
Error message is Exception in thread "main" java.lang.NoSuchMethodError: javax.xml.parsers.DocumentBuilderFactory: method getSchema()Ljavax/xml/validation/Schema; not found at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.<init>(Unknown Source) at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl.newDocumentBuilder(Unknown Source)
any other suggestions
Joined: Dec 12, 2004
It worked fine thanks.
Joined: Aug 08, 2001
Mani was on the right path. Here is another answer I received from a Sun JAXP site. I have not tried this solution.
To run your class with JRE1.4.2, you need to use endorsed mechanism, as shown below: java -Djava.endorsed.dirs=<directory of jaxp jar files> UddiPing
JRE uses the classes which are bundled in it by default. So, it doesn't help even if you set CLASSPATH to appropriate jars. To override the deafult jars, you need to use endorsed way.
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com