Package org.apache.wsif

Examples of org.apache.wsif.WSIFException


    }

        // get use
    String use = soapbody.getUse();
    if (!WSIFAXISConstants.VALID_USES.contains(use)) {
      throw new WSIFException(
        "unsupported use " + use + " in " + soapOperation);
    }

        // get encoding style
    if (isInput) {
View Full Code Here


            parts = m.getOrderedParts(null);
        }

        if ((parts == null || parts.size() < 1)
        && (partNames != null && partNames.size() > 0)) {
           throw new WSIFException("part '" +
               partNames.get(0) +
               "' not defined in message " + m);
        }
       
        if (partNames == null) {
            if (parts != null) {
              al.addAll(parts);
            }
      } else {
          for (Iterator i = partNames.iterator(); i.hasNext(); ) {
            String partName = (String) i.next();
          Part p = m.getPart(partName);
          if (p == null) {
              throw new WSIFException("Part '" +
                  partName +
                  "' in soap:body parts not in message " + m);
          }
          // as there can be multiple mime:content elements which
          // specify a coice of types (TODO: which wsif ignores for now)
View Full Code Here

      if (nextMimePart instanceof MIMEPart) {
        MIMEPart mimePart = (MIMEPart) nextMimePart;
        if (!MIMEConstants
          .NS_URI_MIME
          .equals(mimePart.getElementType().getNamespaceURI()))
          throw new WSIFException(
            "A MIME part in binding operation "
              + bindingOperation.getName()
              + " did not have the correct namespace URI of "
              + MIMEConstants.NS_URI_MIME
              + ".");

        boolean containsSoapBody = false;
        boolean containsMimeContent = false;
        List mimePartChildren = mimePart.getExtensibilityElements();
        Iterator mimePartChildrenIt = mimePartChildren.iterator();
        while (mimePartChildrenIt.hasNext()) {
          Object nextChild = mimePartChildrenIt.next();
          if (nextChild instanceof MIMEContent) {
            MIMEContent mimeContent = (MIMEContent) nextChild;
            if (!MIMEConstants
              .NS_URI_MIME
              .equals(
                mimePart.getElementType().getNamespaceURI()))
              throw new WSIFException(
                "A MIME part in binding operation "
                  + bindingOperation.getName()
                  + " did not have the correct namespace URI of "
                  + MIMEConstants.NS_URI_MIME
                  + ".");
            containsMimeContent = true;
            if (containsSoapBody)
              throw new WSIFException(
                "A mime:part that contains a mime:content also "
                  + "contains a soap:body. Operation="
                  + getName());

            String partName = mimeContent.getPart();
            if (partName == null || partName.length() == 0)
              throw new WSIFException(
                "No part name for a mime:content. Operation="
                  + getName());

            if ((isInput && mapInParts.get(partName) == null)
              || (!isInput && mapOutParts.get(partName) == null))
              throw new WSIFException(
                "The part specified in a mime:content does "
                  + "not exist in the operation. Operation="
                  + getName()
                  + " Part="
                  + partName);

            mimePartNames.add(partName);

          } else if (nextChild instanceof SOAPBody) {
            if (soapBody!=null) {
              throw new WSIFException(
                "Multiple soap:body tags found in a "
                  + "mime:multipartRelated. Operation="
                  + getName());
            }
            soapBody = (SOAPBody)nextChild;

            containsSoapBody = true;
            if (containsMimeContent)
              throw new WSIFException(
                "A mime:part that contains a mime:content also "
                  + "contains a soap:body. Operation="
                  + getName());

          } else if (nextChild instanceof MIMEMultipartRelated) {
            throw new WSIFException(
              "WSIF does not support nesting mime:multipartRelated "
                + "inside a mime:part. Operation="
                + getName());
          } else if (nextChild instanceof MIMEMimeXml) {
            throw new WSIFException(
              "WSIF does not support mime:mimeXml. Operation="
                + getName());
          }
        }
      }
View Full Code Here

    throws WSIFException {
    Binding binding = wsifPort.getPort().getBinding();
    BindingOperation bindingOp =
      WSIFUtils.getBindingOperation(binding, operation);
    if (bindingOp == null) {
      throw new WSIFException(
        "cannot find binding operation for port operation:"
          + operation.getName());
    }
    return bindingOp;
  }
View Full Code Here

            throw new IllegalArgumentException("input message is null");
        }
    close();
   
    if (!wsifPort.supportsAsync()) {
      throw new WSIFException("asynchronous operations not available");
    }

    setAsyncOperation(true);
    setResponseHandler(handler);
    WSIFJmsTransport transport = (WSIFJmsTransport) getTransport();
View Full Code Here

   * This is copied, with minor changes, from the 2nd half
   * of the Apache Axis Call class invoke method.
   */
  private Object deserialiseResponseObject(Object msg) throws WSIFException {
    if (msg == null) {
      throw new WSIFException("null response to async send");
    }
    if (!(msg instanceof TextMessage)) {
      throw new WSIFException("response not a javax.jms.TextMessage");
    }

    try {
      TextMessage m = (TextMessage) msg;
      Message responseMessage = new Message(m.getText());
      responseMessage.setMessageType(Message.RESPONSE);

      Service service = new Service();
      MessageContext msgContext = new MessageContext(service.getEngine());
      msgContext.setResponseMessage(responseMessage);

      TypeMappingRegistry tmr = msgContext.getTypeMappingRegistry();
      org.apache.axis.encoding.TypeMapping tm =
        (org.apache.axis.encoding.TypeMapping) tmr.getTypeMapping(
          outputEncodingStyle);

          // register any default type mappings     
          registerDefaultTypeMappings(tm, getContext());
     
          // register any mappings from WSIFService.mapType calls
          registerDynamicTypes(tm, typeMap, getContext());

      Message resMsg = msgContext.getResponseMessage();
      SOAPEnvelope resEnv = resMsg.getSOAPEnvelope();

      Object b = resEnv.getFirstBody();
      if (b instanceof SOAPFaultElement) {
        return new AxisFault(b.toString());
      }

      RPCElement body = (RPCElement) b;

      Object result = null;
      HashMap outParams;
      Vector resArgs = body.getParams();

      if (resArgs != null && resArgs.size() > 0) {
        RPCParam param = (RPCParam) resArgs.get(0);
        result = param.getValue();

        if (resArgs.size() > 1) {
          outParams = new HashMap();
          for (int i = 1; i < resArgs.size(); i++) {
            RPCParam p = (RPCParam) resArgs.get(i);
            outParams.put(p.getName(), p.getValue());
          }
          setResponseMessageParameters(outParams);
        }
      }
      return result;
    } catch (Exception ex) {
      Trc.exception(ex);
      throw new WSIFException(ex.getMessage());
    }

  }
View Full Code Here

    try {
      response = call.invoke(inputValues);
      respOK = true;
    } catch (RemoteException ex) {
      Trc.exception(ex);
      throw new WSIFException(
        "exception on AXIS invoke: " + ex.getLocalizedMessage(),
        ex);
    }
    Trc.event(this, "Returned from AXIS invoke, response: ", response);
View Full Code Here

          fixAttachmentPartsCID(el, attachments);
        }
       
        soapBodies.add(new SOAPBodyElement(el));
      } else {
        throw new WSIFException(
          "unexpected input type: " + inputValues[i]);
      }
    }
   
        Object[] axisInputs = soapBodies.toArray();

    Trc.event(this, "Invoking AXIS call", call, axisInputs);
    Object axisResponse; // the response should be a Vector of RPCElement objects
    try {
      axisResponse = call.invoke(axisInputs);
    } catch (RemoteException ex) {
      throw new WSIFException(
        "exception on AXIS invoke: " + ex.getLocalizedMessage(),
        ex);
    }
    Trc.event(this, "Returned from AXIS invoke, response: ", axisResponse);
