Package org.apache.axiom.om

Examples of org.apache.axiom.om.OMException


            parent.addChild(om);
            return om;
        } catch (OMException e) {
            throw e;
        } catch (Throwable t) {
            throw new OMException(t);
        }
    }
View Full Code Here


  }

  public OMElement toOMElement(OMElement body) throws OMException {

    if (body == null || !(body instanceof SOAPBody))
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.terminateSeqResponseCannotBeAddedToNonBody));

    if (identifier == null)
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.nullMsgId));

    OMFactory factory = body.getOMFactory();
   
    OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
View Full Code Here

  }

  public OMElement toOMElement(OMElement headerElement) throws OMException {

    if (headerElement == null || !(headerElement instanceof SOAPHeader))
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.seqElementCannotBeAddedToNonHeader));

    SOAPHeader soapHeader = (SOAPHeader) headerElement;

    if (identifier == null)
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.nullMsgId));
    if (messageNumber == null)
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.seqPartIsNull));

    OMFactory factory = headerElement.getOMFactory();

    OMNamespace rmNamespace = factory.createOMNamespace(
View Full Code Here

  }

  public Object fromOMElement(OMElement body) throws OMException,SandeshaException {

    if (!(body instanceof SOAPBody))
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.closeSeqCannotBeAddedToNonBody));

    OMElement closeSeqPart = body.getFirstChildWithName(new QName(
        namespaceValue, Sandesha2Constants.WSRM_COMMON.CLOSE_SEQUENCE));

    if (closeSeqPart == null)
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.noCloseSequencePartInElement,
          body.toString()));

    identifier = new Identifier(namespaceValue);
    identifier.fromOMElement(closeSeqPart);
View Full Code Here

  }

  public OMElement toOMElement(OMElement body) throws OMException {

    if (body == null || !(body instanceof SOAPBody))
      throw new OMException(
          SandeshaMessageHelper.getMessage(
              SandeshaMessageKeys.closeSeqCannotBeAddedToNonBody));

    if (identifier == null)
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.closeSeqPartNullID));

    OMFactory factory = body.getOMFactory();
   
    OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
View Full Code Here

  public OMElement toOMElement(OMElement headerElement) throws OMException,
      SandeshaException {
    if (!(headerElement instanceof SOAPHeader)) {
      String message = "'MessagePending' element can only be added to a SOAP Header";
      throw new OMException(message);
    }
   
    SOAPHeader header = (SOAPHeader) headerElement;
    OMFactory factory = header.getOMFactory();
    OMNamespace namespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
View Full Code Here

 

  public Object fromOMElement(OMElement nackElement) throws OMException{
   
    if (nackElement==null)
      throw new OMException (SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.nullPassedElement));
   
    try {
      nackNumber = Long.parseLong(nackElement.getText());
    }catch (Exception ex ) {
      throw new OMException (SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.nackDoesNotContainValidLongValue));
    }
   
    return this;
  }
View Full Code Here

    return this;
  }
 
  public OMElement toOMElement(OMElement sequenceAckElement) throws OMException {
    if (sequenceAckElement==null)
      throw new OMException (SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.noNackInSeqAckPart));
   
    if (nackNumber<=0)
      throw new OMException (SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.nackDoesNotContainValidLongValue));
   
    OMFactory factory = sequenceAckElement.getOMFactory();
   
    OMNamespace rmNamespace = factory.createOMNamespace(namespaceValue,Sandesha2Constants.WSRM_COMMON.NS_PREFIX_RM);
View Full Code Here

   * @throws OMException
   */
  public int next() throws OMException {
    try {
        if (done) {
            throw new OMException();
        }
        int token = getNextElementToParse();
        if (!cache) {
            return token;
        }
        switch (token) {
            case XMLStreamConstants.START_ELEMENT:
                lastNode = createOMElement();
                break;
            case XMLStreamConstants.START_DOCUMENT:
                document.setXMLVersion(
                  parser.getVersion() != null ?
                  parser.getVersion() : "1.0");
                document.setCharsetEncoding(
                  parser.getEncoding() != null ?
                  parser.getEncoding() : "utf-8");
                document.setStandalone(
                  parser.isStandalone() ? YES : NO);
                break;
            case XMLStreamConstants.CHARACTERS:
                lastNode = applyTextFilter(XMLStreamConstants.CHARACTERS);
                break;
            case XMLStreamConstants.CDATA:
                lastNode = applyTextFilter(XMLStreamConstants.CDATA);
                break;
            case XMLStreamConstants.END_ELEMENT:
                endElement();
                break;
            case XMLStreamConstants.END_DOCUMENT:
                done = true;
                ((OMContainerEx) this.document).setComplete(true);
                break;
            case XMLStreamConstants.SPACE:
                if (!ignoreWhitespace)
                  lastNode = createOMText(XMLStreamConstants.SPACE);
                break;
            case XMLStreamConstants.COMMENT:
                if (!ignoreComments) createComment();
                break;
            case XMLStreamConstants.DTD:
// Current StAX cursor model implementations inconsistently handle DTDs. 
// Woodstox, for instance, does not provide a means of getting to the complete
// doctype declaration (which is actually valid according to the spec, which
// is broken).  The StAX reference impl returns the complete doctype declaration
// despite the fact that doing so is apparently against the spec.  We can get
// to the complete declaration in Woodstox if we want to use their proprietary
// extension APIs.  It's unclear how other Stax impls handle this. So.. for now,
// we're just going to ignore the DTD.  The DTD will still be processed as far
// as entities are concerned, but we will not be able to reserialize the parsed
// document with the DTD.  Since very few folks actually use DTD's in feeds
// right now (and we should likely be encouraging folks not to do so), this
// shouldn't be that big of a problem
//                if (!parserOptions.getIgnoreDoctype())
//                  createDTD();
                break;
            case XMLStreamConstants.PROCESSING_INSTRUCTION:
                if (!ignorePI) createPI();
                break;
            case XMLStreamConstants.ENTITY_REFERENCE:
                lastNode = createOMText(XMLStreamConstants.ENTITY_REFERENCE);
                break;
            default :
                throw new OMException();
        }
        return token;
    } catch (OMException e) {
        throw e;
    } catch (Exception e) {
        throw new OMException(e);
    }
  }
View Full Code Here

  }

  public Object fromOMElement(OMElement body) throws OMException,SandeshaException {

    if (!(body instanceof SOAPBody))
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.terminateSeqCannotBeAddedToNonBody));

    OMElement terminateSeqPart = body.getFirstChildWithName(new QName(
        namespaceValue, Sandesha2Constants.WSRM_COMMON.TERMINATE_SEQUENCE));

    if (terminateSeqPart == null)
      throw new OMException(SandeshaMessageHelper.getMessage(
          SandeshaMessageKeys.noTerminateSeqInElement,
          body.toString()));

    identifier = new Identifier(namespaceValue);
    identifier.fromOMElement(terminateSeqPart);
View Full Code Here

TOP

Related Classes of org.apache.axiom.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.