You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by Scott Nichol <sn...@scottnichol.com> on 2002/08/21 04:13:41 UTC

[from soap-user] Re: urgent help needed with:Error building response evelope

What version of Apache SOAP are you using?

Scott Nichol

----- Original Message -----
From: "WANG xiulan" <wx...@hotmail.com>
To: <so...@xml.apache.org>
Cc: <sn...@scottnichol.com>
Sent: Tuesday, August 20, 2002 11:01 AM
Subject: urgent help needed with:Error building response evelope



Hi everyone,

will u give me any idea?

I place the .class and .xml file in %TOMCAT_HOME%
\webapps\soap\WEB-INF\classes , restart  tomcat, deploy the service and it
succedd.
but when I  run my JSP under http://localhost:8080/saop/servlet/admin/  , it
doesnt work well
and in dos command appears:

2002-08-20 12:41:12 - Ctx( /soap ): Exception in: R( /soap +
/servlet/rpcrouter
+ null) - javax.servlet.ServletException: Error building response envelope:
java
.lang.NullPointerException
        at
org.apache.soap.server.http.RPCRouterServlet.doPost(RPCRouterServlet.
java:353)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
        at
org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:4
05)
        at org.apache.tomcat.core.Handler.service(Handler.java:287)
        at
org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372
)
        at
org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:812)
        at
org.apache.tomcat.core.ContextManager.service(ContextManager.java:758
)
        at
org.apache.tomcat.service.http.HttpConnectionHandler.processConnectio
n(HttpConnectionHandler.java:213)
        at
org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:
416)
        at
org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java
:501)
        at java.lang.Thread.run(Thread.java:479)


here is the  jsp code :

<%@ page import="java.io.*, java.util.*, org.w3c.dom.*, java.net.*" %>
<%@ page import="org.apache.soap.util.xml.*, org.apache.soap.*" %>
<%@ page import="org.apache.soap.encoding.*,
org.apache.soap.encoding.soapenc.*, org.apache.soap.rpc.*" %>
<h1>test</h1>
<%
if (!request.getMethod().equals ("POST")) {
%>
<h1>Deploy Service julia and send a char!</h1>
<form action="julia.jsp" method="POST">
    <p>
    <input type="text" size="15" name="aChar">
  <input type="submit" value="Submit" name="B1"><input type="reset"
value="Reset" name="B2"></p>
</p>
</form>
<%
} else
{
%>
<h1>Response from julia</h1>
<%
    // send  a char to julia //
    String encodingStyleURI = Constants.NS_URI_SOAP_ENC;
    URL url = new URL("http://10.0.0.10:8080/soap/servlet/rpcrouter");
    String aChar= request.getParameter ("aChar");
    SOAPMappingRegistry smr = new SOAPMappingRegistry();
    BeanSerializer beanSer = new BeanSerializer();
%>
<%
    // Build the call.
    Call call = new Call();
    call.setTargetObjectURI("urn:julia");
    call.setMethodName("julia");
    call.setEncodingStyleURI(encodingStyleURI);
    Vector params = new Vector();
    params.addElement(new Parameter("aChar", String.class, aChar, null));
    call.setParams(params);
%>
<%
    // Invoke the call.
    Response resp;
    try
    {
      resp = call.invoke(url, "");
    }
    catch (SOAPException e)
    {
      System.err.println("Caught SOAPException (" +
                         e.getFaultCode() + "): " +
                         e.getMessage());
      return;
    }
    // Check the response.
    if (!resp.generatedFault())
    {
      Parameter ret = resp.getReturnValue();
      Object value = ret.getValue();
      //  out put
%>
<p> The response from the remote server is: </p>
<%=value%>
<% System.out.println(value);
    }
    else
    {
      Fault fault = resp.getFault();
      System.err.println("Generated fault: ");
      System.out.println ("  Fault Code   = " + fault.getFaultCode());
      System.out.println ("  Fault String = " + fault.getFaultString());
    }
}
%>

and this is the java code which i place i the same directory with DD.xml
under %TOMCAT%:


package samples.julia;

import java.lang.*;
import org.w3c.dom.*;
import javax.xml.parsers.*;
import org.apache.soap.util.xml.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
import java.util.*;

public class Products

  //
  // method julia(): just for test which will triple the parameter String
  //
  public String julia(String n) throws IllegalArgumentException
  {
    System.out.println(".");
    System.out.println("julia"); // signal the method is called
    if (n == "null")
    {
      throw new IllegalArgumentException("The char argument must not be" +
"null.");
    }
    String a = new String(n+" "+n+" "+n);
    return a;
  }  // end of julia()






----------------------------------------------------------------------------
----
MSN Photos is the easiest way to share and print your photos: Click Here