Package org.apache.cxf.binding.soap.tcp.frames

Examples of org.apache.cxf.binding.soap.tcp.frames.SoapTcpFrame


       
        contentDesc.setParameters(parameters);
       
        final SoapTcpFrameHeader header =
            new SoapTcpFrameHeader(SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE, contentDesc);
        final SoapTcpFrame frame = new SoapTcpFrame();
        frame.setHeader(header);
        frame.setChannelId(0);
        try {
            frame.setPayload(openChannelMsg.getBytes("UTF-8"));
            SoapTcpUtils.writeMessageFrame(outStream, frame);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
       
        final SoapTcpFrame response = SoapTcpUtils.readMessageFrame(inStream);
        if (!SoapTcpUtils.checkSingleFrameResponse(response, "openChannelResponse")) {
            throw new IOException("Couldn't open new channel.");
        }
        //SoapTcpUtils.printSoapTcpFrame(System.out, response);
       
View Full Code Here


    public void thresholdNotReached() throws IOException {
        //Send single message if didn't send any message yet or end message if already send message
        if (messageSent) {
            SoapTcpFrameHeader header = new SoapTcpFrameHeader(SoapTcpFrameHeader.MESSAGE_END_CHUNK, null);
            header.setChannelId(channelId);
            SoapTcpFrame frame = new SoapTcpFrame();
            frame.setChannelId(channelId);
            frame.setHeader(header);
            frame.setPayload(this.buffer.toByteArray());
            SoapTcpUtils.writeMessageFrame(outStream, frame);
        } else {
            final SoapTcpFrameContentDescription contentDesc = new SoapTcpFrameContentDescription();
            contentDesc.setContentId(0);
           
            final Map<Integer, String> parameters = new Hashtable<Integer, String>();
            parameters.put(0, "utf-8");
           
            contentDesc.setParameters(parameters);
           
            final SoapTcpFrameHeader header =
                new SoapTcpFrameHeader(SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE, contentDesc);
            header.setChannelId(channelId);
            final SoapTcpFrame frame = new SoapTcpFrame();
            frame.setHeader(header);
            frame.setChannelId(channelId);
            frame.setPayload(this.buffer.toByteArray());
            SoapTcpUtils.writeMessageFrame(outStream, frame);
            messageSent = true;
        }
    }
View Full Code Here

    public void thresholdReached() throws IOException {
        //Send start-chunk message if didn't send any message yet or message chunk if already send message
        if (messageSent) {
            SoapTcpFrameHeader header = new SoapTcpFrameHeader(SoapTcpFrameHeader.MESSAGE_CHUNK, null);
            header.setChannelId(channelId);
            SoapTcpFrame frame = new SoapTcpFrame();
            frame.setChannelId(channelId);
            frame.setHeader(header);
            frame.setPayload(this.buffer.toByteArray());
            SoapTcpUtils.writeMessageFrame(outStream, frame);
        } else {
            SoapTcpFrameContentDescription contentDesc = new SoapTcpFrameContentDescription();
            contentDesc.setContentId(0);
           
            Map<Integer, String> parameters = new Hashtable<Integer, String>();
            parameters.put(0, "utf-8");
           
            contentDesc.setParameters(parameters);
           
            SoapTcpFrameHeader header =
                new SoapTcpFrameHeader(SoapTcpFrameHeader.MESSAGE_START_CHUNK, contentDesc);
            header.setChannelId(channelId);
            SoapTcpFrame frame = new SoapTcpFrame();
            frame.setHeader(header);
            frame.setChannelId(channelId);
            frame.setPayload(this.buffer.toByteArray());
            SoapTcpUtils.writeMessageFrame(outStream, frame);
            messageSent = true;
        }
    }
View Full Code Here

    protected void onFirstWrite() throws IOException {
       
    }
   
    private InputStream getResponse() {
        SoapTcpFrame responseMessage = null;
        try {
            responseMessage = SoapTcpUtils.readMessageFrame(inStream);
        } catch (IOException e2) {
            e2.printStackTrace();
        }
        if (responseMessage != null) {
            int frameType = responseMessage.getHeader().getFrameType();
            if (frameType == SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE
                || frameType == SoapTcpFrameHeader.ERROR_MESSAGE
                || frameType == SoapTcpFrameHeader.NULL_MESSAGE) {
                return new ByteArrayInputStream(responseMessage.getPayload());
            } else if (frameType == SoapTcpFrameHeader.MESSAGE_START_CHUNK) {
                ByteArrayOutputStream baos = new ByteArrayOutputStream(4 * chunkSize);
                try {
                    baos.write(responseMessage.getPayload());
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
                while (frameType != SoapTcpFrameHeader.MESSAGE_END_CHUNK) {
                    try {
                        SoapTcpFrame frame = SoapTcpUtils.readMessageFrame(inStream);
                        baos.write(frame.getPayload());
                    } catch (IOException e) {
                        break;
                    }
                }
                return new ByteArrayInputStream(baos.toByteArray());
View Full Code Here

     * @return
     * @throws IOException
     */
    public static SoapTcpFrame readMessageFrame(final InputStream inputStream) throws IOException
    {
        final SoapTcpFrame frame = new SoapTcpFrame();
        final SoapTcpFrameHeader header = new SoapTcpFrameHeader();
        frame.setHeader(header);
       
        final int response[] = new int[2]; //[0] channel-id, [1] message-id
        DataCodingUtils.readInts4(inputStream, response, 2);
       
        frame.setChannelId(response[0]);
        header.setChannelId(response[0]);
        header.setFrameType(response[1]);
        switch(response[1]) {
        case SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE:
            header.setContentDescription(readContentDescription(inputStream));
            break;
        case SoapTcpFrameHeader.MESSAGE_START_CHUNK:
            header.setContentDescription(readContentDescription(inputStream));
            break;
        case SoapTcpFrameHeader.MESSAGE_CHUNK:
            break;
        case SoapTcpFrameHeader.MESSAGE_END_CHUNK:
            break;
        case SoapTcpFrameHeader.ERROR_MESSAGE:
            break;
        case SoapTcpFrameHeader.NULL_MESSAGE:
            break;
        default:
        }
           
        final int payloadLength = DataCodingUtils.readInt8(inputStream);
        final byte payload[] = new byte[payloadLength];
        if (inputStream.read(payload, 0, payload.length) != payloadLength) {
            throw new IOException();
        }
        frame.setPayload(payload);
       
        return frame;
    }
View Full Code Here

            }
        }
       
        InputStream inStream = new ByteArrayInputStream(tempBuffer, 0, bufferDataLength);
        try {
            SoapTcpFrame frame = SoapTcpUtils.readMessageFrame(inStream);
            List<SoapTcpChannel> channels = (List<SoapTcpChannel>)session.getAttribute("channels");
            for (SoapTcpChannel channel : channels) {
                if (channel.getChannelId() == frame.getChannelId()) {
                    switch (frame.getHeader().getFrameType()) {
                    case SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE:
                    case SoapTcpFrameHeader.ERROR_MESSAGE:
                    case SoapTcpFrameHeader.NULL_MESSAGE:
                        SoapTcpMessage singleFrameMessage = SoapTcpMessage.createSoapTcpMessage(frame);
                        out.write(singleFrameMessage);
View Full Code Here

       
        contentDesc.setParameters(parameters);
       
        final SoapTcpFrameHeader header =
            new SoapTcpFrameHeader(SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE, contentDesc);
        final SoapTcpFrame frame = new SoapTcpFrame();
        frame.setHeader(header);
        frame.setChannelId(0);
        try {
            frame.setPayload(openChannelMsg.toString().getBytes("UTF-8"));
            SoapTcpUtils.writeMessageFrame(outStream, frame);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
       
        final SoapTcpFrame response = SoapTcpUtils.readMessageFrame(inStream);
        if (!SoapTcpUtils.checkSingleFrameResponse(response, "openChannelResponse")) {
            throw new IOException("Couldn't open new channel.");
        }
        //SoapTcpUtils.printSoapTcpFrame(System.out, response);
       
View Full Code Here

    public void thresholdNotReached() throws IOException {
        //Send single message if didn't send any message yet or end message if already send message
        if (messageSent) {
            SoapTcpFrameHeader header = new SoapTcpFrameHeader(SoapTcpFrameHeader.MESSAGE_END_CHUNK, null);
            header.setChannelId(channelId);
            SoapTcpFrame frame = new SoapTcpFrame();
            frame.setChannelId(channelId);
            frame.setHeader(header);
            frame.setPayload(this.buffer.toByteArray());
            SoapTcpUtils.writeMessageFrame(outStream, frame);
        } else {
            final SoapTcpFrameContentDescription contentDesc = new SoapTcpFrameContentDescription();
            contentDesc.setContentId(0);
           
            final Map<Integer, String> parameters = new Hashtable<Integer, String>();
            parameters.put(0, "utf-8");
           
            contentDesc.setParameters(parameters);
           
            final SoapTcpFrameHeader header =
                new SoapTcpFrameHeader(SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE, contentDesc);
            header.setChannelId(channelId);
            final SoapTcpFrame frame = new SoapTcpFrame();
            frame.setHeader(header);
            frame.setChannelId(channelId);
            frame.setPayload(this.buffer.toByteArray());
            SoapTcpUtils.writeMessageFrame(outStream, frame);
            messageSent = true;
        }
    }
View Full Code Here

    public void thresholdReached() throws IOException {
        //Send start-chunk message if didn't send any message yet or message chunk if already send message
        if (messageSent) {
            SoapTcpFrameHeader header = new SoapTcpFrameHeader(SoapTcpFrameHeader.MESSAGE_CHUNK, null);
            header.setChannelId(channelId);
            SoapTcpFrame frame = new SoapTcpFrame();
            frame.setChannelId(channelId);
            frame.setHeader(header);
            frame.setPayload(this.buffer.toByteArray());
            SoapTcpUtils.writeMessageFrame(outStream, frame);
        } else {
            SoapTcpFrameContentDescription contentDesc = new SoapTcpFrameContentDescription();
            contentDesc.setContentId(0);
           
            Map<Integer, String> parameters = new Hashtable<Integer, String>();
            parameters.put(0, "utf-8");
           
            contentDesc.setParameters(parameters);
           
            SoapTcpFrameHeader header =
                new SoapTcpFrameHeader(SoapTcpFrameHeader.MESSAGE_START_CHUNK, contentDesc);
            header.setChannelId(channelId);
            SoapTcpFrame frame = new SoapTcpFrame();
            frame.setHeader(header);
            frame.setChannelId(channelId);
            frame.setPayload(this.buffer.toByteArray());
            SoapTcpUtils.writeMessageFrame(outStream, frame);
            messageSent = true;
        }
    }
View Full Code Here

    protected void onFirstWrite() throws IOException {
       
    }
   
    private InputStream getResponse() {
        SoapTcpFrame responseMessage = null;
        try {
            responseMessage = SoapTcpUtils.readMessageFrame(inStream);
        } catch (IOException e2) {
            e2.printStackTrace();
        }
        if (responseMessage != null) {
            int frameType = responseMessage.getHeader().getFrameType();
            if (frameType == SoapTcpFrameHeader.SINGLE_FRAME_MESSAGE
                || frameType == SoapTcpFrameHeader.ERROR_MESSAGE
                || frameType == SoapTcpFrameHeader.NULL_MESSAGE) {
                return new ByteArrayInputStream(responseMessage.getPayload());
            } else if (frameType == SoapTcpFrameHeader.MESSAGE_START_CHUNK) {
                ByteArrayOutputStream baos = new ByteArrayOutputStream(4 * chunkSize);
                try {
                    baos.write(responseMessage.getPayload());
                } catch (IOException e1) {
                    e1.printStackTrace();
                }
                while (frameType != SoapTcpFrameHeader.MESSAGE_END_CHUNK) {
                    try {
                        SoapTcpFrame frame = SoapTcpUtils.readMessageFrame(inStream);
                        baos.write(frame.getPayload());
                        frameType = frame.getHeader().getFrameType();
                    } catch (IOException e) {
                        break;
                    }
                }
                return new ByteArrayInputStream(baos.toByteArray());
View Full Code Here

TOP

Related Classes of org.apache.cxf.binding.soap.tcp.frames.SoapTcpFrame

Copyright © 2018 www.massapicom. 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.