Examples of AssertionNotApplicableException


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();

      // Getting a root element
      Element element = doc.getDocumentElement();

      // Assuming that root element should be soap:Envelope
      // If not, the assertion is not applicable
      if (!element.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE))
        throw new AssertionNotApplicableException();

      // looking for any attribute of soap:Envelope in the namespace
      // "http://schemas.xmlsoap.org/soap/envelope/"
      // If at least one attribute is found, the assertion failed
      Attr attr = getAttribute(element.getAttributes());
View Full Code Here

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

          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 on first element
      if((extElems == null) || (extElems.size() == 0) ||
         !(extElems.get(0) instanceof MIMEMultipartRelated))
        throw new AssertionNotApplicableException();
     
      // get list mime parts from definition
      MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0);
      List parts = mime.getMIMEParts();
      // if parts count is more than one, than assertion is notApplicable
      if(parts.size() <= 1)
        throw new AssertionNotApplicableException();
      String contentType = HTTPUtils.getHttpHeaderAttribute(
          entryContext.getMessageEntry().getHTTPHeaders(),
          HTTPConstants.HEADER_CONTENT_TYPE);
      if((contentType == null) ||
         !contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART))
View Full Code Here

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

      // (Note: since this is a Soap message we expect exactly one soap envelope, but we do not assume it).
      Document requestDoc = entryContext.getRequestDocument();

      // message is empty or invalid, the assertion is not applicable
      if (requestDoc == null)
        throw new AssertionNotApplicableException();

      Element envElem = requestDoc.getDocumentElement();
      //NodeList soapEnvList = requestDoc.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Envelope");

      // If the document element tag name is not Envelope
      // or the namespace is http://schemas.xmlsoap.org/soap/envelope/
      if (!envElem.getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE)
        || envElem.getNamespaceURI().equals(WSIConstants.NS_URI_SOAP))
        // Request contains proper soap Envelope element
        throw new AssertionNotApplicableException();

      // we expect a Soap Fault as a response 
      Document responseDoc =
        XMLUtils.parseXML(entryContext.getResponse().getMessage());
      NodeList soapFaultList =
View Full Code Here

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

      Document doc = entryContext.getMessageEntryDocument();

      // If the message is empty or invalid, the assertion is not applicable
      if (doc == null)
      {
        throw new AssertionNotApplicableException();
      }

      // Getting the soap:Body elements from envelope
      NodeList bodyList = doc.getDocumentElement().getElementsByTagNameNS(
        WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_BODY);

      // If there is no Body element, the assertion is not applicable
      if (bodyList == null || bodyList.getLength() == 0)
      {
        throw new AssertionNotApplicableException();
      }

      // Getting the first soap:Body element
      Element body = (Element) bodyList.item(0);

      // If the Body element has attributes (excluding namespace declarations),
      // the assertion passed
      NamedNodeMap attrs = body.getAttributes();
      if (attrs != null)
      {
        for (int i = 0; i < attrs.getLength(); i++)
        {
          String attrName = ((Attr) attrs.item(i)).getName();
          if (!attrName.equals("xmlns") && !attrName.startsWith("xmlns:"))
          {
            throw new AssertionPassException();
          }
        }
      }

      throw new AssertionNotApplicableException();
    }
    catch (AssertionPassException ape)
    {
      failureDetail = validator.createFailureDetail(
        testAssertion.getDetailDescription(), entryContext);
View Full Code Here

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

      }

      // If the binding contains no mime:content elements,
      // the assertion is not applicable
      if (!mimeContentsFound)
        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

      // If the message is empty or invalid, the assertion failed
      if (doc == null)
      {
        if (this.validator.isOneWayResponse(entryContext))
          throw new AssertionNotApplicableException();
        else
          throw new AssertionFailException("The log message is empty or invalid.");
      }
      // SOAP 1.1 specifications, Section 4.
      // http://www.w3.org/TR/2000/NOTE-SOAP-20000508/#_Toc478383494
View Full Code Here

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

  {
    try
    {
      if(!entryContext.getMessageEntry().isMimeContent())
      {
        throw new AssertionNotApplicableException();
      }
     
      // get message mime parts
      MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts();
     
      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 for the first element
      if((extElems == null) || (extElems.size() == 0) ||
         !(extElems.get(0) instanceof MIMEMultipartRelated))
        throw new AssertionNotApplicableException();
     
      // get list mime parts from definition
      MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0);
      List parts = mime.getMIMEParts();

      if(mimeParts.getRootPart() == null || mimeParts.count()==0)
        throw new AssertionNotApplicableException();
      // skip root part
      for (int i = 1; i < parts.size(); i++)
      {
        String partName = getMIMEContentPart((MIMEPart) parts.get(i));
        // find the corresponding MIME part
View Full Code Here

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

      Document doc = entryContext.getMessageEntryDocument();

      // If the message is empty or invalid, the assertion is not applicable
      if (doc == null)
      {
        throw new AssertionNotApplicableException();
      }

      // Getting Fault elements from envelope
      Element root = doc.getDocumentElement();
      NodeList faultList = root.getElementsByTagNameNS(
        WSIConstants.NS_URI_SOAP, XMLUtils.SOAP_ELEM_FAULT);

      // If there is no Fault element, the assertion is not applicable
      if (faultList == null || faultList.getLength() == 0)
      {
        throw new AssertionNotApplicableException();
      }

      // Fault element must not appear more than once
      // within a Body element, so getting the first one
      Element fault = (Element) faultList.item(0);
View Full Code Here

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

      }

      // If the binding does not contain mime:content elements,
      // the assertion is not applicable
      if (!mimeContentsFound)
        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

      }

      // 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 action =
        validator.getSoapAction(entryContext.getRequest().getHTTPHeaders());

      Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0];
      //Definition definition = entryContext.getAnalyzerContext().getCandidateInfo().getDefinitions()[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
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.