View Full Code Here

        /* this isn't so nice: the AttachmentPart has no name
         * so we have to assume the the List is in the same
         * order as the attachment Elements in the body.
         */
        if (al.size() != attachments.size()) {
          throw new WSIFException("unexpected number of attachments,"
              + attachments.size() + " AttachmentParts, "
              + al.size() + " attachment href elements");  
        }

        // fiddle the cid: for each attachment
View Full Code Here

    }
    if (value == null) {
      return;
    }
        if (!(value instanceof List)) {
          throw new WSIFException(
              "context part '"
              + WSIFAXISConstants.CONTEXT_DEFAULT_SOAP_TYPE_SERIALIZERS
              + "' value is not an instance of java.util.List: "
              + value);
        }
        List defaultMappings = (List) value;
        for (Iterator i = defaultMappings.iterator(); i.hasNext(); ) {
          Object o = i.next();
          if (!(o instanceof TypeSerializerInfo)) {
                throw new WSIFException(
                  "context part '"
                  + WSIFAXISConstants.CONTEXT_DEFAULT_SOAP_TYPE_SERIALIZERS
                  + "' value List contains an entry that is not an instance "
                  + "of org.apache.wsif.util.TypeSerializer: "
                  + value);
View Full Code Here

TOP

Related Classes of org.apache.wsif.WSIFException

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.