axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 11120] New: - SOAPConnection call fails in the doGet() method of an http servlet
Date Wed, 24 Jul 2002 08:05:00 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11120>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11120

SOAPConnection call fails in the doGet() method of an http servlet

           Summary: SOAPConnection call fails in the doGet() method of an
                    http servlet
           Product: Axis
           Version: beta-3
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Serialization/Deserialization
        AssignedTo: axis-dev@xml.apache.org
        ReportedBy: jean.barraud@rd.francetelecom.com


I'm trying to make 2 applications communicate via ebXML MS, and I use for this 
2 servlets running in the same Tomcat webapp. 
The request SOAP message is built in the doGet() method of the first servlet 
called companyA using the javax.xml.soap API (and javax.xml.messaging to 
specify the endPoint).

Here is the code:
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage msg = mf.createMessage();

SOAPPart sp = msg.getSOAPPart();

//create the header container
SOAPEnvelope envelope = sp.getEnvelope();
SOAPUtil.ebSetup(
	envelope,
	"mailto:query@companya.com",
	"mailto:queryresponse@companyb.com",
	"123",
	"20002",
	"urn:services:QueryTransfers",
	"QueryAllTransfers");
URLEndpoint endPoint =
	new URLEndpoint("http://localhost:8000/ebXML-test/companyB");

System.out.println("company a sent: ");
msg.writeTo(System.out);

SOAPMessage reply = con.call(msg, endPoint);

if (reply != null) {...

The SOAPConnection object is declared as a private attribute of the request 
servlet, and initialised in the init method as follows:

public void init(ServletConfig servletConfig) throws ServletException {
super.init(servletConfig);
try {
	SOAPConnectionFactory scFactory =
        	SOAPConnectionFactory.newInstance();
	con = scFactory.createConnection();
}
catch (Exception e) {
	e.printStackTrace();
}
}

Now this is what happens when I call this servlet in a browser with the GET 
method:

java.lang.NullPointerException
	at org.apache.axis.encoding.DeserializationContextImpl.<init>
(DeserializationContextImpl.java:160)  at 
org.apache.axis.SOAPPart.getAsSOAPEnvelope(SOAPPart.java:451)
	at org.apache.axis.Message.getSOAPEnvelope(Message.java:362)
	at org.apache.axis.soap.SOAPConnectionImpl.call
(SOAPConnectionImpl.java:88)
	at CompanyA.SendQueryServlet.doGet(SendQueryServlet.java:78)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java)
	at org.apache.tomcat.facade.ServletHandler.doService(Unknown Source)
	at org.apache.tomcat.core.Handler.invoke(Unknown Source)
	at org.apache.tomcat.core.Handler.service(Unknown Source)
	at org.apache.tomcat.facade.ServletHandler.service(Unknown Source)
	at org.apache.tomcat.core.ContextManager.internalService(Unknown Source)
	at org.apache.tomcat.core.ContextManager.service(Unknown Source)
	at org.apache.tomcat.modules.server.Http10Interceptor.processConnection
(Unknown \
Source)  at org.apache.tomcat.util.net.TcpWorkerThread.runIt(Unknown Source)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run
(Unknown Source)
	at java.lang.Thread.run(Unknown Source)


I downloaded the sources of Axis to have more details.
I'm using an IDE called Eclipse. In debug mode, I found out that the null 
pointer exception is thrown in the constructor of 
the "DeserializationContextImpl" class.

public DeserializationContextImpl(InputSource is,
                                  MessageContext ctx,
                                  String messageType)
{
   EnvelopeBuilder builder = new EnvelopeBuilder(messageType,
                                                 ctx.getSOAPConstants());   

The ctx object is null when running the method, so the getSOAPConstants() 
method is called on a null pointer, which results in a nullpointerexception.

Mime
View raw message