本文整理汇总了Java中org.apache.axis.Message.setMessageContext方法的典型用法代码示例。如果您正苦于以下问题:Java Message.setMessageContext方法的具体用法?Java Message.setMessageContext怎么用?Java Message.setMessageContext使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis.Message
的用法示例。
在下文中一共展示了Message.setMessageContext方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSOAPMessage
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* Constructs a soap envelope
*
* @return soap envelope
* @throws Exception if there is any problem constructing the soap envelope
*/
protected Message getSOAPMessage() throws Exception {
InputStream in = new ByteArrayInputStream(SOAPMSG.getBytes());
Message msg = new Message(in);
msg.setMessageContext(msgContext);
return msg;
}
示例2: signMessage
import org.apache.axis.Message; //导入方法依赖的package包/类
public String signMessage(String soapMessage, String user, String password) throws SenderException {
try {
WSSecurityEngine secEngine = WSSecurityEngine.getInstance();
WSSConfig config = secEngine.getWssConfig();
config.setPrecisionInMilliSeconds(false);
// create context
AxisClient tmpEngine = new AxisClient(new NullProvider());
MessageContext msgContext = new MessageContext(tmpEngine);
InputStream in = new ByteArrayInputStream(soapMessage.getBytes());
Message msg = new Message(in);
msg.setMessageContext(msgContext);
// create unsigned envelope
SOAPEnvelope unsignedEnvelope = msg.getSOAPEnvelope();
Document doc = unsignedEnvelope.getAsDocument();
// create security header and insert it into unsigned envelope
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
// add a UsernameToken
WSSecUsernameToken tokenBuilder = new WSSecUsernameToken();
tokenBuilder.setPasswordType(WSConstants.PASSWORD_DIGEST);
tokenBuilder.setUserInfo(user, password);
tokenBuilder.addNonce();
tokenBuilder.addCreated();
tokenBuilder.prepare(doc);
WSSecSignature sign = new WSSecSignature();
sign.setUsernameToken(tokenBuilder);
sign.setKeyIdentifierType(WSConstants.UT_SIGNING);
sign.setSignatureAlgorithm(XMLSignature.ALGO_ID_MAC_HMAC_SHA1);
sign.build(doc, null, secHeader);
tokenBuilder.prependToHeader(secHeader);
// add a Timestamp
WSSecTimestamp timestampBuilder = new WSSecTimestamp();
timestampBuilder.setTimeToLive(300);
timestampBuilder.prepare(doc);
timestampBuilder.prependToHeader(secHeader);
Document signedDoc = doc;
return DOM2Writer.nodeToString(signedDoc);
} catch (Exception e) {
throw new SenderException(e);
}
}
示例3: getSOAPMessage
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* Constructs a soap envelope
* <p/>
*
* @return soap envelope
* @throws Exception if there is any problem constructing the soap envelope
*/
protected Message getSOAPMessage() throws Exception {
InputStream in = new ByteArrayInputStream(SOAPMSG.getBytes());
Message msg = new Message(in);
msg.setMessageContext(msgContext);
return msg;
}
示例4: getSOAPEnvelope
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* Constructs a soap envelope
* <p/>
*
* @return soap envelope
* @throws java.lang.Exception if there is any problem constructing the soap envelope
*/
protected SOAPEnvelope getSOAPEnvelope() throws Exception {
InputStream in = new ByteArrayInputStream(SOAPMSG.getBytes());
Message msg = new Message(in);
msg.setMessageContext(msgContext);
return msg.getSOAPEnvelope();
}
示例5: getSOAPMessage
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* Constructs a soap envelope <p/>
*
* @return soap envelope
* @throws Exception
* if there is any problem constructing the soap envelope
*/
protected Message getSOAPMessage() throws Exception {
InputStream in = new ByteArrayInputStream(SOAPMSG.getBytes());
Message msg = new Message(in);
msg.setMessageContext(msgContext);
return msg;
}
示例6: getSOAPEnvelope
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* Constructs a soap envelope
* <p/>
*
* @return soap envelope
* @throws java.lang.Exception if there is any problem constructing the soap envelope
*/
protected SOAPEnvelope getSOAPEnvelope() throws Exception {
InputStream in = new ByteArrayInputStream(soapMsg.getBytes());
Message msg = new Message(in);
msg.setMessageContext(msgContext);
return msg.getSOAPEnvelope();
}