站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > JBoss 3.2.7 jaxrpc API Documentation 英文版文档

AxisServlet (JAXRPC API) - JBoss 3.2.7 jaxrpc API Documentation 英文版文档


org.apache.axis.transport.http
Class AxisServlet

java.lang.Object
  extended byjavax.servlet.GenericServlet
      extended byjavax.servlet.http.HttpServlet
          extended byorg.apache.axis.transport.http.AxisServletBase
              extended byorg.apache.axis.transport.http.AxisServlet
All Implemented Interfaces:
Serializable, javax.servlet.Servlet, javax.servlet.ServletConfig

public class AxisServlet
extends AxisServletBase

Author:
Doug Davis (dug@us.ibm.com), Steve Loughran
See Also:
Serialized Form

Field Summary
static String INIT_PROPERTY_ENABLE_LIST
           
static String INIT_PROPERTY_JWS_CLASS_DIR
           
static String INIT_PROPERTY_TRANSPORT_NAME
           
static String INIT_PROPERTY_USE_SECURITY
           
 
Fields inherited from class org.apache.axis.transport.http.AxisServletBase
ATTR_AXIS_ENGINE, axisServer
 
Constructor Summary
AxisServlet()
          create a new servlet instance
 
Method Summary
protected  MessageContext createMessageContext(AxisEngine engine, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Place the Request message in the MessagContext object - notice that we just leave it as a 'ServletRequest' object and let the Message processing routine convert it - we don't do it since we don't know how it's going to be used - perhaps it might not even need to be parsed.
 void doGet(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          Process GET requests.
 void doPost(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Process a POST to the servlet by handing it off to the Axis Engine.
protected  String getDefaultJWSClassDir()
          Provided to allow overload of default JWSClassDir by derived class.
protected  int getHttpServletResponseStatus(AxisFault af)
          Extract information from AxisFault and map it to a HTTP Status code.
protected  String getJWSClassDir()
           
protected  String getProtocolVersion(javax.servlet.http.HttpServletRequest req)
          Return the HTTP protocol level 1.1 or 1.0 by derived class.
protected  String getServiceName(javax.servlet.http.HttpServletRequest request)
          Assumes that the service name is the first token in the path info
 void init()
          Initialization method.
protected  void invokeEndpointFromGet(MessageContext msgContext, javax.servlet.http.HttpServletResponse response, PrintWriter writer, String method, String args)
          invoke an endpoint from a get request by building an XML request and handing it down.
protected  void logException(Exception e)
          log any exception to our output log, at our chosen level
protected  void processAxisFault(AxisFault fault)
          routine called whenever an axis fault is caught; where they are logged and any other business.
protected  void processListRequest(javax.servlet.http.HttpServletResponse response, PrintWriter writer)
          respond to the ?list command.
protected  void processMethodRequest(MessageContext msgContext, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter writer)
          scan through the request for parameters, invoking the endpoint if we get a method param.
protected  void processWsdlRequest(MessageContext msgContext, javax.servlet.http.HttpServletResponse response, PrintWriter writer)
          handle a ?wsdl request
protected  void reportAvailableServices(javax.servlet.http.HttpServletResponse response, PrintWriter writer, javax.servlet.http.HttpServletRequest request)
          This method lists the available services; it is called when there is nothing to execute on a GET
protected  void reportCantGetAxisService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter writer)
          generate the error response to indicate that there is apparently no endpoint there
protected  void reportCantGetJWSService(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, PrintWriter writer)
          probe for a JWS page and report 'no service' if one is not found there
protected  void reportNoWSDL(javax.servlet.http.HttpServletResponse res, PrintWriter writer, String moreDetailCode, AxisFault axisFault)
          report that we have no WSDL
protected  void reportServiceInfo(javax.servlet.http.HttpServletResponse response, PrintWriter writer, SOAPService service, String serviceName)
          print a snippet of service info.
protected  void reportTrouble(Exception exception, javax.servlet.http.HttpServletResponse response, PrintWriter writer)
          when we get an exception or an axis fault in a GET, we handle it almost identically: we go 'something went wrong', set the response code to 500 and then dump info.
protected  void setupHTMLResponseHeader(javax.servlet.http.HttpServletResponse response, PrintWriter writer)
           
 
Methods inherited from class org.apache.axis.transport.http.AxisServletBase
decLockCounter, destroy, getEngine, getEngine, getEngineEnvironment, getHomeDir, getLoadCounter, getOption, getServletContext, getWebappBase, getWebInfPath, incLockCounter, isDevelopment, service
 
Methods inherited from class javax.servlet.http.HttpServlet
doDelete, doHead, doOptions, doPut, doTrace, getLastModified, service
 
Methods inherited from class javax.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletInfo, getServletName, init, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INIT_PROPERTY_TRANSPORT_NAME

public static final String INIT_PROPERTY_TRANSPORT_NAME
See Also:
Constant Field Values

INIT_PROPERTY_USE_SECURITY

public static final String INIT_PROPERTY_USE_SECURITY
See Also:
Constant Field Values

INIT_PROPERTY_ENABLE_LIST

public static final String INIT_PROPERTY_ENABLE_LIST
See Also:
Constant Field Values

INIT_PROPERTY_JWS_CLASS_DIR

public static final String INIT_PROPERTY_JWS_CLASS_DIR
See Also:
Constant Field Values
Constructor Detail

AxisServlet

public AxisServlet()
create a new servlet instance

Method Detail

getJWSClassDir

protected String getJWSClassDir()

init

public void init()
Initialization method.

Overrides:
init in class AxisServletBase

doGet

public void doGet(javax.servlet.http.HttpServletRequest request,
                  javax.servlet.http.HttpServletResponse response)
           throws javax.servlet.ServletException,
                  IOException
Process GET requests. This includes handoff of pseudo-SOAP requests

Parameters:
request - request in
response - request out
Throws:
javax.servlet.ServletException
IOException

reportTrouble

protected void reportTrouble(Exception exception,
                             javax.servlet.http.HttpServletResponse response,
                             PrintWriter writer)
when we get an exception or an axis fault in a GET, we handle it almost identically: we go 'something went wrong', set the response code to 500 and then dump info. But we dump different info for an axis fault or subclass thereof.

Parameters:
exception - what went wrong
response - current response
writer - open writer to response

setupHTMLResponseHeader

protected void setupHTMLResponseHeader(javax.servlet.http.HttpServletResponse response,
                                       PrintWriter writer)

processAxisFault

protected void processAxisFault(AxisFault fault)
routine called whenever an axis fault is caught; where they are logged and any other business. The method may modify the fault in the process

Parameters:
fault - what went wrong.

logException

protected void logException(Exception e)
log any exception to our output log, at our chosen level

Parameters:
e - what went wrong

processMethodRequest

protected void processMethodRequest(MessageContext msgContext,
                                    javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    PrintWriter writer)
                             throws AxisFault
scan through the request for parameters, invoking the endpoint if we get a method param. If there was no method param then the response is set to a 400 Bad Request and some error text

Parameters:
msgContext - current message
request - incoming requests
response - response to generate
writer - output stream
Throws:
AxisFault - if anything goes wrong during method execution

processWsdlRequest

protected void processWsdlRequest(MessageContext msgContext,
                                  javax.servlet.http.HttpServletResponse response,
                                  PrintWriter writer)
                           throws AxisFault
handle a ?wsdl request

Parameters:
msgContext - message context so far
response - response to write to
writer - output stream
Throws:
AxisFault - when anything other than a Server.NoService fault is reported during WSDL generation

invokeEndpointFromGet

protected void invokeEndpointFromGet(MessageContext msgContext,
                                     javax.servlet.http.HttpServletResponse response,
                                     PrintWriter writer,
                                     String method,
                                     String args)
                              throws AxisFault
invoke an endpoint from a get request by building an XML request and handing it down. If anything goes wrong, we generate an XML formatted axis fault

Parameters:
msgContext - current message
response - to return data
writer - output stream
method - method to invoke (may be null)
args - argument list in XML form
Throws:
AxisFault - iff something goes wrong when turning the response message into a SOAP string.

reportServiceInfo

protected void reportServiceInfo(javax.servlet.http.HttpServletResponse response,
                                 PrintWriter writer,
                                 SOAPService service,
                                 String serviceName)
print a snippet of service info.

Parameters:
service - service
writer - output channel
serviceName - where to put stuff

processListRequest

protected void processListRequest(javax.servlet.http.HttpServletResponse response,
                                  PrintWriter writer)
                           throws AxisFault
respond to the ?list command. if enableList is set, we list the engine config. If it isnt, then an error is written out

Parameters:
response -
writer -
Throws:
AxisFault

reportNoWSDL

protected void reportNoWSDL(javax.servlet.http.HttpServletResponse res,
                            PrintWriter writer,
                            String moreDetailCode,
                            AxisFault axisFault)
report that we have no WSDL

Parameters:
res -
writer -
moreDetailCode - optional name of a message to provide more detail
axisFault - optional fault string, for extra info at debug time only

reportAvailableServices

protected void reportAvailableServices(javax.servlet.http.HttpServletResponse response,
                                       PrintWriter writer,
                                       javax.servlet.http.HttpServletRequest request)
                                throws ConfigurationException,
                                       AxisFault
This method lists the available services; it is called when there is nothing to execute on a GET

Parameters:
response -
writer -
request -
Throws:
ConfigurationException
AxisFault

reportCantGetAxisService

protected void reportCantGetAxisService(javax.servlet.http.HttpServletRequest request,
                                        javax.servlet.http.HttpServletResponse response,
                                        PrintWriter writer)
generate the error response to indicate that there is apparently no endpoint there

Parameters:
request - the request that didnt have an edpoint
response - response we are generating
writer - open writer for the request

reportCantGetJWSService

protected void reportCantGetJWSService(javax.servlet.http.HttpServletRequest request,
                                       javax.servlet.http.HttpServletResponse response,
                                       PrintWriter writer)
probe for a JWS page and report 'no service' if one is not found there

Parameters:
request - the request that didnt have an edpoint
response - response we are generating
writer - open writer for the request

doPost

public void doPost(javax.servlet.http.HttpServletRequest req,
                   javax.servlet.http.HttpServletResponse res)
            throws javax.servlet.ServletException,
                   IOException
Process a POST to the servlet by handing it off to the Axis Engine. Here is where SOAP messages are received

1. get the Axis server engine 2. create the MessageContext and populate it with the req/res objects 3. set security provider 4. create request SOAPMessage 5. set the SOAPAction in the message context 6. invoke the engine 7. get response SOAPMessage 8. get the response content type 9. send the response

Parameters:
req - posted request
res - respose
Throws:
javax.servlet.ServletException - trouble
IOException - different trouble

getServiceName

protected String getServiceName(javax.servlet.http.HttpServletRequest request)
Assumes that the service name is the first token in the path info


getHttpServletResponseStatus

protected int getHttpServletResponseStatus(AxisFault af)
Extract information from AxisFault and map it to a HTTP Status code.

Parameters:
af - Axis Fault
Returns:
HTTP Status code.

createMessageContext

protected MessageContext createMessageContext(AxisEngine engine,
                                              javax.servlet.http.HttpServletRequest req,
                                              javax.servlet.http.HttpServletResponse res)
Place the Request message in the MessagContext object - notice that we just leave it as a 'ServletRequest' object and let the Message processing routine convert it - we don't do it since we don't know how it's going to be used - perhaps it might not even need to be parsed.

Returns:
a message context

getDefaultJWSClassDir

protected String getDefaultJWSClassDir()
Provided to allow overload of default JWSClassDir by derived class.

Returns:
directory for JWS files

getProtocolVersion

protected String getProtocolVersion(javax.servlet.http.HttpServletRequest req)
Return the HTTP protocol level 1.1 or 1.0 by derived class.

Returns:
one of the HTTPConstants values


Copyright © 2002 JBoss Group, LLC. All Rights Reserved.