Package org.apache.wsif

Examples of org.apache.wsif.WSIFException


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


                Object value = inMsg.getObjectPart(partName);
                AttachmentPart ap = MIMEHelper.getAttachementPart(value);
        call.addAttachmentPart(ap);
        attachments.add(ap);
      } catch (WSIFException e) {
        throw new WSIFException("attachment part '" + p.getName() + "' not in input WSIFMessage");
      }
    }
    return attachments;
  }
View Full Code Here

  private void setOutputMessageValues(
    Object axisResponse,
    WSIFMessage outMsg)
    throws WSIFException {
    if (!(axisResponse instanceof Vector)) {
      throw new WSIFException(
        "expect response type of java.util.Vector of SOAPBodyElement, found: "
          + axisResponse);
    }

    Vector v = (Vector) axisResponse;
    for (int i = 0; i < v.size(); i++) {
      if (v.elementAt(i) instanceof RPCElement) {
        RPCElement rpcEl = (RPCElement) v.elementAt(i);

        QName qn = new QName(rpcEl.getNamespaceURI(), rpcEl.getName());
        Part p = findPart(outputSOAPParts, qn);
        if (p != null) {
          setSOAPPart(outMsg, rpcEl, p);
        } else {
          setAttachmentPart(outMsg, rpcEl);
        }
       
      } else {
        throw new WSIFException(
          "expecting response type org.w3c.dom.Element, found: "
            + v.elementAt(i));
      }
    }
  }
View Full Code Here

    private void setSOAPPart(WSIFMessage outMsg, RPCElement rpcEl, Part p) throws WSIFException {
        Object responseValue = null;
        try {
            responseValue = rpcEl.getAsDOM();
        } catch (Exception e) {
           throw new WSIFException(
            "exception getting soap body as DOM: " +
          e.getLocalizedMessage(),
          e);
        }
      String partName = p.getName();
View Full Code Here

        Vector params;
        try {
            params = rpcEl.getParams();
        } catch (SAXException e) {
          throw new WSIFException(
            "SAXException getting response MIME part: " +
        e.getLocalizedMessage(),
        e);
        }

        if (params == null || params.size() < 1) {
          throw new WSIFException(
            "no attachments found in response element: " + rpcEl);
        }
       
        //TODO: will there ever be more than 1?
        RPCParam rpcParam = (RPCParam) params.get(0);       

        QName qn = rpcParam.getQName();
        Part p = findPart(outputMIMEParts, qn);
      if (p != null) {
          Object responseValue = rpcParam.getValue();
        if (responseValue instanceof AttachmentPart) {
          try {
                    Object attachment = ((AttachmentPart)responseValue).getDataHandler();
                String partName = p.getName();
                outMsg.setObjectPart(partName, attachment);
                } catch (SOAPException e) {
                    throw new WSIFException(
                        "SOAPException getting DataHandler from AttachmentPart: " +
                 e.getLocalizedMessage(),
                  e);
                }
      } else {
             throw new WSIFException(
              "expecting response AttachmentPart but found: " + responseValue);
        }
      } else {
        throw new WSIFException("cannot find a WSDL output MIME part for response element: " + rpcEl);
      }

    }
View Full Code Here

        if (m != null) {
            javax.xml.soap.SOAPEnvelope env;
            try {
                env = m.getSOAPEnvelope();
            } catch (AxisFault e) {
              throw new WSIFException(
                  "AxisFault getting response SOAP envelope", e);
            }
            if (env != null) {
                javax.xml.soap.SOAPHeader soapHeader;
                try {
                    soapHeader = env.getHeader();
                } catch (SOAPException e) {
                  throw new WSIFException(
                      "SOAPException getting response headers from SOAP envelope", e);
                }
              addContextResponseSOAPHeaders(soapHeader);
            }
        }
