Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMException


        Part soapPart = getPart(getSOAPPartContentID());
        try {
            return soapPart.getContentType();
        } catch (MessagingException e) {
            log.error(e.getMessage());
            throw new OMException(e);
        }
    }
View Full Code Here


    /**
     * Method createDTD.
     * Overriding the default behaviour as a SOAPMessage should not have a DTD.
     */
    protected OMNode createDTD() throws OMException {
        throw new OMException("SOAP message MUST NOT contain a Document Type Declaration(DTD)");
    }
View Full Code Here

    /**
     * Method createPI.
     * Overriding the default behaviour as a SOAP Message should not have a PI.
     */
    protected OMNode createPI() throws OMException {
        throw new OMException("SOAP message MUST NOT contain Processing Instructions(PI)");
    }
View Full Code Here

        super(envelope, builder);
    }

    public SOAPHeaderBlock addHeaderBlock(String localName, OMNamespace ns) throws OMException {
        if (ns == null || ns.getName() == null || "".equals(ns.getName())) {
            throw new OMException(
                    "All the SOAP Header blocks should be namespace qualified");
        }

        OMNamespace namespace = findNamespace(ns.getName(), ns.getPrefix());
        if (namespace != null) {
            ns = namespace;
        }

        SOAPHeaderBlock soapHeaderBlock = null;
        try {
            soapHeaderBlock = new SOAP11HeaderBlockImpl(localName, ns, this);
        } catch (SOAPProcessingException e) {
            throw new OMException(e);
        }
        ((OMNodeEx)soapHeaderBlock).setComplete(true);
        return soapHeaderBlock;
    }
View Full Code Here

    public DataHandler getDataHandler(String blobContentID) throws OMException {

        try {
            return getPart(blobContentID).getDataHandler();
        } catch (MessagingException e) {
            throw new OMException("Problem with Mime Body Part No " + partIndex
                    + ".  ", e);
        }

    }
View Full Code Here

                    bodyPartsMap.put("firstPart", nextPart);
                    firstPartId = "firstPart";
                    return nextPart;
                }
                if (partContentID == null) {
                    throw new OMException(
                            "Part content ID cannot be blank for non root MIME parts");
                }
                if ((partContentID.indexOf("<") > -1)
                        & (partContentID.indexOf(">") > -1)) {
                    partContentID = partContentID.substring(1, (partContentID
                            .length() - 1));

                } else if (partIndex == 1) {
                    firstPartId = partContentID;
                }
                if (bodyPartsMap.containsKey(partContentID)) {
                    throw new OMException(
                            "Two MIME parts with the same Content-ID not allowed.");
                }
                bodyPartsMap.put(partContentID, nextPart);
                return nextPart;
            } catch (MessagingException e) {
                throw new OMException("Error reading Content-ID from the Part."
                        + e);
            }
        } else
            return null;
    }
View Full Code Here

     */
    private Part getPart() throws OMException {
        // endOfStreamReached will be set to true if the message ended in MIME
        // Style having "--" suffix with the last mime boundary
        if (endOfStreamReached)
            throw new OMException(
                    "Referenced MIME part not found.End of Stream reached.");

        Part part = null;

        try {
            if (fileCacheEnable) {
                try {
                    MIMEBodyPartInputStream partStream;
                    byte[] buffer = new byte[fileStorageThreshold];
                    partStream = new MIMEBodyPartInputStream(pushbackInStream,
                            boundary, this);
                    int count = 0;
                    int value;
                    // Make sure not to modify this to a Short Circuit "&". If
                    // removed a byte will be lost
                    while (count != fileStorageThreshold
                            && (!partStream.getBoundaryStatus())) {
                        value = partStream.read();
                        buffer[count] = (byte) value;
                        count++;
                    }
                    if (count == fileStorageThreshold) {
                        PushbackFilePartInputStream filePartStream = new PushbackFilePartInputStream(
                                partStream, buffer);
                        part = new PartOnFile(filePartStream, attachmentRepoDir);
                    } else {
                        ByteArrayInputStream byteArrayInStream = new ByteArrayInputStream(
                                buffer,0,count-1);
                        part = new PartOnMemory(byteArrayInStream);
                    }
                } catch (Exception e) {
                    throw new OMException("Error creating temporary File.", e);
                }
            } else {
                MIMEBodyPartInputStream partStream;
                partStream = new MIMEBodyPartInputStream(pushbackInStream,
                        boundary, this);
                part = new PartOnMemory(partStream);
            }
            // This will take care if stream ended without having MIME
            // message terminator
            if (part.getSize() <= 0) {
                throw new OMException(
                        "Referenced MIME part not found.End of Stream reached.");
            }
        } catch (MessagingException e) {
            throw new OMException(e);
        }
        partIndex++;
        return part;
    }
View Full Code Here

            }

            fileOutStream.flush();
            fileOutStream.close();
        } catch (IOException e) {
            throw new OMException("Error creating temporary File.", e);
        }
    }
View Full Code Here

                } while (inStream.available() > 0);
               
                return text.toString();
            } catch (Exception e) {
                throw new OMException(e);
            }
        }
    }
View Full Code Here

            InputStream inStream;
            javax.activation.DataHandler dataHandler = (javax.activation.DataHandler)dataHandlerObject;
            try {
                inStream = dataHandler.getDataSource().getInputStream();
            } catch (IOException e) {
                throw new OMException(
                        "Cannot get InputStream from DataHandler." + e);
            }
            return inStream;
        } else {
            throw new OMException("Unsupported Operation");
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.axis2.om.OMException

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.