本文整理汇总了Java中org.apache.axis.MessageContext.getResponseMessage方法的典型用法代码示例。如果您正苦于以下问题:Java MessageContext.getResponseMessage方法的具体用法?Java MessageContext.getResponseMessage怎么用?Java MessageContext.getResponseMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis.MessageContext
的用法示例。
在下文中一共展示了MessageContext.getResponseMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: invoke
import org.apache.axis.MessageContext; //导入方法依赖的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;
}
示例2: logMessages
import org.apache.axis.MessageContext; //导入方法依赖的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);
}
}
示例3: invoke
import org.apache.axis.MessageContext; //导入方法依赖的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);
}
}
示例4: execute
import org.apache.axis.MessageContext; //导入方法依赖的package包/类
public cfData execute(cfSession _session, List<cfData> parameters) throws cfmRunTimeException {
String ns = null;
String n = null;
cfData val = null;
boolean mustUnderstand = false;
int offset = 0;
if (parameters.size() == 4) {
mustUnderstand = parameters.get(0).getBoolean();
offset = 1;
}
val = parameters.get(0 + offset);
n = parameters.get(1 + offset).getString();
ns = parameters.get(2 + offset).getString();
// Create the header
SOAPHeaderElement header = addSOAPRequestHeader.createSOAPHeader(val, ns, n, mustUnderstand);
// Add the header
try {
MessageContext mc = MessageContext.getCurrentContext();
if (mc != null && mc.getResponseMessage() != null && mc.getResponseMessage().getSOAPEnvelope() != null) {
// Check to see if the same header has already been added
// (same meaning, having the same namespace/name pair)
if (mc.getResponseMessage().getSOAPEnvelope().getHeaderByName(header.getNamespaceURI(), header.getName()) != null)
throw new cfmRunTimeException(catchDataFactory.generalException("errorCode.runtimeError", "SOAP header value: " + header.getNamespaceURI() + ":" + header.getName() + " already set."));
else
mc.getResponseMessage().getSOAPEnvelope().addHeader(header);
} else {
throw new cfmRunTimeException(catchDataFactory.generalException("errorCode.runtimeError", "Could not set SOAP header value. MessageContext response message is not available. " + "Be sure this is being called from a CFC web service function."));
}
} catch (AxisFault ex) {
throw new cfmRunTimeException(catchDataFactory.javaMethodException("errorCode.javaException", ex.getClass().getName(), ex.getMessage(), ex));
}
return cfBooleanData.TRUE;
}