Package org.apache.axis2.om

Examples of org.apache.axis2.om.OMException


  }

  public OMElement toOMElement(OMElement element) throws OMException {

    if (identifier == null || identifier == "") {
      throw new OMException("identifier is not set .. ");
    }

    identifierElement.setText(identifier);
    element.addChild(identifierElement);
View Full Code Here


  }

  public Object fromOMElement(OMElement ackRangePart) throws OMException {

    if (ackRangePart == null)
      throw new OMException("The passed element is null");

    OMAttribute lowerAttrib = ackRangePart.getAttribute(new QName(
        Sandesha2Constants.WSRM.LOWER));
    OMAttribute upperAttrib = ackRangePart.getAttribute(new QName(
        Sandesha2Constants.WSRM.UPPER));

    if (lowerAttrib == null || upperAttrib == null)
      throw new OMException(
          "Passed element does not contain upper or lower attributes");

    try {
      long lower = Long.parseLong(lowerAttrib.getAttributeValue());
      long upper = Long.parseLong(upperAttrib.getAttributeValue());
      upperValue = upper;
      lowerValue = lower;
    } catch (Exception ex) {
      throw new OMException(
          "The ack range does not have proper long values for Upper and Lower attributes");
    }

    acknowledgementRangeElement = factory.createOMElement(
        Sandesha2Constants.WSRM.ACK_RANGE, rmNamespace);
View Full Code Here

  public OMElement toOMElement(OMElement sequenceAckElement)
      throws OMException {

    if (sequenceAckElement == null)
      throw new OMException(
          "Cant set Ack Range part since element is null");

    if (upperValue <= 0 || lowerValue <= 0 || lowerValue > upperValue)
      throw new OMException(
          "Cant set Ack Range part since Upper or Lower is not set to the correct value");

    OMAttribute lowerAttrib = factory.createOMAttribute(
        Sandesha2Constants.WSRM.LOWER, null, Long.toString(lowerValue));
    OMAttribute upperAttrib = factory.createOMAttribute(
View Full Code Here

  private SOAPFactory factory;
 
  public void fromSOAPEnvelope(SOAPEnvelope envelope) {

    if (envelope == null)
      throw new OMException("The passed envelope is null");

    SOAPFactory factory;
   
    //Ya I know. Could hv done it directly :D (just to make it consistent)
    if (envelope.getNamespace().getName().equals(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI))
View Full Code Here

    OMElement createSequencePart = bodyElement
        .getFirstChildWithName(new QName(Sandesha2Constants.WSRM.NS_URI_RM,
            Sandesha2Constants.WSRM.CREATE_SEQUENCE));
    if (createSequencePart == null)
      throw new OMException(
          "Create sequence is not present in the passed element");

    createSequenceElement = factory.createOMElement(
        Sandesha2Constants.WSRM.CREATE_SEQUENCE, rmNamespace);
View Full Code Here

  }

  public OMElement toOMElement(OMElement bodyElement) throws OMException {

    if (bodyElement == null || !(bodyElement instanceof SOAPBody))
      throw new OMException(
          "Cant add Create Sequence Part to a non-body element");

    if (acksTo == null)
      throw new OMException(
          "Cant add create seqeunce part, having acks to as null");

    SOAPBody soapBody = (SOAPBody) bodyElement;
    acksTo.toOMElement(createSequenceElement);
View Full Code Here

  }

  public Object fromOMElement(OMElement body) throws OMException {

    if (body == null || !(body instanceof SOAPBody))
      throw new OMException(
          "Cant get Sequence Fault part from a non-header element");

    OMElement sequenceFaultPart = body.getFirstChildWithName(new QName(
        Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.SEQUENCE_FAULT));

    if (sequenceFaultPart == null)
      throw new OMException(
          "The passed element does not contain a Sequence Fault element");

    OMElement faultCodePart = sequenceFaultPart
        .getFirstChildWithName(new QName(Sandesha2Constants.WSRM.NS_URI_RM,
            Sandesha2Constants.WSRM.FAULT_CODE));
View Full Code Here

  }

  public OMElement toOMElement(OMElement body) throws OMException {

    if (body == null || !(body instanceof SOAPBody))
      throw new OMException(
          "Cant get Sequence Fault part from a non-header element");

    if (sequenceFaultElement == null)
      throw new OMException(
          "Cant add the sequnce fault since the internal element is null");

    if (faultCode != null)
      faultCode.toOMElement(sequenceFaultElement);
View Full Code Here

  public Object fromOMElement(OMElement element) throws OMException {
    OMElement lastMessagePart = element.getFirstChildWithName(new QName(
        Sandesha2Constants.WSRM.NS_URI_RM, Sandesha2Constants.WSRM.LAST_MSG));
    if (lastMessagePart == null)
      throw new OMException(
          "The passed element does not contain a Last Message part");

    lastMessageElement = factory.createOMElement(
        Sandesha2Constants.WSRM.LAST_MSG, rmNamespace);
View Full Code Here

  }

  public OMElement toOMElement(OMElement sequenceElement) throws OMException {
    //soapheaderblock element will be given
    if (lastMessageElement == null)
      throw new OMException("Cant set last message element. It is null");

    sequenceElement.addChild(lastMessageElement);

    lastMessageElement = factory.createOMElement(
        Sandesha2Constants.WSRM.LAST_MSG, 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.