本文整理汇总了Java中org.apache.axis.AxisFault.makeFault方法的典型用法代码示例。如果您正苦于以下问题:Java AxisFault.makeFault方法的具体用法?Java AxisFault.makeFault怎么用?Java AxisFault.makeFault使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis.AxisFault
的用法示例。
在下文中一共展示了AxisFault.makeFault方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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);
}
}
示例4: 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);
}
}
示例5: invoke
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
public void invoke(MessageContext msgContext) throws AxisFault {
try {
System.out.println("Starting Server verification");
Message inMsg = msgContext.getRequestMessage();
Message outMsg = msgContext.getResponseMessage();
// verify signed message
Document doc = inMsg.getSOAPEnvelope().getAsDocument();
String BaseURI = "http://xml-security";
CachedXPathAPI xpathAPI = new CachedXPathAPI();
Element nsctx = doc.createElement("nsctx");
nsctx.setAttribute("xmlns:ds", Constants.SignatureSpecNS);
Element signatureElem = (Element) xpathAPI.selectSingleNode(doc,
"//ds:Signature", nsctx);
// check to make sure that the document claims to have been signed
if (signatureElem == null) {
System.out.println("The document is not signed");
return;
}
XMLSignature sig = new XMLSignature(signatureElem, BaseURI);
boolean verify = sig.checkSignatureValue(sig.getKeyInfo().getPublicKey());
System.out.println("Server verification complete.");
System.out.println("The signature is" + (verify
? " "
: " not ") + "valid");
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
示例6: invoke
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
public void invoke(MessageContext msgContext) throws AxisFault
{
/** Log an access each time we get invoked.
*/
try {
Handler serviceHandler = msgContext.getService();
String filename = (String)getOption("filename");
if ((filename == null) || (filename.equals("")))
throw new AxisFault("Server.NoLogFile",
"No log file configured for the LogHandler!",
null, null);
FileOutputStream fos = new FileOutputStream(filename, true);
PrintWriter writer = new PrintWriter(fos);
Integer numAccesses =
(Integer)serviceHandler.getOption("accesses");
if (numAccesses == null)
numAccesses = new Integer(0);
numAccesses = new Integer(numAccesses.intValue() + 1);
Date date = new Date();
String result = date + ": service " +
msgContext.getTargetService() +
" accessed " + numAccesses + " time(s).";
serviceHandler.setOption("accesses", numAccesses);
writer.println(result);
writer.close();
} catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
示例7: setURL
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
/**
* Set up the call object.
*/
public void setURL(String url)
throws AxisFault
{
try {
binding = new InteropTestServiceLocator().
getecho(new java.net.URL(url));
// safety first
((InteropTestSoapBindingStub)binding).setTimeout(60000);
((InteropTestSoapBindingStub)binding).setMaintainSession(true);
} catch (Exception exp) {
throw AxisFault.makeFault(exp);
}
}
示例8: makeFault
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
/**
* Create an connection problem AxisFault from an Exception
*
* @param msgContext MessageContext object
* @param e Exception
* @param remoteURL Remote URL
* @return AxisFault
*/
private AxisFault makeFault(final MessageContext msgContext,
final Exception e,
final String remoteURL)
{
AxisFault af = null;
if (e instanceof org.apache.http.conn.HttpHostConnectException) {
af = this.createFault( msgContext,
AxisFault.soap12receiver,
"Connection refused");
} else if (e instanceof InterruptedIOException) {
af = this.createFault( msgContext,
AxisFault.soap12receiver,
"Communication timed out");
} else if (e instanceof java.io.IOException) {
af = this.createFault( msgContext,
AxisFault.soap12receiver,
"Connection failed");
}
if (af == null) {
// Default maker..
af = AxisFault.makeFault(e);
}
try {
SOAPFault fault = new SOAPFault(af);
msgContext.setProperty(RAW_RESPONSE_XML, fault.getAsString());
} catch (Exception e2) {
log.warn("Failed to write response XML.", e2);
}
return af;
}
示例9: invoke
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
/**
* invoke creates a socket connection, sends the request SOAP message and then
* reads the response SOAP message back from the SOAP server
*
* @param msgContext the messsage context
*
* @throws AxisFault
*/
public void invoke(MessageContext msgContext) throws AxisFault {
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage("enter00", "HTTPSender::invoke"));
}
SocketHolder socketHolder = new SocketHolder(null);
try {
BooleanHolder useFullURL = new BooleanHolder(false);
StringBuffer otherHeaders = new StringBuffer();
targetURL = new URL(msgContext.getStrProp(MessageContext.TRANS_URL));
String host = targetURL.getHost();
int port = targetURL.getPort();
// Send the SOAP request to the server
InputStream inp = writeToSocket(socketHolder, msgContext, targetURL,
otherHeaders, host, port, msgContext.getTimeout(), useFullURL);
// Read the response back from the server
Hashtable headers = new Hashtable();
inp = readHeadersFromSocket(socketHolder, msgContext, inp, headers);
readFromSocket(socketHolder, msgContext, inp, headers);
} catch (Exception e) {
log.debug(e);
try {
if (socketHolder.getSocket() != null ) {
socketHolder.getSocket().close();
}
} catch (IOException ie) {
// we shouldn't get here.
}
throw AxisFault.makeFault(e);
}
if (log.isDebugEnabled()) {
log.debug(Messages.getMessage("exit00",
"HTTPDispatchHandler::invoke"));
}
}
示例10: invoke
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
@Override
public void invoke(MessageContext msgContext) throws AxisFault {
try {
setupService(msgContext);
}
catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
示例11: generateWSDL
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
@Override
public void generateWSDL(MessageContext msgContext) throws AxisFault {
try {
setupService(msgContext);
}
catch (Exception e) {
throw AxisFault.makeFault(e);
}
}
示例12: invoke
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
/**
* invokes thread local component
* @param name
* @param args
* @return
* @throws AxisFault
* @throws PageException
*/
public static Object invoke(String name, Object[] args) throws AxisFault {
try {
return _invoke(name, args);
}
catch (Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
throw AxisFault.makeFault((Caster.toPageException(t)));
}
}
示例13: invoke
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
/**
* invokes thread local component
* @param name
* @param args
* @return
* @throws AxisFault
* @throws PageException
*/
public static Object invoke(String name, Object[] args) throws AxisFault {
try {
return _invoke(name, args);
}
catch(Throwable t) {
ExceptionUtil.rethrowIfNecessary(t);
throw AxisFault.makeFault((Caster.toPageException(t)));
}
}
示例14: makeAxisFault
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
/**
* Creates an axis fault based on a given exception.
*
* @param qName
* QName of the fault
* @param e
* exception
* @return axis fault
*/
public static AxisFault makeAxisFault( Exception e )
{
if ( e instanceof AxisFault )
{
return (AxisFault) e;
}
else
{
AxisFault fault = AxisFault.makeFault( e );
fault.addFaultDetailString( BirtUtility.getStackTrace( e ) );
return fault;
}
}
示例15: proxyService
import org.apache.axis.AxisFault; //导入方法依赖的package包/类
/**
* Process the given message, treating it as raw XML.
*/
public void proxyService(SOAPEnvelope env1, SOAPEnvelope env2)
throws AxisFault
{
try {
// Get the current Message Context
MessageContext msgContext = MessageContext.getCurrentContext();
// Look in the message context for our service
Handler self = msgContext.getService();
// what is our target URL?
String dest = (String)self.getOption("URL");
// use the server's client engine in case anything has
// been deployed to it
Service service = new Service();
service.setEngine( msgContext.getAxisEngine().getClientEngine() );
Call call = (Call) service.createCall();
SimpleTargetedChain c = new SimpleTargetedChain(new TCPSender());
// !!! FIXME
//service.getEngine().deployTransport("tcp", c);
// add TCP for proxy testing
call.addTransportPackage("samples.transport");
call.setTransportForProtocol("tcp", TCPTransport.class);
// NOW set the client's URL (since now the tcp handler exists)
call.setTargetEndpointAddress(new java.net.URL(dest));
call.setRequestMessage(msgContext.getRequestMessage());
call.invoke();
Message msg = call.getResponseMessage();
msgContext.setResponseMessage(msg);
}
catch( Exception exp ) {
throw AxisFault.makeFault( exp );
}
}