Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMException


     * @throws OMException
     */
    public int next() throws OMException {
        try {
            if (done) {
                throw new OMException();
            }
            int token = parser.next();
            if (!cache) {
                return token;
            }
            switch (token) {
                case XMLStreamConstants.START_ELEMENT:
                    if(doDebug) {
                        System.out.println("START_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
                    }
                    lastNode = createOMElement();
                    break;
                case XMLStreamConstants.START_DOCUMENT:
                    // Document has already being created.
                   
                    document.setXMLVersion(parser.getVersion());
                    document.setCharsetEncoding(parser.getEncoding());
                    document.setStandalone(parser.isStandalone() ? "yes" : "no");
                    if(doDebug) {
                        System.out.println("START_DOCUMENT: ");
                    }
                    break;
                case XMLStreamConstants.CHARACTERS:
                    if(doDebug) {
                        System.out.println("CHARACTERS: [" + parser.getText() + "]");
                    }
                    lastNode = createOMText(XMLStreamConstants.CHARACTERS);
                    break;
                case XMLStreamConstants.CDATA:
                    if(doDebug) {
                        System.out.println("CDATA: [" + parser.getText() + "]");
                    }
                    lastNode = createOMText(XMLStreamConstants.CDATA);
                    break;
                case XMLStreamConstants.END_ELEMENT:
                    if(doDebug) {
                        System.out.println("END_ELEMENT: " + parser.getName() + ":" + parser.getLocalName());
                    }
                    endElement();
                    break;
                case XMLStreamConstants.END_DOCUMENT:
                    if(doDebug) {
                        System.out.println("END_DOCUMENT: ");
                    }
                    done = true;
                    ((OMContainerEx)this.document).setComplete(true);
                    break;
                case XMLStreamConstants.SPACE:
                    if(doDebug) {
                        System.out.println("SPACE: [" + parser.getText() + "]");
                    }
                    lastNode = createOMText(XMLStreamConstants.SPACE);
                    break;
                case XMLStreamConstants.COMMENT:
                    if(doDebug) {
                        System.out.println("COMMENT: [" + parser.getText() + "]");
                    }
                    createComment();
                    break;
                case XMLStreamConstants.DTD:
                    if(doDebug) {
                        System.out.println("DTD: [" + parser.getText() + "]");
                    }
                    createDTD();
                    break;
                case XMLStreamConstants.PROCESSING_INSTRUCTION:
                    if(doDebug) {
                        System.out.println("PROCESSING_INSTRUCTION: [" + parser.getPITarget() + "][" + parser.getPIData() + "]");
                    }
                    createPI();
                    break;
                case XMLStreamConstants.ENTITY_REFERENCE:
                    if(doDebug) {
                        System.out.println("ENTITY_REFERENCE: " + parser.getLocalName() + "[" + parser.getText() + "]");
                    }
                    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


      if(child instanceof OMElement) {
        if(this.documentElement == null) {
          addChild((OMNodeImpl) child);
          this.documentElement = (OMElement)child;
        } else {
          throw new OMException("Document element already exists");
        }
      } else {
        addChild((OMNodeImpl) child);
      }
    }
View Full Code Here

        if (qname != null) {
            setValue(qname);
        } else {

            // what to do here?
            throw new OMException("No QName from " + text);
        }

        SOAPFaultSubCode subCode = source.getSubCode();

        if (subCode != null) {
View Full Code Here

  }

  public Object fromOMElement(OMElement element) throws OMException {

    if (element == null || !(element instanceof SOAPHeader))
      throw new OMException(
          "Cant get sequence acknowlegement from a non-header element");

    SOAPHeader header = (SOAPHeader) element;
    OMElement sequenceAckPart = header.getFirstChildWithName(new QName(
        Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.SEQUENCE_ACK));

    if (sequenceAckPart == null)
      throw new OMException(
          "The passed element does not contain a seqence ackknowledgement Part");

    identifier = new Identifier(factory);
    identifier.fromOMElement(sequenceAckPart);
View Full Code Here

  }

  public OMElement toOMElement(OMElement header) throws OMException {

    if (header == null || !(header instanceof SOAPHeader))
      throw new OMException();

    SOAPHeader SOAPHeader = (SOAPHeader) header;

    if (sequenceAcknowledgementElement == null)
      throw new OMException(
          "Cant set sequence acknowledgement since the element is null");

    if (identifier == null)
      throw new OMException(
          "Cant set the sequence since Identifier is null");

    identifier.toOMElement(sequenceAcknowledgementElement);

    Iterator ackRangeIt = acknowledgementRangeList.iterator();
View Full Code Here

  public Object fromOMElement(OMElement element) throws OMException {

    OMElement acceptPart = element.getFirstChildWithName(new QName(
        Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.ACCEPT));
    if (acceptPart == null)
      throw new OMException(
          "Passed element does not contain an Accept part");

    acksTo = new AcksTo(factory);
    acksTo.fromOMElement(acceptPart);
View Full Code Here

  }

  public OMElement toOMElement(OMElement element) throws OMException {

    if (acceptElement == null)
      throw new OMException(
          "Cant add Accept part since the internal element is null");

    if (acksTo == null)
      throw new OMException(
          "Cant add Accept part since AcksTo object is null");

    acksTo.toOMElement(acceptElement);
    element.addChild(acceptElement);
View Full Code Here

  public Object fromOMElement(OMElement headerElement) throws OMException {

    SOAPHeader header = (SOAPHeader) headerElement;
    if (header == null)
      throw new OMException(
          "Sequence element cannot be added to non-header element");

    OMElement sequencePart = sequenceElement = headerElement
        .getFirstChildWithName(new QName(Sandesha2Constants.WSRM.NS_URI_RM,
            Sandesha2Constants.WSRM.SEQUENCE));
    if (sequencePart == null)
      throw new OMException(
          "Cannot find Sequence element in the given element");

    sequenceElement = factory.createOMElement(
        Sandesha2Constants.WSRM.SEQUENCE, seqNoNamespace);
View Full Code Here

  }

  public OMElement toOMElement(OMElement headerElement) throws OMException {

    if (headerElement == null || !(headerElement instanceof SOAPHeader))
      throw new OMException(
          "Cant add Sequence Part to a non-header element");

    SOAPHeader soapHeader = (SOAPHeader) headerElement;
    if (soapHeader == null)
      throw new OMException(
          "cant add the sequence part to a non-header element");
    if (sequenceElement == null)
      throw new OMException(
          "cant add Sequence Part since Sequence is null");
    if (identifier == null)
      throw new OMException(
          "Cant add Sequence part since identifier is null");
    if (messageNumber == null)
      throw new OMException(
          "Cant add Sequence part since MessageNumber is null");


    SOAPHeaderBlock sequenceHeaderBlock = soapHeader.addHeaderBlock(
        Sandesha2Constants.WSRM.SEQUENCE, seqNoNamespace);
View Full Code Here

  public Object fromOMElement(OMElement nackElement) throws OMException{
    /*OMElement nackPart = sequenceAckElement.getFirstChildWithName(
        new QName (Sandesha2Constants.WSRM.NS_URI_RM,Sandesha2Constants.WSRM.NACK));*/
   
    if (nackElement==null)
      throw new OMException ("Passed seq ack element does not contain a nack part");
   
    try {
      nackNumber = Long.parseLong(nackElement.getText());
    }catch (Exception ex ) {
      throw new OMException ("Nack element does not contain a valid long value");
    }
   
    nackElement = factory.createOMElement(
        Sandesha2Constants.WSRM.NACK,rmNamespace);
   
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.