// create and initialize a message context
MessageContext msgContext = new MessageContext( engine );
Message requestMsg = null;
// Reusuable, buffered, content length controlled, InputStream
NonBlockingBufferedInputStream is = new NonBlockingBufferedInputStream( );
// buffers for the headers we care about
StringBuffer soapAction = new StringBuffer( );
StringBuffer httpRequest = new StringBuffer( );
StringBuffer fileName = new StringBuffer( );
StringBuffer cookie = new StringBuffer( );
StringBuffer cookie2 = new StringBuffer( );
StringBuffer authInfo = new StringBuffer( );
StringBuffer contentType = new StringBuffer( );
StringBuffer contentLocation = new StringBuffer( );
Message responseMsg = null;
// prepare request (do as much as possible while waiting for the
// next connection). Note the next two statements are commented
// out. Uncomment them if you experience any problems with not
// resetting state between requests:
// msgContext = new MessageContext();
// requestMsg = new Message("", "String");
//msgContext.setProperty("transport", "HTTPTransport");
msgContext.setTransportName( TRANSPORT_NAME );
responseMsg = null;
try
{
// assume the best
byte[] status = OK;
// assume we're not getting WSDL
boolean doWsdl = false;
// cookie for this session, if any
String cooky = null;
String methodName = null;
try
{
// wipe cookies if we're doing sessions
if ( m_server.isSessionUsed( ) )
{
cookie.delete( 0,
cookie.length( ) );
cookie2.delete( 0,
cookie2.length( ) );
}
authInfo.delete( 0,
authInfo.length( ) );
// read headers
is.setInputStream( m_socket.getInputStream( ) );
// parse all headers into hashtable
MimeHeaders requestHeaders = new MimeHeaders( );
int contentLength =
parseHeaders( is, buf, contentType, contentLocation, soapAction, httpRequest, fileName, cookie,
cookie2, authInfo, requestHeaders );
is.setContentLength( contentLength );
int paramIdx = fileName.toString( ).indexOf( '?' );
if ( paramIdx != -1 )
{
// Got params