Examples of AssertionNotApplicableException


Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

    throws WSIException
  {
    try
    {
      if (validator.isOneWayResponse(entryContext))
        throw new AssertionNotApplicableException();

      // Parse message
      Document doc = entryContext.getMessageEntryDocument();
      Document docRequest = entryContext.getRequestDocument();

      Element soapOperation = null;
      // If there is a Fault entry or no body entries,
      // the assertion is not applicable
      if (validator.isFault(doc)
        || (soapOperation = validator.getSoapBodyChild(doc)) == null)
        throw new AssertionNotApplicableException();

      // Get SOAPAction
      String headers = entryContext.getRequest().getHTTPHeaders();
      String action = null;
      if (headers != null)
        action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());

      // Get the binding that is being processed               
      Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];

      //Create the types registry
      TypesRegistry registry =
        new TypesRegistry(
          this.validator.getWSDLDocument().getDefinitions(),
          validator);

      // Find an operation match       
      OperationSignature.OperationMatch match =
        OperationSignature.matchOperation(
          docRequest,
          action,
          binding,
          registry);
      if (match == null)
        throw new AssertionNotApplicableException();

      // Get the binding operation based on the match
      BindingOperation bindingOperation = match.getOperation();

      // If this is not rpc-literal, then return notApplicable result
      if (!WSDLUtils
        .isRpcLiteral(match.getOperationStyle(), bindingOperation))
        throw new AssertionNotApplicableException();

      // Going through all the accessors
      Element accessor = XMLUtils.getFirstChild(soapOperation);
      while (accessor != null)
      {
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

    throws WSIException
  {
    try
    {
      if (this.validator.isOneWayResponse(entryContext))
        throw new AssertionNotApplicableException();

      // Parse message
      Document responseDoc = entryContext.getMessageEntryDocument();
      Document requestDoc = entryContext.getRequestDocument();

      // messages are empty or invalid, DOM objects are null
      if (responseDoc == null || requestDoc == null) {
        throw new AssertionNotApplicableException();
      }

      //if (isFault(responseDoc))
      //  throw new AssertionNotApplicableException();

      // Get SOAPAction
      String headers = entryContext.getRequest().getHTTPHeaders();
      String action = null;
      if (headers != null)
        action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());

      // Get the binding that is being processed               
      Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];

      //Create the types registry
      TypesRegistry registry =
        new TypesRegistry(
          this.validator.getWSDLDocument().getDefinitions(),
          validator);

      // Find an operation match       
      OperationSignature.OperationMatch match =
        OperationSignature.matchOperation(
          requestDoc,
          action,
          binding,
          registry);
      if (match == null)
        throw new AssertionNotApplicableException();

      // Get the binding operation based on the match
      BindingOperation bindingOperation = match.getOperation();

      // If this is not rpc-literal, then return notApplicable result
      if (!WSDLUtils
        .isRpcLiteral(match.getOperationStyle(), bindingOperation))
      {
        throw new AssertionNotApplicableException();
      }
      // look for <soap:Body> elements:
      NodeList soapBodyList =
        responseDoc.getElementsByTagNameNS(
          WSIConstants.NS_URI_SOAP,
          XMLUtils.SOAP_ELEM_BODY);
      if ((soapBodyList == null) || (soapBodyList.getLength() == 0))
        // Response does not contain any soap Body elements
        throw new AssertionNotApplicableException();

      // check that no <soap:Body> child or grandchild elements contains a soap:encodingStyle attribute
      // For each <soap:Body>
      boolean grandChildFound = false;
      for (int n = 0; n < soapBodyList.getLength(); n++)
      {
        Element nextBodyElem = (Element) soapBodyList.item(n);
        // REMOVE: This will get all nodes (child, grandchildren, etc.)
        //NodeList childList = nextBodyElem.getElementsByTagName("*");
        NodeList childList = nextBodyElem.getChildNodes();
        if (childList != null)
        {
          // check all child elements
          for (int m = 0; m < childList.getLength(); m++)
          {
            if (childList.item(m).getNodeType() == Node.ELEMENT_NODE)
            {
              Element nextChildElem = (Element) childList.item(m);
              // check children of this child
              // REMOVE: This will get all nodes (child, grandchildren, etc.)
              NodeList grandChildList = nextChildElem.getChildNodes();
              if (grandChildList != null)
              {
                for (int p = 0; p < grandChildList.getLength(); p++)
                {
                  if (grandChildList.item(p).getNodeType()
                    == Node.ELEMENT_NODE)
                  {
                    grandChildFound = true;
                    Element nextGrandChildElem =
                      (Element) grandChildList.item(p);
                    if (nextGrandChildElem
                      .getAttributeNodeNS(
                        WSIConstants.NS_URI_SOAP,
                        "encodingStyle")
                      != null)
                    {
                      // Assertion failed (ADD highlight the child here ?)
                      throw new AssertionFailException(
                        entryContext.getMessageEntry().getMessage());
                    }
                  }
                }
              }
            }
          }
        }
      }
      if (!grandChildFound)
      {
        throw new AssertionNotApplicableException();
      }
    }
    catch (AssertionFailException e)
    {
      result = AssertionResult.RESULT_FAILED;
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

        }
      }
      // If the binding contains no one mime:multipartRelated element,
      // the assertion is not applicable
      if (!multipartsFound)
        throw new AssertionNotApplicableException();
    }
    catch (AssertionNotApplicableException anae)
    {
      result = AssertionResult.RESULT_NOT_APPLICABLE;
    }
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

    {
      // not applicable if there are attachments
      if (entryContext.getMessageEntry().isMimeContent())
      {
        if (entryContext.getMessageEntry().getMimeParts().count() > 1)
           throw new AssertionNotApplicableException();
      }

      BindingOperation bindingOperation = validator.getOperationMatch(
          entryContext.getEntry().getEntryType(),
          entryContext.getMessageEntryDocument());

      // If there is no matched operation, the assertion is not applicable
      if (bindingOperation == null)
        throw new AssertionNotApplicableException();

      // Finding operation extensibility elems
      // in the binding depending on message type
      List extElems = null;
      if (entryContext.getMessageEntry().getType().equals(
        MessageEntry.TYPE_REQUEST)
        && bindingOperation.getBindingInput() != null)
      {
        extElems = bindingOperation
          .getBindingInput().getExtensibilityElements();
      }
      else if (entryContext.getMessageEntry().getType().equals(
        MessageEntry.TYPE_RESPONSE)
        && bindingOperation.getBindingOutput() != null)
      {
        extElems = bindingOperation
          .getBindingOutput().getExtensibilityElements();
      }

      // check list
      if((extElems == null) || (extElems.size() == 0))
      {
        throw new AssertionNotApplicableException();
      }
     
      // determine type
      boolean isMultiPart = false;
     
      // if MIMEMultipartRelated then only root-part allowed
      if(extElems.get(0) instanceof MIMEMultipartRelated)
      {
        if(((MIMEMultipartRelated) extElems.get(0)).getMIMEParts().size() != 1) {
          throw new AssertionNotApplicableException();
        }
        isMultiPart = true;
      }
      // else if not soapbind:body root element
      else if(!(extElems.get(0) instanceof SOAPBody))
      {
        throw new AssertionNotApplicableException();
      }

      // get HTTP content type
      String contentType = HTTPUtils.getHttpHeaderAttribute(
          entryContext.getMessageEntry().getHTTPHeaders(),
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

      }

      if ((messageDoc == null) || this.validator.isFault(messageDoc))
      {
        // empty messages and messages containing soap:Faults do not qualify for this TA
        throw new AssertionNotApplicableException();
      }

      BindingOperation[] docBindingOperations =
        this.validator.getMatchingBindingOps(
          WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC,
          bindings);
      // list of operations that match the <wsdl:input> or <wsdl:output> (depending on entryType)
      // for part element="..."
      // (ISSUE: what about part type="..."?)
      BindingOperation[] potentialDocLitOps =
        this.validator.getDocLitOperations(
          entryContext.getEntry().getEntryType(),
          messagePartElementQName,
          docBindingOperations);
      // GT: --- end: base on wsi1011

      //              
      if (potentialDocLitOps.length == 0)
      {
        // not doc-lit so quit
        throw new AssertionNotApplicableException();
      }

      // We know there is a doc-lit match, so now try to validate the soap message against the
      // referenced schema
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

      // Check if this is one way response
      // or message is mepty or invalid
      if (this.validator.isOneWayResponse(entryContext)
          || (doc = entryContext.getMessageEntryDocument()) == null)
      {
        throw new AssertionNotApplicableException();
      }

      if (!this.validator.isFault(doc))
      {
        throw new AssertionNotApplicableException();
      }

      NodeList faultCodes = doc.getElementsByTagName("faultcode");
      for (int i = 0; i < faultCodes.getLength(); i++)
      {
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

     
      // If the message is empty or invalid, the assertion is not applicable
      if (doc == null)
      {
        if (this.validator.isOneWayResponse(entryContext))
           throw new AssertionNotApplicableException();
        else 
             throw new AssertionFailException();
      }
      if (!doc.getDocumentElement().getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
        throw new AssertionFailException();
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

    throws WSIException
  {
    try
    {
      if (this.validator.isOneWayResponse(entryContext))
        throw new AssertionNotApplicableException();

      // Parse message
      Document doc = entryContext.getMessageEntryDocument();

      // If this is a fault mesage, then it is not applicable
      if (this.validator.isFault(doc))
      {
        throw new AssertionNotApplicableException();
      }

      // Check if there is a soap body element
      if (!this.validator.containsSoapBodyWithChild(doc))
      {
        throw new AssertionNotApplicableException();
      }

      // Parse request message
      Document docRequest = entryContext.getRequestDocument();

      // get SOAPAction
      String headers = entryContext.getRequest().getHTTPHeaders();
      String action = null;
      if (headers != null)
        action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase());

      Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
      TypesRegistry registry =
        new TypesRegistry(
          this.validator.getWSDLDocument().getDefinitions(),
          validator);
      OperationSignature.OperationMatch match =
        OperationSignature.matchOperation(
          docRequest,
          action,
          binding,
          registry);
      if (match == null)
        throw new AssertionNotApplicableException();

      BindingOperation bindingOperation = match.getOperation();

      // Is rpc style?
      if (!WSIConstants
        .ATTRVAL_SOAP_BIND_STYLE_RPC
        .equals(match.getOperationStyle()))
        throw new AssertionNotApplicableException();

      List extElements = null;

      if (bindingOperation.getBindingOutput() != null)
        extElements =
          bindingOperation.getBindingOutput().getExtensibilityElements();

      // Is message RPC-literal?
      if (!validator.isLiteral(extElements))
        throw new AssertionNotApplicableException();

      //Get message

      // Gets body
      NodeList soapBodyList =
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

    {
      // Getting a message document
      Document doc = entryContext.getMessageEntryDocument();
      // If the message is empty or invalid, the assertion is not applicable
      if (doc == null)
        throw new AssertionNotApplicableException();

      // look for soap:Body elements:
      NodeList soapBodyList = doc.getElementsByTagNameNS(
        ELEM_SOAP_BODY.getNamespaceURI(), ELEM_SOAP_BODY.getLocalPart());

      // The message does not contain any soap:Body, the assertion is not applicable
      if ((soapBodyList == null) || (soapBodyList.getLength() == 0))
        throw new AssertionNotApplicableException();

      // check that no soap:Body child elements contain a soap:encodingStyle attribute
      // Getting the first soap:Body child element
      Element child =
        XMLUtils.getFirstChild((Element) soapBodyList.item(0));
View Full Code Here

Examples of org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException

      BindingOperation bindingOperation = validator.getOperationMatch(
        entryContext.getEntry().getEntryType(),
        entryContext.getMessageEntryDocument());
      // If no one operation matches, the assertion is not applicable
      if (bindingOperation == null)
        throw new AssertionNotApplicableException();
      // Getting the corresponding extensibility elements
      List extElems;
      String type;
      if (MessageEntry.TYPE_REQUEST
        .equals(entryContext.getEntry().getEntryType()))
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.