Package org.apache.wsif

Examples of org.apache.wsif.WSIFException


            {
                ejoeAdapter = AdapterFactory.createAdapter( adapter );
            }
            catch ( Exception e )
            {
                throw new WSIFException( "The given SerializeAdapter " + adapter + " could not be loaded!", e );
            }
        }

        if ( Trc.ON ) Trc.exit( deep() );
    }
View Full Code Here


        Trc.entry( this, operationName, inputName, outputName );

        WSIFOperation_EJOE op = getDynamicEJOEOperation( operationName, inputName, outputName );
        if ( op == null )
        {
            throw new WSIFException( "Could not create operation: " + operationName + ':' + inputName + ':'
                    + outputName );
        }
        WSIFOperation wo = op.copy();
        Trc.exit( wo );
        return wo;
View Full Code Here

            fieldEJOEOperationModel = (EJOEOperation) fieldBindingOperationModel.getExtensibilityElements().get( 0 );
        }
        catch ( Exception e )
        {
            Trc.exception( e );
            throw new WSIFException( "Unable to resolve Java binding for operation '" + bindingOperationModel.getName()
                    + '\'' );
        }

        initialize();
View Full Code Here

            }
            catch ( Exception e )
            {
                Trc.exception( e );
                throw new WSIFException( "Exception occured while processing WSIF-Request!", e );
            }

            // Deal with the output message
            String outParameterName = null;
            if ( fieldOutParameterNames.length == 1 )
            {
                // Only one output part - it must be the object returned by the
                // remote service invocation
                output.setName( getOutputMessageName() );
                outParameterName = fieldOutParameterNames[0];
                if ( outParameterName != null )
                {
                    output.setObjectPart( outParameterName, result );
                }
            }
            else if ( fieldOutParameterNames.length > 1 )
            {
                if ( Map.class.isAssignableFrom( result.getClass() ) )
                {
                    // Method should have returned a Map
                    if ( !(result instanceof Map) )
                    {
                        throw new WSIFException( "Operation " + getOperation().getName()
                                + " defined as returning multiple parts "
                                + "and the ServerHandler did not return an instance of java.util.Map" );
                    }

                    Map returnedMap = (Map) result;
                    output.setName( getOutputMessageName() );

                    // Get multiple output parts from the map
                    for ( int p = 0; p < fieldOutParameterNames.length; p++ )
                    {
                        String pName = fieldOutParameterNames[p];
                        if ( returnedMap.containsKey( pName ) )
                        {
                            Object outPart = returnedMap.get( pName );
                            output.setObjectPart( pName, outPart );
                        }
                        else
                        {
                            throw new WSIFException( "Operation " + getOperation().getName()
                                    + " defined as returning multiple parts." + " Part " + pName
                                    + " was missing from the Map returned by " + "the remote ServerHandler" );
                        }
                    }
                }
View Full Code Here

     */
    private static void getImportedSchemas(String base, String rel, WSDLLocator loc, List schemaList) throws WSIFException  {
        try {
            Reader reader = loc.getImportReader(base, rel);
            if (reader == null) {
              throw new WSIFException("Unable to read schema file "+rel+" relative to "+base);
            }
            InputSource inputSource = new InputSource(reader);
            DocumentBuilderFactory factory =
                DocumentBuilderFactory.newInstance();

            factory.setNamespaceAware(true);
            factory.setValidating(false);

            DocumentBuilder builder = factory.newDocumentBuilder();
            Document doc = builder.parse(inputSource);
      reader.close();

            Element el = doc.getDocumentElement();
            if (el != null) {
                if (QNameUtils.matches(schema2001, el)
                    || QNameUtils.matches(schema2000, el)
                    || QNameUtils.matches(schema1999, el)) {
                     Schema sc = new Schema(el);
                    schemaList.add(sc);
                    String[] importsAndIncludes = sc.getImportsAndIncludes();
                    String lastURI = loc.getLatestImportURI();
                    for (int i=0; i<importsAndIncludes.length; i++) {
                      String sl = importsAndIncludes[i];
                      getImportedSchemas(lastURI, sl, loc, schemaList);
                    }
                }
            }
        } catch (Exception e) {
          Trc.exception(e);
          if (e instanceof WSIFException) {
            throw (WSIFException) e;
          } else {
            throw new WSIFException("Error when getting imported schemas", e);
          }
        }
    }
View Full Code Here

            (SOAPAddress) getExtElem(port,
                SOAPAddress.class,
                port.getExtensibilityElements());

        if (sa != null && ja != null)
            throw new WSIFException(
                "Both soap:address and jms:address cannot be specified for port "
                    + port.getName());

        if (sa == null && ja == null)
            throw new WSIFException(
                "Either soap:address or jms:address must be specified for port "
                    + port.getName());

        if (ja != null) {
            // Port jms:address binding element
            jmsAddressPropVals = ja.getJMSPropertyValues();
            st = new SOAPJMSConnection(ja, port.getName());
        } else {
            // Port soap:address bindng element
            st = new SOAPHTTPConnection();
            // call.getSOAPTransport() is null...

            String s = sa.getLocationURI();
            try {
                url = new URL(s);
            } catch (MalformedURLException meu) {
            Trc.exception(meu);
                throw new WSIFException(
                    "could not set SOAP address to " + s,
                    meu);
            }
            if (url == null) {
                throw new WSIFException(
                    "soap:address with location URI is required for " + port.getName());
            }
        }

        // check soap:binding element
        Binding binding = port.getBinding();
        SOAPBinding soapBinding =
            (SOAPBinding) getExtElem(binding,
                SOAPBinding.class,
                binding.getExtensibilityElements());
        if (soapBinding != null) {
            style = soapBinding.getStyle();
            if (style == null)
                style = "document"; //it is default style value as of WSDL 1.1

            String transport = soapBinding.getTransportURI();
            if ((ja != null
                && !"http://schemas.xmlsoap.org/soap/jms".equals(transport))
                || (sa != null
                    && !"http://schemas.xmlsoap.org/soap/http".equals(
                        transport))) {
                throw new WSIFException(
                    "unsupported transport "
                        + transport
                        + " for "
                        + soapBinding);
            }
View Full Code Here

        throws WSIFException {
        Trc.entry(this, operationName, inputName, outputName);
        WSIFOperation_ApacheSOAP op =
            getDynamicWSIFOperation(operationName, inputName, outputName);
        if (op == null) {
            throw new WSIFException(
                "Could not create operation: "
                    + operationName
                    + ":"
                    + inputName
                    + ":"
View Full Code Here

                    new WSIFOperation_ApacheSOAP(
                        this,
                        bop.getOperation(),
                        wsifTypeMap);
                if (operation == null) {
                    throw new WSIFException(
                        "Operation not found from binding operation: "
                            + bop.getName());
                }

                operation.setStyle(this.style);
                operation.setPartSerializerName(this.partSerializerName);

                if (jmsAddressPropVals != null
                    && jmsAddressPropVals.size() > 0) {
                    if (st instanceof SOAPJMSConnection)
                        operation.addInputJmsPropertyValues(jmsAddressPropVals);
                    else
                        throw new WSIFException("jms:propertyValue found in non-jms address");
                }

                // get soapActionURI and style from soap:operation
                SOAPOperation soapOperation =
                    (SOAPOperation) getExtElem(bop,
                        SOAPOperation.class,
                        bop.getExtensibilityElements());
                if (soapOperation == null) {
                    throw new WSIFException(
                        "soapAction must be specified in "
                            + " required by WSDL 1.1 soap:operation binding for "
                            + bop.getName());
                }
                String soapActionURI = soapOperation.getSoapActionURI();
                operation.setSoapActionURI(soapActionURI);

                Trc.event(
                    this,
                    "setting actionURI ",
                    soapActionURI,
                    " for op ",
                    operation.getName());
                String opStyle = soapOperation.getStyle();

                // try to get soap:body for input message
                BindingInput binpt = bop.getBindingInput();
                SOAPBody soapInputBody =
                    (SOAPBody) getExtElem(binpt,
                        SOAPBody.class,
                        binpt.getExtensibilityElements());
                if (soapInputBody != null) {
                    String namespaceURI = soapInputBody.getNamespaceURI();

                    Trc.event(
                        this,
                        "setting namespace ",
                        namespaceURI,
                        " for op ",
                        operation.getName());

                    operation.setInputNamespace(namespaceURI);
                    String use = soapInputBody.getUse();
                    operation.setInputUse(use);

                    List encodingStyles = soapInputBody.getEncodingStyles();
                    if (encodingStyles != null) {
                        if (encodingStyles.size() == 0) {
                        }
                        operation.setInputEncodingStyle(
                            (String) encodingStyles.get(0));
                        // quietly ignore if encodingStyles.size() > 1 ...
                    }
                    List parts = soapInputBody.getParts();
                    if (parts != null)
                        operation.setPartNames(parts);
                }

                SOAPHeader soapHeader =
                    (SOAPHeader) getExtElem(binpt,
                        SOAPHeader.class,
                        binpt.getExtensibilityElements());
                if (soapHeader != null) {
                    throw new WSIFException(
                        "not supported input soap:header " + soapHeader);
                }

                List inJmsProps =
                    getExtElems(
                        binpt,
                        JMSProperty.class,
                        binpt.getExtensibilityElements());
                if (inJmsProps != null && inJmsProps.size() > 0) {
                    if (st instanceof SOAPJMSConnection)
                        operation.setInputJmsProperties(inJmsProps);
                    else
                        throw new WSIFException("jms:properties found in non-jms binding");
                }

                List inJmsPropVals =
                    getExtElems(
                        binpt,
                        JMSPropertyValue.class,
                        binpt.getExtensibilityElements());
                if (inJmsPropVals != null && inJmsPropVals.size() > 0) {
                    if (st instanceof SOAPJMSConnection)
                        operation.addInputJmsPropertyValues(inJmsPropVals);
                    else
                        throw new WSIFException("jms:propertyValue found in non-jms binding");
                }

                // try to get soap:body for output message
                BindingOutput boutpt = bop.getBindingOutput();
                if (boutpt != null) {
                    SOAPBody soapOutputBody =
                        (SOAPBody) getExtElem(boutpt,
                            SOAPBody.class,
                            boutpt.getExtensibilityElements());
                    if (soapOutputBody != null) {
                        // NOTE: element ignored
                        //String namespaceURI = soapOutputBody.getNamespaceURI();
                        String use = soapOutputBody.getUse();
                        operation.setOutputUse(use);

                        // NOTE: element ignored
                        //List encodingStyles = soapInputBody.getEncodingStyles();
                        List parts = soapOutputBody.getParts();
                        if (parts != null && parts.size() > 0) {
                            operation.setReturnName((String) parts.get(0));
                        }
                    }
                    soapHeader =
                        (SOAPHeader) getExtElem(boutpt,
                            SOAPHeader.class,
                            boutpt.getExtensibilityElements());
                    if (soapHeader != null) {
                        throw new WSIFException(
                            "not supported output soap:header " + soapHeader);
                    }

                    List outJmsProps =
                        getExtElems(
                            boutpt,
                            JMSProperty.class,
                            boutpt.getExtensibilityElements());
                    if (outJmsProps != null && outJmsProps.size() > 0) {
                        if (st instanceof SOAPJMSConnection)
                            operation.setOutputJmsProperties(outJmsProps);
                        else
                            throw new WSIFException("jms:properties found in non-jms binding");
                    }
                }

                // Only now the operation has enough information to initialize itself
                //        operation.prepare();
View Full Code Here

            (SOAPAddress) getExtElem(port,
                SOAPAddress.class,
                port.getExtensibilityElements());

        if (sa != null && ja != null)
            throw new WSIFException(
                "Both soap:address and jms:address cannot be specified for port "
                    + port.getName());

        if (sa == null && ja == null)
            throw new WSIFException(
                "Either soap:address or jms:address must be specified for port "
                    + port.getName());

        if (ja != null) {
            // Port jms:address binding element
View Full Code Here

    Trc.entry(this, input, output, fault);
    close();

    if (!fieldJmsPort.supportsSync())
      throw new WSIFException("synchronous operations not available");

    setAsyncOperation(false);

    boolean operationSucceeded = true;
    try {
      getOperation();

      // send the jms message   
      String correlId = sendJmsMessage(input);

      WSIFJMSDestination jmsDest = fieldJmsPort.getJmsDestination();
      javax.jms.Message response = jmsDest.receive(correlId, syncTimeout);
      operationSucceeded = receiveJmsMessage(response, output, fault);

    } catch (Exception ex) {
      Trc.exception(ex);

      // Log message
      MessageLogger.log(
        "WSIF.0005E",
        "Jms",
        fieldBindingOperation.getName());

      throw new WSIFException(
        this
          + " : Could not invoke '"
          + fieldBindingOperation.getName()
          + "'",
        ex);
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.