本文整理汇总了Java中org.apache.axis.message.SOAPEnvelope类的典型用法代码示例。如果您正苦于以下问题:Java SOAPEnvelope类的具体用法?Java SOAPEnvelope怎么用?Java SOAPEnvelope使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SOAPEnvelope类属于org.apache.axis.message包,在下文中一共展示了SOAPEnvelope类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testEmptyPasswordProcessing
import org.apache.axis.message.SOAPEnvelope; //导入依赖的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);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:19,代码来源:TestWSSecurityNew5.java
示例2: testCreateBinarySecurityToken
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* A unit test for creating BinarySecurityTokens
*/
public void testCreateBinarySecurityToken() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
Document doc = unsignedEnvelope.getAsDocument();
WSSConfig.getNewInstance();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
BinarySecurity bst = new BinarySecurity(doc);
bst.setValueType(AP_REQ);
bst.setEncodingType(BASE64_NS);
bst.setToken("12345678".getBytes());
WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
if (LOG.isDebugEnabled()) {
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(doc);
LOG.debug(outputString);
}
assertTrue(AP_REQ.equals(bst.getValueType()));
assertTrue(BASE64_NS.equals(bst.getEncodingType()));
assertTrue(bst.getToken() != null);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:28,代码来源:TestWSSecurityKerberosTokenProfile.java
示例3: testEncryptionSigning
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* Test that encrypts and signs a WS-Security envelope, then performs
* verification and decryption <p/>
*
* @throws Exception
* Thrown when there is any problem in signing, encryption,
* decryption, or verification
*/
public void testEncryptionSigning() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
WSSecEncrypt encrypt = new WSSecEncrypt();
WSSecSignature sign = new WSSecSignature();
encrypt.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e");
sign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
LOG.info("Before Encryption....");
Document doc = unsignedEnvelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
Document encryptedDoc = encrypt.build(doc, crypto, secHeader);
Document encryptedSignedDoc = sign.build(encryptedDoc, crypto,
secHeader);
LOG.info("After Encryption....");
verify(encryptedSignedDoc);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:27,代码来源:TestWSSecurityNew6.java
示例4: testSigningEncryption
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* Test that signs and then encrypts a WS-Security envelope, then performs
* decryption and verification <p/>
*
* @throws Exception
* Thrown when there is any problem in signing, encryption,
* decryption, or verification
*/
public void testSigningEncryption() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
WSSecEncrypt encrypt = new WSSecEncrypt();
WSSecSignature sign = new WSSecSignature();
encrypt.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e");
sign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
LOG.info("Before Encryption....");
Document doc = unsignedEnvelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
Document signedDoc = sign.build(doc, crypto, secHeader);
Document encryptedSignedDoc = encrypt.build(signedDoc, crypto, secHeader);
LOG.info("After Encryption....");
verify(encryptedSignedDoc);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:26,代码来源:TestWSSecurityNew6.java
示例5: testSymmetricSignatureSHA1
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* Test signing a message body using a symmetric key with EncryptedKeySHA1
*/
public void testSymmetricSignatureSHA1() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
Document doc = unsignedEnvelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
WSSecSignature sign = new WSSecSignature();
sign.setKeyIdentifierType(WSConstants.ENCRYPTED_KEY_SHA1_IDENTIFIER);
sign.setSecretKey(keyData);
sign.setSignatureAlgorithm(SignatureMethod.HMAC_SHA1);
Document signedDoc = sign.build(doc, crypto, secHeader);
if (LOG.isDebugEnabled()) {
LOG.debug("Signed symmetric message SHA1:");
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(signedDoc);
LOG.debug(outputString);
}
verify(signedDoc);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:27,代码来源:TestWSSecurityNew17.java
示例6: testNoSOAPNamespacePrefix
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* Test signing a SOAP message that has no SOAP namespace prefix
*/
public void testNoSOAPNamespacePrefix() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
WSSecSignature sign = new WSSecSignature();
sign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
sign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
Document doc = unsignedEnvelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
secHeader.setActor("bob");
secHeader.insertSecurityHeader(doc);
Document signedDoc = sign.build(doc, crypto, secHeader);
if (LOG.isDebugEnabled()) {
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(signedDoc);
LOG.debug(outputString);
}
verify(signedDoc);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:24,代码来源:TestWSSecurityWSS60.java
示例7: testSignatureOID
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* Test signing a SOAP message using a cert with an OID
*/
public void testSignatureOID() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
WSSecSignature sign = new WSSecSignature();
sign.setUserInfo("wss86", "security");
sign.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
Document doc = unsignedEnvelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
Document signedDoc = sign.build(doc, crypto, secHeader);
if (LOG.isDebugEnabled()) {
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(signedDoc);
LOG.debug(outputString);
}
verify(signedDoc);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:23,代码来源:TestWSSecurityWSS86.java
示例8: testEncryptionDecryptionOAEP
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* Test that encrypt and decrypt a WS-Security envelope.
* This test uses the RSA OAEP algorithm to transport (wrap) the symmetric
* key.
* <p/>
*
* @throws Exception Thrown when there is any problem in signing or verification
*/
public void testEncryptionDecryptionOAEP() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
WSSecEncrypt builder = new WSSecEncrypt();
builder.setUserInfo("wss40");
builder.setKeyIdentifierType(WSConstants.X509_KEY_IDENTIFIER);
builder.setKeyEnc(WSConstants.KEYTRANSPORT_RSAOEP);
Document doc = unsignedEnvelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
LOG.info("Before Encryption Triple DES/RSA-OAEP....");
Document encryptedDoc = builder.build(doc, crypto, secHeader);
LOG.info("After Encryption Triple DES/RSA-OAEP....");
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(encryptedDoc);
if (LOG.isDebugEnabled()) {
LOG.debug("Encrypted message, RSA-OAEP keytransport, 3DES:");
LOG.debug(outputString);
}
assertTrue(outputString.indexOf("LogTestService2") == -1 ? true : false);
verify(encryptedDoc, SOAP_BODY);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:32,代码来源:TestWSSecurityNew2.java
示例9: testEncryptionEncryption
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* Test that encrypt and then again encrypts (Super encryption) WS-Security
* envelope and then verifies ist <p/>
*
* @throws Exception
* Thrown when there is any problem in encryption or
* verification
*/
public void testEncryptionEncryption() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
WSSecEncrypt encrypt = new WSSecEncrypt();
encrypt.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e");
LOG.info("Before Encryption....");
Document doc = unsignedEnvelope.getAsDocument();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
Document encryptedDoc = encrypt.build(doc, crypto, secHeader);
Document encryptedEncryptedDoc = encrypt.build(encryptedDoc, crypto,
secHeader);
LOG.info("After Encryption....");
verify(encryptedEncryptedDoc);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:25,代码来源:TestWSSecurityNew7.java
示例10: processMessage
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
public void processMessage(MessageContext msgContext, SOAPEnvelope reqEnv, SOAPEnvelope resEnv, Object obj) throws Exception {
RPCElement body = getBody(reqEnv, msgContext);
OperationDesc operation = getOperationDesc(msgContext, body);
AxisRpcInterceptor interceptor = new AxisRpcInterceptor(operation, msgContext);
SOAPMessage message = msgContext.getMessage();
try {
message.getSOAPPart().getEnvelope();
msgContext.setProperty(org.apache.axis.SOAPPart.ALLOW_FORM_OPTIMIZATION, Boolean.FALSE);
RpcContainer container = (RpcContainer) ejbDeployment.getContainer();
Object[] arguments = {msgContext, interceptor};
Class callInterface = ejbDeployment.getServiceEndpointInterface();
Object result = container.invoke(ejbDeployment.getDeploymentID(), InterfaceType.SERVICE_ENDPOINT, callInterface, operation.getMethod(), arguments, null);
interceptor.createResult(result);
} catch (ApplicationException e) {
interceptor.createExceptionResult(e.getCause());
} catch (Throwable throwable) {
throw new AxisFault("Web Service EJB Invocation failed: method " + operation.getMethod(), throwable);
}
}
开发者ID:apache,项目名称:tomee,代码行数:27,代码来源:EjbRpcProvider.java
示例11: createResult
import org.apache.axis.message.SOAPEnvelope; //导入依赖的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);
}
}
开发者ID:apache,项目名称:tomee,代码行数:19,代码来源:EjbRpcProvider.java
示例12: main
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
public static void main(String[] args) throws Exception {
try {
Options opts = new Options(args);
Service service = new Service();
Call call = (Call) service.createCall();
call.setTargetEndpointAddress(new java.net.URL(opts.getURL()));
SOAPEnvelope env = new SOAPEnvelope();
SOAPBodyElement sbe = new SOAPBodyElement(XMLUtils.StringToElement("http://localhost:8080/LogTestService", "testMethod", ""));
env.addBodyElement(sbe);
env = new SignedSOAPEnvelope(env, "http://xml-security");
System.out.println("\n============= Request ==============");
XMLUtils.PrettyElementToStream(env.getAsDOM(), System.out);
call.invoke(env);
MessageContext mc = call.getMessageContext();
System.out.println("\n============= Response ==============");
XMLUtils.PrettyElementToStream(mc.getResponseMessage().getSOAPEnvelope().getAsDOM(), System.out);
}
catch (Exception e) {
e.printStackTrace();
}
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:28,代码来源:Client.java
示例13: getSOAPEnvelopeAsDocument
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
private Document getSOAPEnvelopeAsDocument(SOAPEnvelope env, MessageContext msgContext)
throws Exception {
StringWriter writer = new StringWriter();
SerializationContext serializeContext = new SerializationContext(writer, msgContext);
env.output(serializeContext);
writer.close();
Reader reader = new StringReader(writer.getBuffer().toString());
Document doc = XMLUtils.newDocument(new InputSource(reader));
if (doc == null)
throw new Exception(
Messages.getMessage("noDoc00", writer.getBuffer().toString()));
return doc;
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:15,代码来源:SignedSOAPEnvelope.java
示例14: doTest
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* Send a hardcoded message to the server, and print the response.
*
* @param args the command line arguments (mainly for specifying URL)
* @param op an optional service argument, which will be used for
* specifying the transport-level service
*/
public static String doTest (String args[], String op) throws Exception {
Options opts = new Options( args );
String url = opts.getURL();
String action = "EchoService" ;
if (op != null) action = op;
args = opts.getRemainingArgs();
if ( args != null ) action = args[0];
InputStream input = new ByteArrayInputStream(msg.getBytes());
Service service = new Service();
Call call = (Call) service.createCall();
SOAPEnvelope env = new SOAPEnvelope(input);
call.setTargetEndpointAddress( new URL(url) );
if (action != null) {
call.setUseSOAPAction( true );
call.setSOAPActionURI( action );
}
System.out.println( "Request:\n" + msg );
env = call.invoke( env );
System.out.println( "Response:\n" + env.toString() );
return( env.toString() );
}
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:36,代码来源:TestClient.java
示例15: invoke
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
@Override
public void invoke(MessageContext msgContext) throws AxisFault {
final SOAPEnvelope envelope = msgContext.getResponseMessage().getSOAPEnvelope();
for (SOAPHeaderElement she : envelope.getHeaders()) {
she.setProcessed(true);
}
}
开发者ID:laverca,项目名称:laverca,代码行数:10,代码来源:HeaderHandler.java
示例16: getSOAPRequestHeader
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
public static Object getSOAPRequestHeader(PageContext pc, String namespace, String name, boolean asXML) throws Exception {
MessageContext context = MessageContext.getCurrentContext();
if(context==null || context.isClient()) throw new AxisFault("not inside a Soap Request");
SOAPEnvelope env = context.getRequestMessage().getSOAPEnvelope();
SOAPHeaderElement header = env.getHeaderByName(namespace, name);
return toValue(header,asXML);
}
开发者ID:lucee,项目名称:Lucee4,代码行数:9,代码来源:AxisUtil.java
示例17: getSOAPResponseHeader
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
public static Object getSOAPResponseHeader(PageContext pc, WSClient client, String namespace, String name, boolean asXML) throws Exception {
MessageContext context = getMessageContext(client);
SOAPEnvelope env = context.getResponseMessage().getSOAPEnvelope();
SOAPHeaderElement header = env.getHeaderByName(namespace, name);
return toValue(header,asXML);
}
开发者ID:lucee,项目名称:Lucee4,代码行数:8,代码来源:AxisUtil.java
示例18: addSOAPResponseHeader
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
public static void addSOAPResponseHeader(String namespace, String name, Object value, boolean mustUnderstand) throws AxisFault {
MessageContext context = MessageContext.getCurrentContext();
if(context==null || context.isClient()) throw new AxisFault("not inside a Soap Request");
SOAPEnvelope env = context.getResponseMessage().getSOAPEnvelope();
SOAPHeaderElement header=toSOAPHeaderElement(namespace,name,value);
header.setMustUnderstand(mustUnderstand);
env.addHeader(header);
}
开发者ID:lucee,项目名称:Lucee4,代码行数:10,代码来源:AxisUtil.java
示例19: testSignBST
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* A test for signing a Kerberos BST
*/
public void testSignBST() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
Document doc = unsignedEnvelope.getAsDocument();
WSSConfig.getNewInstance();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
BinarySecurity bst = new BinarySecurity(doc);
bst.setValueType(AP_REQ);
bst.setEncodingType(BASE64_NS);
bst.setToken("12345678".getBytes());
bst.setID("Id-" + bst.hashCode());
WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
WSSecSignature sign = new WSSecSignature();
sign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
sign.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
Vector parts = new Vector();
WSEncryptionPart encP =
new WSEncryptionPart(bst.getID());
parts.add(encP);
sign.setParts(parts);
Document signedDoc = sign.build(doc, crypto, secHeader);
if (LOG.isDebugEnabled()) {
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(signedDoc);
LOG.debug(outputString);
}
verify(signedDoc);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:39,代码来源:TestWSSecurityKerberosTokenProfile.java
示例20: testSignBSTTimestamp
import org.apache.axis.message.SOAPEnvelope; //导入依赖的package包/类
/**
* A test for signing a Kerberos BST as well as a Timestamp
*/
public void testSignBSTTimestamp() throws Exception {
SOAPEnvelope unsignedEnvelope = message.getSOAPEnvelope();
Document doc = unsignedEnvelope.getAsDocument();
WSSConfig.getNewInstance();
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
BinarySecurity bst = new BinarySecurity(doc);
bst.setValueType(AP_REQ);
bst.setEncodingType(BASE64_NS);
bst.setToken("12345678".getBytes());
bst.setID("Id-" + bst.hashCode());
WSSecurityUtil.prependChildElement(secHeader.getSecurityHeader(), bst.getElement());
WSSecTimestamp timestamp = new WSSecTimestamp();
timestamp.setTimeToLive(600);
timestamp.build(doc, secHeader);
WSSecSignature sign = new WSSecSignature();
sign.setUserInfo("16c73ab6-b892-458f-abf5-2f875f74882e", "security");
sign.setKeyIdentifierType(WSConstants.ISSUER_SERIAL);
Vector parts = new Vector();
parts.add(new WSEncryptionPart(bst.getID()));
parts.add(new WSEncryptionPart(timestamp.getId()));
sign.setParts(parts);
Document signedDoc = sign.build(doc, crypto, secHeader);
if (LOG.isDebugEnabled()) {
String outputString =
org.apache.ws.security.util.XMLUtils.PrettyDocumentToString(signedDoc);
LOG.debug(outputString);
}
verify(signedDoc);
}
开发者ID:wso2,项目名称:wso2-wss4j,代码行数:42,代码来源:TestWSSecurityKerberosTokenProfile.java
注:本文中的org.apache.axis.message.SOAPEnvelope类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论