View Full Code Here

                if (o instanceof SOAPHeaderElement) {
                  SOAPHeaderElement she = (SOAPHeaderElement) o;
                  try {
                        headers.add(she.getAsDOM());
                    } catch (Exception e) {
                        throw new WSIFException(
                            "exception getting response SOAP header",
                            e);
                  }
                } else {
                  Trc.event("unexpected response SOAP header type: ", o);
View Full Code Here

        String input = null;
        String output = null;

    Binding fieldBinding = fieldPort.getBinding();
    if (fieldBinding == null)
      throw new WSIFException("Unable to locate Binding");   

    //Locate Service
        Map sm = WSIFUtils.getAllItems( fieldDefinition, "Service" );
    Iterator services = sm.values().iterator();               
    while (services.hasNext() && serviceName ==null) {
      javax.wsdl.Service s = (javax.wsdl.Service)services.next();
         
      for (Iterator ports = s.getPorts().values().iterator(); ports.hasNext();) {
        javax.wsdl.Port p = (javax.wsdl.Port)ports.next();
        if (p.getBinding() != null && p.getBinding().getQName().equals(fieldBinding.getQName())) {
          // Binding found
          serviceName = s.getQName();
          break;
        }
      }
    }
   
    if (serviceName == null)
      throw new WSIFException("Unable to locate Service");


        // Find the operation, if the Port only contains 1 operation then use
    // that one, otherwise use the one defined in the JMS message properties.
    javax.wsdl.PortType portType = fieldBinding.getPortType();
    if (portType!= null) {
       List operations = portType.getOperations();
       if (operations != null && operations.size() == 1 ) {
           javax.wsdl.Operation o = (javax.wsdl.Operation)operations.get(0);
         operationName = o.getName();
         if (o.getInput() != null) {
            input = o.getInput().getName();
         }
         if (o.getOutput() != null) {
            output = o.getOutput().getName();
         }
      }
    }

    if (operationName == null) {
       try {
        operationName = msg.getStringProperty( WSIFConstants.JMS_PROP_OPERATION_NAME );
        input = msg.getStringProperty( WSIFConstants.JMS_PROP_INPUT_NAME );
        output = msg.getStringProperty( WSIFConstants.JMS_PROP_OUTPUT_NAME );     
       } catch (javax.jms.JMSException e) {
           Trc.exception(e);
       }
    }
    if (operationName == null)
       throw new WSIFException( "Unable to determine Operation" );

       
    WSIFRequest request = new WSIFRequest( serviceName );
    request.setPortName( fieldPort.getName() );
        request.setOperationName( operationName );
View Full Code Here

        String input = null;
        String output = null;

    Binding fieldBinding = fieldPort.getBinding();
    if (fieldBinding == null)
      throw new WSIFException("Unable to locate Binding");   

    //Locate Service
        Map sm = WSIFUtils.getAllItems( fieldDefinition, "Service" );
    Iterator services = sm.values().iterator();               
    while (services.hasNext() && serviceName ==null) {
      javax.wsdl.Service s = (javax.wsdl.Service)services.next();
         
      for (Iterator ports = s.getPorts().values().iterator(); ports.hasNext();) {
        javax.wsdl.Port p = (javax.wsdl.Port)ports.next();
        if (p.getBinding() != null && p.getBinding().getQName().equals(fieldBinding.getQName())) {
          // Binding found
          serviceName = s.getQName();
          break;
        }
      }
    }
   
    if (serviceName == null)
      throw new WSIFException("Unable to locate Service");

    // Locate the Operation from the stored values
    operationName = getOperationName();
    input = getInputName();
    output = getOutputName();

    if (operationName == null || operationName.equals("")) { 
      // Nothing defined.  Resort to getting the info from the wsdl document
      javax.wsdl.PortType portType = fieldBinding.getPortType();
      if (portType!= null) {
        List operations = portType.getOperations();
        if (operations != null) {
          if (operations.size() == 1) {
            javax.wsdl.Operation o = (javax.wsdl.Operation)operations.get(0);
            operationName = o.getName();
            if (o.getInput() != null)
              input = o.getInput().getName();
            if (o.getOutput() != null)
              output = o.getOutput().getName();
          }
          else
            throw new WSIFException("Port Type definition contains multiple operations.");
        }
      }
    }

    if (operationName == null)
      throw new WSIFException("Unable to locate Operation");
       
    WSIFResponse response = new WSIFResponse(serviceName);
    response.setPortName(fieldPort.getName());
        response.setOperationName(operationName);
        response.setInputName(input);
View Full Code Here

        Trc.entry(this, out, binding, bop, bndFName, bndF);

        Operation op = bop.getOperation();
        Fault fault = op.getFault(bndFName);
        if (fault == null)
            throw new WSIFException(
                "No fault "
                    + bndFName
                    + " found in operation "
                    + op.getName());
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.