}
protected void invoke(RequestWrapper rw, InputStream is, OutputStream os,
SerializerFactory serializerFactory) {
AbstractHessianInput in = null;
AbstractHessianOutput out = null;
String username = rw.getUser();
String password = rw.getPassword();
try {
HessianInputFactory.HeaderType header = _inputFactory
.readHeader(is);
switch (header) {
case CALL_1_REPLY_1:
in = _hessianFactory.createHessianInput(is);
out = _hessianFactory.createHessianOutput(os);
break;
case CALL_1_REPLY_2:
in = _hessianFactory.createHessianInput(is);
out = _hessianFactory.createHessian2Output(os);
break;
case HESSIAN_2:
in = _hessianFactory.createHessian2Input(is);
in.readCall();
out = _hessianFactory.createHessian2Output(os);
break;
default:
throw new IllegalStateException(header
+ " is an unknown Hessian call");
}
if (serializerFactory != null) {
in.setSerializerFactory(serializerFactory);
out.setSerializerFactory(serializerFactory);
}
if (username == null || password == null) {
Exception exception = new RuntimeException(
"the client can't offer the user or password infor,please check.");
out.writeFault("ServiceException", exception.getMessage(),
exception);
log.error("the client can't offer the user or password infor,now we have refused.");
throw exception;
}
invoke(rw, in, out);
} catch (Exception e) {
e.printStackTrace();
try {
out.writeFault("ServiceException", e.getMessage(), e);
} catch (IOException e1) {
e1.printStackTrace();
}
} finally {
try {
in.close();
out.close();
} catch (IOException e) {
e.printStackTrace();
}
}