本文整理汇总了Java中org.apache.axis.AxisFault类的典型用法代码示例。如果您正苦于以下问题:Java AxisFault类的具体用法?Java AxisFault怎么用?Java AxisFault使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AxisFault类属于org.apache.axis包,在下文中一共展示了AxisFault类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getMessageAttachments
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
* extract attachments from the current request
*
* @return a list of attachmentparts or
* an empty array for no attachments support in this axis
* buid/runtime
* @throws AxisFault
*/
private AttachmentPart[] getMessageAttachments() throws AxisFault {
MessageContext msgContext = MessageContext.getCurrentContext();
Message reqMsg = msgContext.getRequestMessage();
Attachments messageAttachments = reqMsg.getAttachmentsImpl();
int attachmentCount =
messageAttachments.getAttachmentCount();
AttachmentPart attachments[] = new AttachmentPart[attachmentCount];
Iterator it =
messageAttachments.getAttachments().iterator();
int count = 0;
while (it.hasNext()) {
AttachmentPart part = (AttachmentPart) it.next();
attachments[count++] = part;
}
return attachments;
}
示例2: translateRemoteException
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
* Attempt to translate the remote exception into a Method or Connection exception.
* If the conversion fails then a ConnectionException is thrown.
*
* THIS METHOD WILL ALWAYS THROW AN EXCEPTION, NO MATTER WHAT!
*
* @param rX
* @throws MethodException
* @throws ConnectionException
*/
protected void translateRemoteException(RemoteException rX)
throws MethodException, ConnectionException
{
if(rX.getClass() == AxisFault.class)
{
AxisFault af = (AxisFault)rX;
if(af.getFaultCode() != null)
{
if(MethodException.class.getName().equals(af.getFaultCode().getLocalPart()))
{
throw new MethodException(rX);
}
else if(ConnectionException.class.getName().equals(af.getFaultCode().getLocalPart()))
{
throw new MethodException(rX);
}
}
}
// if got to here, then couldn't convert the exception
// safer to throw connection exception since it will force the router to try again
throw new ConnectionException(rX);
}
示例3: invoke
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
* @see org.apache.axis.handlers.LogHandler#invoke(org.apache.axis.MessageContext)
*/
public void invoke(MessageContext arg0) throws AxisFault {
Date now = new Date();
Message m = arg0.getResponseMessage();
if (m!=null){
respMessage = m.getSOAPPartAsString();
if (baseDir!=null)
dumpToFile(sdf.format(now)+"_response",m.getSOAPPartAsBytes());
return;
}
else
respMessage = null;
m = arg0.getRequestMessage();
if (m!=null){
reqMessage = m.getSOAPPartAsString();
if (baseDir!=null)
dumpToFile(sdf.format(now)+"_request",m.getSOAPPartAsBytes());
}
else
reqMessage = null;
}
示例4: processAxisFault
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
* 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
* @param fault what went wrong.
*/
private void processAxisFault(AxisFault fault) {
//log the fault
Element runtimeException = fault.lookupFaultDetail(
Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION);
if (runtimeException != null) {
exceptionLog.info(Messages.getMessage("axisFault00"), fault);
//strip runtime details
fault.removeFaultDetail(Constants.
QNAME_FAULTDETAIL_RUNTIMEEXCEPTION);
} else if (exceptionLog.isDebugEnabled()) {
exceptionLog.debug(Messages.getMessage("axisFault00"), fault);
}
//dev systems only give fault dumps
//if (!isDevelopment()) {
//strip out the stack trace
fault.removeFaultDetail(Constants.QNAME_FAULTDETAIL_STACKTRACE);
//}
}
示例5: getEngine
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
* get the engine for this Server from cache or context
* @return
* @throws AxisFault
*/
public AxisServer getEngine() throws AxisFault {
if (axisServer == null) {
synchronized (context) {
Map environment = new HashMap();
environment.put(AxisEngine.ENV_SERVLET_CONTEXT, context);
axisServer = AxisServer.getServer(environment);
axisServer.setName("LuceeServer");
}
// add Component Handler
try {
SimpleChain sc=(SimpleChain) axisServer.getGlobalRequest();
sc.addHandler(new ComponentHandler());
}
catch (ConfigurationException e) {
throw AxisFault.makeFault(e);
}
TypeMappingUtil.registerDefaults(axisServer.getTypeMappingRegistry());
}
return axisServer;
}
示例6: processAxisFault
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
* 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
* @param fault what went wrong.
*/
private void processAxisFault(AxisFault fault) {
//log the fault
Element runtimeException = fault.lookupFaultDetail(
Constants.QNAME_FAULTDETAIL_RUNTIMEEXCEPTION);
if (runtimeException != null) {
exceptionLog.info(Messages.getMessage("axisFault00"), fault);
//strip runtime details
fault.removeFaultDetail(Constants.
QNAME_FAULTDETAIL_RUNTIMEEXCEPTION);
} else if(exceptionLog.isDebugEnabled()){
exceptionLog.debug(Messages.getMessage("axisFault00"), fault);
}
//dev systems only give fault dumps
//if (!isDevelopment()) {
//strip out the stack trace
fault.removeFaultDetail(Constants.QNAME_FAULTDETAIL_STACKTRACE);
//}
}
示例7: getEngine
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
* get the engine for this Server from cache or context
* @return
* @throws AxisFault
*/
public AxisServer getEngine() throws AxisFault {
if (axisServer == null) {
synchronized (context) {
Map environment = new HashMap();
environment.put(AxisEngine.ENV_SERVLET_CONTEXT, context);
axisServer = AxisServer.getServer(environment);
axisServer.setName("LuceeServer");
}
// add Component Handler
try {
SimpleChain sc=(SimpleChain) axisServer.getGlobalRequest();
sc.addHandler(new ComponentHandler());
}
catch (ConfigurationException e) {
throw AxisFault.makeFault(e);
}
TypeMappingUtil.registerDefaults(axisServer.getTypeMappingRegistry());
}
return axisServer;
}
示例8: invokeCFCFunction
import org.apache.axis.AxisFault; //导入依赖的package包/类
public Object invokeCFCFunction(MessageContext msgContext, cfSession session, String cfcName, cfStructData method, Object[] argValues) throws Exception {
// Create the cfc
cfComponentData cfc = new cfComponentData(session, cfcName);
if (cfc == null || cfc.getMetaData() == null || cfc.getMetaData().isEmpty())
throw new AxisFault(Messages.getMessage("noClassForService00", cfcName));
// Convert the params
cfArgStructData args = prepareArgs(session, method, argValues);
// Execute the cfc
cfData rtn = invokeComponentMethod(session, method, args, cfc);
if (rtn == null || rtn instanceof cfNullData)
return null;
else {
return tagUtils.getNatural(rtn, true, true, true);
}
}
示例9: prepareArgs
import org.apache.axis.AxisFault; //导入依赖的package包/类
private cfArgStructData prepareArgs(cfSession session, cfStructData method, Object[] argValues) throws AxisFault {
cfArgStructData rtn = new cfArgStructData();
if (argValues != null && argValues.length > 0) {
cfArrayData params = (cfArrayData) method.getData("PARAMETERS");
if (params == null || params.size() != argValues.length)
throw new AxisFault("Incorrect number of parameters for method: " + method.getData("NAME").toString());
for (int i = 1; i <= params.size(); i++) {
cfData d = null;
if (argValues[i - 1] instanceof String && tagUtils.isXmlString((String) argValues[i - 1])) {
try {
d = cfXmlData.parseXml(argValues[i - 1], true, null);
} catch (cfmRunTimeException ex) {
// Do nothing, just move on
}
}
if (d == null) {
d = tagUtils.convertToCfData(argValues[i - 1]);
}
rtn.setData(((cfStructData) params.getElement(i)).getData("NAME").toString(), d);
}
}
return rtn;
}
示例10: logMessages
import org.apache.axis.AxisFault; //导入依赖的package包/类
private void logMessages(MessageContext msgContext) throws AxisFault {
try {
Message inMsg = msgContext.getRequestMessage();
Message outMsg = msgContext.getResponseMessage();
StringBuffer msg = new StringBuffer();
if (start != -1) {
msg.append("= " + Messages.getMessage("elapsed00", "" + (System.currentTimeMillis() - start))).append('\n');
}
msg.append("= " + Messages.getMessage("inMsg00", (inMsg == null ? "null" : inMsg.getSOAPPartAsString()))).append('\n');
msg.append("= " + Messages.getMessage("outMsg00", (outMsg == null ? "null" : outMsg.getSOAPPartAsString()))).append('\n');
switch (logLevel) {
case "debug": log.debug(msg); break;
case "info": log.info(msg); break;
case "warn": log.warn(msg); break;
case "error": log.error(msg); break;
default:
log.trace(msg);
}
} catch (Exception e) {
log.error(Messages.getMessage("exception00"), e);
throw AxisFault.makeFault(e);
}
}
示例11: makeAxisFault
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
* Creates an axis fault grouping the given exceptions list
*
* @param qName
* QName of the fault
* @param exceptions
* list of exceptions
* @return axis fault
*/
public static Exception makeAxisFault( String qName,
Collection<Exception> exceptions )
{
if ( exceptions.size( ) == 1 )
{
return makeAxisFault( qName, exceptions.iterator( ).next( ) );
}
else
{
QName exceptionQName = new QName( "string" );
AxisFault fault = new AxisFault( BirtResources.getMessage( ResourceConstants.GENERAL_EXCEPTION_MULTIPLE_EXCEPTIONS ) );
fault.setFaultCode( new QName( qName ) );
for ( Iterator i = exceptions.iterator( ); i.hasNext( ); )
{
Exception e = (Exception) i.next( );
fault.addFaultDetail( exceptionQName, getStackTrace( e ) );
}
return fault;
}
}
示例12: __checkDocumentExists
import org.apache.axis.AxisFault; //导入依赖的package包/类
/**
*
*/
protected void __checkDocumentExists( ) throws Exception
{
File file = new File( __docName );
if ( !file.exists( ) )
{
BirtRunReportActionHandler handler = new BirtRunReportActionHandler(
context, operation, response );
handler.__execute( );
}
file = new File( __docName );
if ( !file.exists( ) )
{
AxisFault fault = new AxisFault( );
fault
.setFaultReason( BirtResources
.getMessage( ResourceConstants.ACTION_EXCEPTION_NO_REPORT_DOCUMENT ) );
throw fault;
}
}
示例13: processMessage
import org.apache.axis.AxisFault; //导入依赖的package包/类
public void processMessage(MessageContext msgContext, SOAPEnvelope reqEnv, SOAPEnvelope resEnv, Object obj) throws Exception {
RPCElement body = getBody(reqEnv, msgContext);
OperationDesc operation = getOperationDesc(msgContext, body);
AxisRpcInterceptor interceptor = new AxisRpcInterceptor(operation, msgContext);
SOAPMessage message = msgContext.getMessage();
try {
message.getSOAPPart().getEnvelope();
msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE);
RpcContainer container = (RpcContainer) ejbDeployment.getContainer();
Object[] arguments = {msgContext, interceptor};
Class callInterface = ejbDeployment.getServiceEndpointInterface();
Object result = container.invoke(ejbDeployment.getDeploymentID(), InterfaceType.SERVICE_ENDPOINT, callInterface, operation.getMethod(), arguments, null);
interceptor.createResult(result);
} catch (ApplicationException e) {
interceptor.createExceptionResult(e.getCause());
} catch (Throwable throwable) {
throw new AxisFault("Web Service EJB Invocation failed: method " + operation.getMethod(), throwable);
}
}
示例14: invoke
import org.apache.axis.AxisFault; //导入依赖的package包/类
@Override
public void invoke(MessageContext msgContext) throws AxisFault {
if (msgContext == null) {
throw AxisFault.makeFault(new NullPointerException("Null message context"));
}
// Catch any exception thrown and wrap it in an AxisFault, per the contract of Handler.invoke.
try {
HttpResponse response = null;
// Create the request.
HttpRequest postRequest = createHttpRequest(msgContext);
// Execute the request.
response = postRequest.execute();
// Translate the HTTP response to an Axis message on the message context.
msgContext.setResponseMessage(createResponseMessage(response));
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
示例15: testInvokeReturnsInvalidXml
import org.apache.axis.AxisFault; //导入依赖的package包/类
/** Tests that a poorly formed XML response will result in an AxisFault. */
@Test
public void testInvokeReturnsInvalidXml() throws AxisFault {
MessageContext messageContext = new MessageContext(axisEngine);
messageContext.setRequestMessage(requestMessage);
messageContext.setProperty(MessageContext.TRANS_URL, mockHttpServer.getServerUrl());
messageContext.setProperty(HTTPConstants.MC_GZIP_REQUEST, true);
mockHttpServer.setMockResponse(
new MockResponse(
"<?xml version='1.0' encoding='UTF-8' standalone='no'?>"
+ "<soap:Envelope xmlns:soap='http://schemas.xmlsoap.org/soap/envelope/'>"
+ "foo..."));
httpHandler.invoke(messageContext);
// Expect parsing to fail. Tear down will verify the stream was closed.
thrown.expect(AxisFault.class);
messageContext.getResponseMessage().getSOAPEnvelope();
}