use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.
the class AxiomSoapMessageFactoryTest method testCreateWebServiceMessage.
/**
* Regression test for <a href="https://issues.apache.org/jira/browse/AXIOM-444">AXIOM-444</a>.
*
* @throws Exception
*/
public void testCreateWebServiceMessage() throws Exception {
AxiomSoapMessageFactory mf = new AxiomSoapMessageFactory();
mf.afterPropertiesSet();
AxiomSoapMessage swsMessage = mf.createWebServiceMessage();
SOAPMessage message = swsMessage.getAxiomMessage();
// Spring-WS uses SOAPFactory#createSOAPMessage(OMXMLParserWrapper) with a null argument.
// We need to make sure that we nevertheless get a SOAPMessage that is in state complete.
assertTrue(message.isComplete());
}
use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.
the class TestCreateSOAPModelBuilderFromSAXSource method runTest.
@Override
protected void runTest() throws Throwable {
SAXParserFactory parserFactory = SAXImplementation.XERCES.newSAXParserFactory();
parserFactory.setNamespaceAware(true);
XMLReader reader = parserFactory.newSAXParser().getXMLReader();
SOAPSample sample = SOAPSampleSet.SIMPLE_FAULT.getMessage(spec);
InputStream in = sample.getInputStream();
InputSource is = new InputSource(in);
is.setEncoding(sample.getEncoding());
SOAPMessage message = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, new SAXSource(reader, is)).getSOAPMessage();
assertAbout(xml()).that(xml(OMDocument.class, message)).ignoringWhitespaceInPrologAndEpilog().hasSameContentAs(sample.getEnvelope());
assertThat(message.getSOAPEnvelope().getBody().getFault()).isNotNull();
}
use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.
the class TestLazySOAPFactorySelection method runTest.
@Override
protected void runTest() throws Throwable {
// Create a SOAP model builder without specifying the SOAP version.
SOAPMessage message = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, SOAPSampleSet.NO_HEADER.getMessage(spec).getInputStream(), null).getSOAPMessage();
// In some Axiom versions, this failed because at this stage, the SOAPFactory instance
// has not yet been determined.
((Document) message).createElementNS("urn:test", "p:test");
}
use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.
the class TestSerialize method runTest.
@Override
protected void runTest() throws Throwable {
SOAPMessage soapMessage = OMXMLBuilderFactory.createSOAPModelBuilder(metaFactory, message.getInputStream(), null).getSOAPMessage();
expansionStrategy.apply(soapMessage);
assertAbout(xml()).that(serializationStrategy.serialize(soapMessage).getInputSource()).ignoringRedundantNamespaceDeclarations().hasSameContentAs(message.getInputStream());
soapMessage.close(false);
}
use of org.apache.axiom.soap.SOAPMessage in project webservices-axiom by apache.
the class WSS4JTest method testSignature.
private void testSignature(String file, Vector<WSEncryptionPart> parts) throws Exception {
WSSecSignature sign = new WSSecSignature();
sign.setUserInfo("key1", "password");
sign.setKeyIdentifierType(WSConstants.BST_DIRECT_REFERENCE);
sign.setParts(parts);
SOAPMessage message = load(file);
Document doc = (Document) message;
WSSecHeader secHeader = new WSSecHeader();
secHeader.insertSecurityHeader(doc);
Document signedDoc = sign.build(doc, crypto, secHeader);
WSSecurityEngine secEngine = new WSSecurityEngine();
assertThat(secEngine.processSecurityHeader(signedDoc, null, null, crypto)).hasSize(2);
}
Aggregations