当前位置: 首页>>代码示例>>Java>>正文


Java Message.setMessageContext方法代码示例

本文整理汇总了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;
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:13,代码来源:TestWSSecuritySAMLKeyIdentifier.java

示例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);
    }
}
 
开发者ID:ibissource,项目名称:iaf,代码行数:53,代码来源:SoapWrapper.java

示例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;
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:14,代码来源:TestWSSecurityEncryptionParts.java

示例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();
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:14,代码来源:TestWSSecurityNew18.java

示例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;
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:14,代码来源:TestWSSecurityDataRef.java

示例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();
}
 
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:14,代码来源:TestWSSecurityTimestamp.java


注:本文中的org.apache.axis.Message.setMessageContext方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。