Search in sources :

Example 36 with SOAPHeaderBlock

use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.

the class TestClone method checkProcessed.

private void checkProcessed(SOAPHeader clonedHeader, SOAPHeaderBlock orgHeaderBlock) {
    SOAPHeaderBlock clonedHeaderBlock = (SOAPHeaderBlock) clonedHeader.getFirstChildWithName(orgHeaderBlock.getQName());
    assertThat(clonedHeaderBlock.isProcessed()).isEqualTo(processed == null ? orgHeaderBlock.isProcessed() : processed);
}
Also used : SOAPHeaderBlock(org.apache.axiom.soap.SOAPHeaderBlock)

Example 37 with SOAPHeaderBlock

use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.

the class TestClone method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPHeader header = soapFactory.createSOAPHeader();
    OMNamespace ns = soapFactory.createOMNamespace("urn:test", "p");
    SOAPHeaderBlock unprocessedHeaderBlock = header.addHeaderBlock("unprocessed", ns);
    SOAPHeaderBlock processedHeaderBlock = header.addHeaderBlock("processed", ns);
    processedHeaderBlock.setProcessed();
    SOAPCloneOptions options = new SOAPCloneOptions();
    options.setPreserveModel(true);
    options.setProcessedFlag(processed);
    SOAPHeader clonedHeader = (SOAPHeader) header.clone(options);
    checkProcessed(clonedHeader, unprocessedHeaderBlock);
    checkProcessed(clonedHeader, processedHeaderBlock);
}
Also used : OMNamespace(org.apache.axiom.om.OMNamespace) SOAPHeaderBlock(org.apache.axiom.soap.SOAPHeaderBlock) SOAPHeader(org.apache.axiom.soap.SOAPHeader) SOAPCloneOptions(org.apache.axiom.soap.SOAPCloneOptions)

Example 38 with SOAPHeaderBlock

use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.

the class TestCloneProcessedWithoutPreservingModel method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPHeaderBlock headerBlock = soapFactory.createSOAPHeaderBlock("test", soapFactory.createOMNamespace("urn:test", "p"));
    headerBlock.setProcessed();
    OMElement clone = (OMElement) headerBlock.clone(new SOAPCloneOptions());
    assertThat(clone).isNotInstanceOf(SOAPHeaderBlock.class);
}
Also used : SOAPHeaderBlock(org.apache.axiom.soap.SOAPHeaderBlock) OMElement(org.apache.axiom.om.OMElement) SOAPCloneOptions(org.apache.axiom.soap.SOAPCloneOptions)

Example 39 with SOAPHeaderBlock

use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.

the class TestExamineHeaderBlocksWithParser method runTest.

@Override
protected void runTest(SOAPEnvelope envelope) throws Throwable {
    String roleNextURI = spec.getNextRoleURI();
    Iterator<SOAPHeaderBlock> it = envelope.getHeader().examineHeaderBlocks(roleNextURI);
    assertThat(it.hasNext()).isTrue();
    SOAPHeaderBlock headerBlock = it.next();
    assertThat(headerBlock.getQName()).isEqualTo(new QName("http://example.org/RoleTest", "h2"));
    assertThat(headerBlock.getRole()).isEqualTo(roleNextURI);
    assertThat(it.hasNext()).isTrue();
    headerBlock = it.next();
    assertThat(headerBlock.getQName()).isEqualTo(new QName("http://example.org/RoleTest", "h7"));
    assertThat(headerBlock.getRole()).isEqualTo(roleNextURI);
    assertThat(it.hasNext()).isFalse();
}
Also used : QName(javax.xml.namespace.QName) SOAPHeaderBlock(org.apache.axiom.soap.SOAPHeaderBlock)

Example 40 with SOAPHeaderBlock

use of org.apache.axiom.soap.SOAPHeaderBlock in project webservices-axiom by apache.

the class TestGetHeaderBlocksWithNSURI method runTest.

@Override
protected void runTest() throws Throwable {
    SOAPEnvelope soapEnvelope = soapFactory.createSOAPEnvelope();
    SOAPHeader soapHeader = soapFactory.createSOAPHeader(soapEnvelope);
    OMNamespace namespace = soapFactory.createOMNamespace("http://www.example.org", "test");
    soapHeader.addHeaderBlock("echoOk1", namespace);
    soapHeader.addHeaderBlock("echoOk2", soapFactory.createOMNamespace("http://www.test1.org", "test1"));
    ArrayList<SOAPHeaderBlock> arrayList = soapHeader.getHeaderBlocksWithNSURI("http://www.test1.org");
    assertEquals("SOAP Header Test : - getHeaderBlocksWithNSURI returns an arrayList of incorrect size", 1, arrayList.size());
    assertEquals("SOAP Header Test : - headerBlock of given namespace uri mismatch", "http://www.test1.org", arrayList.get(0).getNamespace().getNamespaceURI());
}
Also used : OMNamespace(org.apache.axiom.om.OMNamespace) SOAPHeaderBlock(org.apache.axiom.soap.SOAPHeaderBlock) SOAPEnvelope(org.apache.axiom.soap.SOAPEnvelope) SOAPHeader(org.apache.axiom.soap.SOAPHeader)

Aggregations

SOAPHeaderBlock (org.apache.axiom.soap.SOAPHeaderBlock)40 SOAPHeader (org.apache.axiom.soap.SOAPHeader)22 QName (javax.xml.namespace.QName)15 OMNamespace (org.apache.axiom.om.OMNamespace)13 SOAPEnvelope (org.apache.axiom.soap.SOAPEnvelope)12 OMElement (org.apache.axiom.om.OMElement)8 OMAttribute (org.apache.axiom.om.OMAttribute)4 OMNode (org.apache.axiom.om.OMNode)4 SOAPBody (org.apache.axiom.soap.SOAPBody)4 SOAPProcessingException (org.apache.axiom.soap.SOAPProcessingException)4 BooleanAttributeAccessor (org.apache.axiom.ts.soap.BooleanAttributeAccessor)4 SOAPFault (org.apache.axiom.soap.SOAPFault)3 SOAPFaultDetail (org.apache.axiom.soap.SOAPFaultDetail)3 StringReader (java.io.StringReader)2 XMLStreamReader (javax.xml.stream.XMLStreamReader)2 OMSourcedElement (org.apache.axiom.om.OMSourcedElement)2 OMXMLParserWrapper (org.apache.axiom.om.OMXMLParserWrapper)2 BlobOMDataSource (org.apache.axiom.om.ds.BlobOMDataSource)2 SOAPCloneOptions (org.apache.axiom.soap.SOAPCloneOptions)2 SOAPFaultCode (org.apache.axiom.soap.SOAPFaultCode)2