Examples of MessageImpl


Examples of org.apache.cxf.message.MessageImpl

    private void setUpInMessage() {
        inMessage.setExchange(new ExchangeImpl());
    }
   
    private Message setUpOutMessage() {
        Message outMsg = new MessageImpl();
        outMsg.putAll(inMessage);
        outMsg.setExchange(new ExchangeImpl());
        outMsg.put(Message.PROTOCOL_HEADERS,
                   new TreeMap<String, List<String>>(String.CASE_INSENSITIVE_ORDER));
        return outMsg;
    }
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

    public void testPermit() throws Exception {
        // Mock up a Security Context
        SecurityContext sc = createSecurityContext("alice", "manager");
       
        String operation = "{http://www.example.org/contract/DoubleIt}DoubleIt";
        MessageImpl msg = new MessageImpl();
        msg.put(Message.WSDL_OPERATION, QName.valueOf(operation));
        String service = "{http://www.example.org/contract/DoubleIt}DoubleItService";
        msg.put(Message.WSDL_SERVICE, QName.valueOf(service));
        String resourceURI = "https://localhost:8080/doubleit";
        msg.put(Message.REQUEST_URI, resourceURI);
        msg.put(SecurityContext.class, sc);
       
        XACMLAuthorizingInterceptor authorizingInterceptor =
            new XACMLAuthorizingInterceptor();
        authorizingInterceptor.handleMessage(msg);
    }
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

    public void testDeny() throws Exception {
        // Mock up a Security Context
        SecurityContext sc = createSecurityContext("alice", "boss");
       
        String operation = "{http://www.example.org/contract/DoubleIt}DoubleIt";
        MessageImpl msg = new MessageImpl();
        msg.put(Message.WSDL_OPERATION, QName.valueOf(operation));
        String service = "{http://www.example.org/contract/DoubleIt}DoubleItService";
        msg.put(Message.WSDL_SERVICE, QName.valueOf(service));
        String resourceURI = "https://localhost:8080/doubleit";
        msg.put(Message.REQUEST_URI, resourceURI);
        msg.put(SecurityContext.class, sc);
       
        XACMLAuthorizingInterceptor authorizingInterceptor =
            new XACMLAuthorizingInterceptor();
       
        try {
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

    @Test
    public void testSoap11Out() throws Exception {
        String faultString = "Hadrian caused this Fault!";
        SoapFault fault = new SoapFault(faultString, Soap11.getInstance().getSender());

        SoapMessage m = new SoapMessage(new MessageImpl());
        m.setExchange(new ExchangeImpl());
        m.setContent(Exception.class, fault);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
        XMLStreamWriter writer = StaxUtils.createXMLStreamWriter(out);
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

        SoapFault fault = new SoapFault(faultString, Soap12.getInstance().getSender());
       
        QName qname = new QName("http://cxf.apache.org/soap/fault", "invalidsoap", "cxffaultcode");
        fault.setSubCode(qname);

        SoapMessage m = new SoapMessage(new MessageImpl());
        m.setVersion(Soap12.getInstance());
       
        m.setContent(Exception.class, fault);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

        SoapFault fault = new SoapFault(faultString, Soap12.getInstance().getSender());
       
        fault.addSubCode(new QName("http://cxf.apache.org/soap/fault", "invalidsoap", "cxffaultcode"));
        fault.addSubCode(new QName("http://cxf.apache.org/soap/fault2", "invalidsoap2", "cxffaultcode2"));

        SoapMessage m = new SoapMessage(new MessageImpl());
        m.setVersion(Soap12.getInstance());
       
        m.setContent(Exception.class, fault);

        ByteArrayOutputStream out = new ByteArrayOutputStream();
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

    }

    @Test
    public void testCXF1864() throws Exception {

        SoapMessage m = new SoapMessage(new MessageImpl());
        m.setVersion(Soap12.getInstance());       


        XMLStreamReader reader = StaxUtils.createXMLStreamReader(this.getClass()
                                                                 .getResourceAsStream("cxf1864.xml"));
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

    }

    @Test
    public void testCXF4181() throws Exception {
        //Try WITH SAAJ
        SoapMessage m = new SoapMessage(new MessageImpl());
        m.put(Message.HTTP_REQUEST_METHOD, "POST");
        m.setVersion(Soap12.getInstance());       
        XMLStreamReader reader = StaxUtils.createXMLStreamReader(this.getClass()
                                                                 .getResourceAsStream("cxf4181.xml"));

        m.setContent(XMLStreamReader.class, reader);

        new SAAJPreInInterceptor().handleMessage(m);
        new ReadHeadersInterceptor(null).handleMessage(m);
        new StartBodyInterceptor().handleMessage(m);
        new SAAJInInterceptor().handleMessage(m);
        new Soap12FaultInInterceptor().handleMessage(m);

        Node nd = m.getContent(Node.class);
       
        SOAPPart part = (SOAPPart)nd;
        assertEquals("S", part.getEnvelope().getPrefix());
        assertEquals("S2", part.getEnvelope().getHeader().getPrefix());
        assertEquals("S3", part.getEnvelope().getBody().getPrefix());
        SOAPFault fault = part.getEnvelope().getBody().getFault();
        assertEquals("S", fault.getPrefix());
       
        assertEquals("Authentication Failure", fault.getFaultString());
       
        SoapFault fault2 = (SoapFault)m.getContent(Exception.class);
        assertNotNull(fault2);
       
        assertEquals(Soap12.getInstance().getSender(), fault2.getFaultCode());
        assertEquals(new QName("http://schemas.xmlsoap.org/ws/2005/02/trust", "FailedAuthentication"),
                     fault2.getSubCode());
       
        Element el = part.getEnvelope().getBody();
        nd = el.getFirstChild();
        int count = 0;
        while (nd != null) {
            if (nd instanceof Element) {
                count++;
            }
            nd = nd.getNextSibling();
        }
        assertEquals(1, count);
       
       
        //Try WITHOUT SAAJ
        m = new SoapMessage(new MessageImpl());
        m.setVersion(Soap12.getInstance())
        reader = StaxUtils.createXMLStreamReader(this.getClass()
                                                 .getResourceAsStream("cxf4181.xml"));

        m.setContent(XMLStreamReader.class, reader);
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

   
   
    @Test
    public void testCXF5493() throws Exception {

        SoapMessage m = new SoapMessage(new MessageImpl());
        m.setVersion(Soap11.getInstance());       


        XMLStreamReader reader = StaxUtils.createXMLStreamReader(this.getClass()
                                                                 .getResourceAsStream("cxf5493.xml"));
        m.setContent(XMLStreamReader.class, reader);
        reader.nextTag(); //env
        reader.nextTag(); //body
        reader.nextTag(); //fault

        Soap11FaultInInterceptor inInterceptor = new Soap11FaultInInterceptor();
        inInterceptor.handleMessage(m);

        SoapFault fault2 = (SoapFault)m.getContent(Exception.class);
        assertNotNull(fault2);
        assertEquals(Soap11.getInstance().getReceiver(), fault2.getFaultCode());
        assertEquals("some text containing a xml tag <xml-tag>", fault2.getMessage());
       
       
       
        m = new SoapMessage(new MessageImpl());
        m.put(Message.HTTP_REQUEST_METHOD, "POST");
        m.setVersion(Soap11.getInstance());       
        reader = StaxUtils.createXMLStreamReader(this.getClass().getResourceAsStream("cxf5493.xml"));

        m.setContent(XMLStreamReader.class, reader);
View Full Code Here

Examples of org.apache.cxf.message.MessageImpl

public class SearchContextImplTest extends Assert {

    @Test
    public void testPlainQuery1() {
        Message m = new MessageImpl();
        m.put("search.use.plain.queries", true);
        m.put(Message.QUERY_STRING, "a=b");
        String exp = new SearchContextImpl(m).getSearchExpression();
        assertEquals("a==b", exp);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.