Examples of SwAServiceInterface


Examples of org.apache.cxf.swa.SwAServiceInterface

   
    @Test
    public void testSwa() throws Exception {
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
//        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
//                                                        "http://localhost:9037/swa");
       
        Holder<String> textHolder = new Holder<String>();
        Holder<DataHandler> data = new Holder<DataHandler>();
       
        ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
        DataHandler handler = new DataHandler(source);
       
        data.value = handler;
       
        textHolder.value = "Hi";

        port.echoData(textHolder, data);
        InputStream bis = null;
        bis = data.value.getDataSource().getInputStream();
        byte b[] = new byte[10];
        bis.read(b, 0, 10);
        String string = IOUtils.newStringFromBytes(b);
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

   
    @Test
    public void testSwaWithHeaders() throws Exception {
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
//        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
//                                                        "http://localhost:9037/swa");
       
        Holder<String> textHolder = new Holder<String>();
        Holder<String> headerHolder = new Holder<String>();
        Holder<DataHandler> data = new Holder<DataHandler>();
       
        ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
        DataHandler handler = new DataHandler(source);
       
        data.value = handler;
       
        textHolder.value = "Hi";
        headerHolder.value = "Header";

        port.echoDataWithHeader(textHolder, data, headerHolder);
        InputStream bis = null;
        bis = data.value.getDataSource().getInputStream();
        byte b[] = new byte[10];
        bis.read(b, 0, 10);
        String string = IOUtils.newStringFromBytes(b);
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

   
    @Test
    public void testSwaDataStruct() throws Exception {
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
//        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
//                                                        "http://localhost:9037/swa");
       
        Holder<DataStruct> structHolder = new Holder<DataStruct>();
       
        ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
        DataHandler handler = new DataHandler(source);
       
        DataStruct struct = new DataStruct();
        struct.setDataRef(handler);
        structHolder.value = struct;

        port.echoDataRef(structHolder);

        handler = structHolder.value.getDataRef();
        InputStream bis = null;
        bis = handler.getDataSource().getInputStream();
        byte b[] = new byte[10];
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

            return;
        }
       
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
       
        URL url1 = this.getClass().getResource("resources/attach.text");
        URL url2 = this.getClass().getResource("resources/attach.html");
        URL url3 = this.getClass().getResource("resources/attach.xml");
        URL url4 = this.getClass().getResource("resources/attach.jpeg1");
        URL url5 = this.getClass().getResource("resources/attach.jpeg2");

        DataHandler dh1 = new DataHandler(url1);
        DataHandler dh2 = new DataHandler(url2);
        DataHandler dh3 = new DataHandler(url3);
        //DataHandler dh4 = new DataHandler(url4);
        //DataHandler dh5 = new DataHandler(url5);
        Holder<DataHandler> attach1 = new Holder<DataHandler>();
        attach1.value = dh1;
        Holder<DataHandler> attach2 = new Holder<DataHandler>();
        attach2.value = dh2;
        Holder<Source> attach3 = new Holder<Source>();
        attach3.value = new StreamSource(dh3.getInputStream());
        Holder<Image> attach4 = new Holder<Image>();
        Holder<Image> attach5 = new Holder<Image>();
        attach4.value = ImageIO.read(url4);
        attach5.value = ImageIO.read(url5);
        VoidRequest request = new VoidRequest();
        OutputResponseAll response = port.echoAllAttachmentTypes(request, attach1, attach2, attach3, attach4,
                                                                 attach5);
        assertNotNull(response);
    }
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

   
    @Test
    public void testSwa() throws Exception {
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
        ((SOAPBinding) ((BindingProvider)port).getBinding()).setMTOMEnabled(true);
       
        Holder<DataStruct> structHolder = new Holder<DataStruct>();
        Holder<DataHandler> data = new Holder<DataHandler>();
       
        ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
        DataHandler handler = new DataHandler(source);
       
        DataStruct struct = new DataStruct();
        struct.setDataRef(handler);
        data.value = handler;
       
        structHolder.value = struct;

        port.echoData(structHolder, data);
        InputStream bis = null;
        bis = data.value.getDataSource().getInputStream();
        byte b[] = new byte[10];
        bis.read(b, 0, 10);
        String string = new String(b);
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

   
    @Test
    public void testSwa() throws Exception {
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
//        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
//                                                        "http://localhost:9037/swa");
       
        Holder<String> textHolder = new Holder<String>();
        Holder<DataHandler> data = new Holder<DataHandler>();
       
        ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
        DataHandler handler = new DataHandler(source);
       
        data.value = handler;
       
        textHolder.value = "Hi";

        port.echoData(textHolder, data);
        InputStream bis = null;
        bis = data.value.getDataSource().getInputStream();
        byte b[] = new byte[10];
        bis.read(b, 0, 10);
        String string = new String(b);
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

   
    @Test
    public void testSwaWithHeaders() throws Exception {
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
//        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
//                                                        "http://localhost:9037/swa");
       
        Holder<String> textHolder = new Holder<String>();
        Holder<String> headerHolder = new Holder<String>();
        Holder<DataHandler> data = new Holder<DataHandler>();
       
        ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
        DataHandler handler = new DataHandler(source);
       
        data.value = handler;
       
        textHolder.value = "Hi";
        headerHolder.value = "Header";

        port.echoDataWithHeader(textHolder, data, headerHolder);
        InputStream bis = null;
        bis = data.value.getDataSource().getInputStream();
        byte b[] = new byte[10];
        bis.read(b, 0, 10);
        String string = new String(b);
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

   
    @Test
    public void testSwaDataStruct() throws Exception {
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
//        ((BindingProvider)port).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
//                                                        "http://localhost:9037/swa");
       
        Holder<DataStruct> structHolder = new Holder<DataStruct>();
       
        ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
        DataHandler handler = new DataHandler(source);
       
        DataStruct struct = new DataStruct();
        struct.setDataRef(handler);
        structHolder.value = struct;

        port.echoDataRef(structHolder);

        handler = structHolder.value.getDataRef();
        InputStream bis = null;
        bis = handler.getDataSource().getInputStream();
        byte b[] = new byte[10];
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

            return;
        }
       
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
       
        URL url1 = this.getClass().getResource("resources/attach.text");
        URL url2 = this.getClass().getResource("resources/attach.html");
        URL url3 = this.getClass().getResource("resources/attach.xml");
        URL url4 = this.getClass().getResource("resources/attach.jpeg1");
        URL url5 = this.getClass().getResource("resources/attach.jpeg2");

        DataHandler dh1 = new DataHandler(url1);
        DataHandler dh2 = new DataHandler(url2);
        DataHandler dh3 = new DataHandler(url3);
        //DataHandler dh4 = new DataHandler(url4);
        //DataHandler dh5 = new DataHandler(url5);
        Holder<DataHandler> attach1 = new Holder<DataHandler>();
        attach1.value = dh1;
        Holder<DataHandler> attach2 = new Holder<DataHandler>();
        attach2.value = dh2;
        Holder<Source> attach3 = new Holder<Source>();
        attach3.value = new StreamSource(dh3.getInputStream());
        Holder<Image> attach4 = new Holder<Image>();
        Holder<Image> attach5 = new Holder<Image>();
        attach4.value = ImageIO.read(url4);
        attach5.value = ImageIO.read(url5);
        VoidRequest request = new VoidRequest();
        OutputResponseAll response = port.echoAllAttachmentTypes(request, attach1, attach2, attach3, attach4,
                                                                 attach5);
        assertNotNull(response);
    }
View Full Code Here

Examples of org.apache.cxf.swa.SwAServiceInterface

   
    @Test
    public void testSwaWithHeaders() throws Exception {
        SwAService service = new SwAService();
       
        SwAServiceInterface port = service.getSwAServiceHttpPort();
        setAddress(port, "http://localhost:" + serverPort + "/swa");
       
        Holder<String> textHolder = new Holder<String>();
        Holder<String> headerHolder = new Holder<String>();
        Holder<DataHandler> data = new Holder<DataHandler>();
       
        ByteArrayDataSource source = new ByteArrayDataSource("foobar".getBytes(), "application/octet-stream");
        DataHandler handler = new DataHandler(source);
       
        data.value = handler;
       
        textHolder.value = "Hi";
        headerHolder.value = "Header";

        port.echoDataWithHeader(textHolder, data, headerHolder);
        InputStream bis = null;
        bis = data.value.getDataSource().getInputStream();
        byte b[] = new byte[10];
        bis.read(b, 0, 10);
        String string = IOUtils.newStringFromBytes(b);
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.