import javax.xml.soap.*;
import java.net.URL;
String POSTTOURL = "http://yourhost:yourport/yourservice";
MessageFactory factory = MessageFactory.newInstance();
SOAPMessage message = factory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPHeader header = envelope.getHeader();
SOAPBody body = envelope.getBody();
...
set the body content here
...
SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = soapConnectionFactory.createConnection();
java.net.URL endpoint = new URL(POSTTOURL);
SOAPMessage soapResponse = connection.call(message, endpoint);
out.write("soapResponse=" + soapResponse.getSOAPBody().toString());
The above code without any "body content" will generate this:
<soapenv:Body xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>" operation="null" attachments="<con:attachments xmlns:con="http://www.bea.com/wli/sb/context"/>" outbound="null" fault="null" inbound="<con:endpoint name="BLA" xmlns:con="http://www.bea.com/wli/sb/context"> <con:service/> <con:transport/> <con:security/> </con:endpoint>" header="<soapenv:Header xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"/>
I got this error message:
This class does not support SAAJ 1.1Adding this in the setDomainEnv.sh for JAVA_OPTIONS seems to fix it:
-Djavax.xml.soap.MessageFactory=weblogic.xml.saaj.MessageFactoryImplSee also document "Receive the Error "This Class Does Not Support SAAJ 1.1" when Running a P6 Web Services Application (Doc ID 1297252.1)" where they recommend:
JAVA_OPTIONS="${SAVE_JAVA_OPTIONS}
-Djavax.xml.soap.MessageFactory=com.sun.xml.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
-Djavax.xml.soap.SOAPConnectionFactory=weblogic.wsee.saaj.SOAPConnectionFactoryImpl"
No comments:
Post a Comment