本文整理汇总了Java中org.apache.axis.Message.getSOAPEnvelope方法的典型用法代码示例。如果您正苦于以下问题:Java Message.getSOAPEnvelope方法的具体用法?Java Message.getSOAPEnvelope怎么用?Java Message.getSOAPEnvelope使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.axis.Message
的用法示例。
在下文中一共展示了Message.getSOAPEnvelope方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testEmptyPasswordProcessing
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* Test that processes a UserNameToken with an empty password
*/
public void testEmptyPasswordProcessing() throws Exception {
InputStream in = new ByteArrayInputStream(EMPTY_PASSWORD_MSG.getBytes());
Message msg = new Message(in);
msg.setMessageContext(msgContext);
SOAPEnvelope utEnvelope = msg.getSOAPEnvelope();
Document doc = utEnvelope.getAsDocument();
if (LOG.isDebugEnabled()) {
LOG.debug("Empty password message: ");
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
LOG.debug(outputString);
}
verify(doc);
}
示例2: createResult
import org.apache.axis.Message; //导入方法依赖的package包/类
public void createResult(Object object) {
messageContext.setPastPivot(true);
try {
Message requestMessage = messageContext.getRequestMessage();
SOAPEnvelope requestEnvelope = requestMessage.getSOAPEnvelope();
RPCElement requestBody = getBody(requestEnvelope, messageContext);
Message responseMessage = messageContext.getResponseMessage();
SOAPEnvelope responseEnvelope = responseMessage.getSOAPEnvelope();
ServiceDesc serviceDescription = messageContext.getService().getServiceDescription();
RPCElement responseBody = createResponseBody(requestBody, messageContext, operation, serviceDescription, object, responseEnvelope, getInOutParams());
responseEnvelope.removeBody();
responseEnvelope.addBodyElement(responseBody);
} catch (Exception e) {
throw new ServerRuntimeException("Failed while creating response message body", e);
}
}
示例3: invoke
import org.apache.axis.Message; //导入方法依赖的package包/类
public void invoke(MessageContext msgContext) throws AxisFault {
Message requestMessage = msgContext.getRequestMessage();
Message responseMessage = new Message(requestMessage.getSOAPEnvelope());
String[] fooHeader = requestMessage.getMimeHeaders().getHeader("foo");
if (fooHeader != null) {
responseMessage.getMimeHeaders().addHeader("foo", fooHeader[0]);
}
msgContext.setResponseMessage(responseMessage);
}
示例4: testUsernameTokenNoPasswordType
import org.apache.axis.Message; //导入方法依赖的package包/类
/**
* Test that adds a UserNameToken with no password type to a WS-Security envelope
* See WSS-152 - https://issues.apache.org/jira/browse/WSS-152
* "Problem with processing Username Tokens with no password type"
* The 1.1 spec states that the password type is optional and defaults to password text,
* and so we should handle an incoming Username Token accordingly.
*/
public void testUsernameTokenNoPasswordType() throws Exception {
InputStream in = new ByteArrayInputStream(SOAPUTMSG.getBytes());
Message msg = new Message(in);
msg.setMessageContext(msgContext);
SOAPEnvelope utEnvelope = msg.getSOAPEnvelope();
Document doc = utEnvelope.getAsDocument();
if (LOG.isDebugEnabled()) {
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
LOG.debug(outputString);
}
verify(doc);
}
示例5: 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);
}
}
示例6: demarshallArguments
import org.apache.axis.Message; //导入方法依赖的package包/类
private Object[] demarshallArguments() throws Exception {
SOAPMessage message = messageContext.getMessage();
messageContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.TRUE);
if (message != null) {
message.saveChanges();
}
try {
Message reqMsg = messageContext.getRequestMessage();
SOAPEnvelope requestEnvelope = reqMsg.getSOAPEnvelope();
RPCElement body = getBody(requestEnvelope, messageContext);
body.setNeedDeser(true);
Vector args = null;
try {
args = body.getParams();
} catch (SAXException e) {
if (e.getException() != null) {
throw e.getException();
}
throw e;
}
Object[] argValues = new Object[operation.getNumParams()];
for (int i = 0; i < args.size(); i++) {
RPCParam rpcParam = (RPCParam) args.get(i);
Object value = rpcParam.getObjectValue();
ParameterDesc paramDesc = rpcParam.getParamDesc();
if (paramDesc != null && paramDesc.getJavaType() != null) {
value = JavaUtils.convert(value, paramDesc.getJavaType());
rpcParam.setObjectValue(value);
}
int order = (paramDesc == null || paramDesc.getOrder() == -1) ? i : paramDesc.getOrder();
argValues[order] = value;
}
return argValues;
} finally {
messageContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE);
}
}
示例7: 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();
}
示例8: 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();
}