Package org.apache.tuscany.sca.binding.ws

Examples of org.apache.tuscany.sca.binding.ws.WebServiceBinding


        // deal with the data format that this wire format is expecting to sent to
        // and receive from the databinding interceptor. The request/response parts of
        // this interface contract will be copied into the binding interface contract
        // as required
        WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
        WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
        BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null);
        interfaceContract = wsBinding.getBindingInterfaceContract();
        interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
    }
View Full Code Here


        // deal with the data format that this wire format is expecting to sent to
        // and receive from the databinding interceptor. The request/response parts of
        // this interface contract will be copied into the binding interface contract
        // as required
        WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
        WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
        BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
        interfaceContract = wsBinding.getBindingInterfaceContract();
        interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
    }
View Full Code Here

        // deal with the data format that this wire format is expecting to sent to
        // and receive from the databinding interceptor. The request/response parts of
        // this interface contract will be copied into the binding interface contract
        // as required
        WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
        WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
        BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
        interfaceContract = wsBinding.getBindingInterfaceContract();
        interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());
    }
View Full Code Here

        // xml messages that will be sent

        // I think we have to check for asIs because the Java2WSDL will blow up when using javax.jms.Message
        if (service.getInterfaceContract() != null && !isAsIs()) {
            WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
            WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
            BindingWSDLGenerator.generateWSDL(component, service, wsBinding, registry, null);
            interfaceContract = wsBinding.getBindingInterfaceContract();
            interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());

            List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();

            for (Operation op : opList) {
View Full Code Here

        // set the binding interface contract to represent the WSDL for the
        // xml messages that will be sent
        // I think we have to check for asIs because the Java2WSDL will blow up when using javax.jms.Message
        if (reference.getInterfaceContract() != null && !isAsIs()) {
            WebServiceBindingFactory wsFactory = registry.getExtensionPoint(WebServiceBindingFactory.class);
            WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
            BindingWSDLGenerator.generateWSDL(component, reference, wsBinding, registry, null);
            interfaceContract = wsBinding.getBindingInterfaceContract();
            interfaceContract.getInterface().resetDataBinding(OMElement.class.getName());

            List<Operation> wsdlOpList = interfaceContract.getInterface().getOperations();

            for (Operation op : opList) {
View Full Code Here

                         System.out.println("Processing: "
                                            component.getName() +
                                            "/" +
                                            service.getName());
                         if (binding instanceof WebServiceBinding){
                             WebServiceBinding bindingWS = (WebServiceBinding) binding;
                             String filename = outputPath +
                                               "/" +
                                               component.getName() +
                                               "_" +
                                               service.getName() +
                                               "_" +
                                               binding.getName() +
                                               ".wsdl";
                             try {
                                 System.out.println("  Writing file: " + filename);
                                 System.out.flush();
                                 File file = new File(filename);
                                 file.createNewFile();
                                 FileOutputStream stream = new FileOutputStream(file);
                                 System.out.println("Generated WSDL for " + component.getName() + "/" + service.getName());
                                 WSDLWriter writer =  javax.wsdl.factory.WSDLFactory.newInstance().newWSDLWriter();
                                 writer.writeWSDL(bindingWS.getWSDLDefinition().getDefinition(),stream);
                             } catch (Exception e) {
                                 throw new WSDLGenerationException(e);
                             }
                         } else {
                             System.out.println("  No binding.ws" );
View Full Code Here

    }

    public WebServiceBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {

        // Read a <binding.ws>
        WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
        /*IntentAttachPointType bindingType = intentAttachPointTypeFactory.createBindingType();
        bindingType.setName(getArtifactType());
        bindingType.setUnresolved(true);
        ((PolicySetAttachPoint)wsBinding).setType(bindingType);*/
        wsBinding.setUnresolved(true);
        wsBinding.setBuilder(new BindingBuilderImpl(extensionPoints));

        // Read policies
        policyProcessor.readPolicies(wsBinding, reader);

        // Read the binding name
        String name = reader.getAttributeValue(null, NAME);
        if (name != null) {
            wsBinding.setName(name);
        }

        // Read URI
        String uri = reader.getAttributeValue(null, URI);
        if (uri != null) {
            wsBinding.setURI(uri);
        }

        // Read a qname in the form:
        // namespace#wsdl.???(name)
        Boolean wsdlElementIsBinding = null;
        String wsdlElement = reader.getAttributeValue(null, WSDL_ELEMENT);
        if (wsdlElement != null) {
            int index = wsdlElement.indexOf('#');
            if (index == -1) {
              error("InvalidWsdlElementAttr", reader, wsdlElement);
                //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
              return wsBinding;
            }
            String namespace = wsdlElement.substring(0, index);
            wsBinding.setNamespace(namespace);
            String localName = wsdlElement.substring(index + 1);
            if (localName.startsWith("wsdl.service")) {

                // Read a wsdl.service
                localName = localName.substring("wsdl.service(".length(), localName.length() - 1);
                wsBinding.setServiceName(new QName(namespace, localName));

            } else if (localName.startsWith("wsdl.port")) {

                // Read a wsdl.port
                localName = localName.substring("wsdl.port(".length(), localName.length() - 1);
                int s = localName.indexOf('/');
                if (s == -1) {
                  error("InvalidWsdlElementAttr", reader, wsdlElement);
                    //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
                } else {
                    wsBinding.setServiceName(new QName(namespace, localName.substring(0, s)));
                    wsBinding.setPortName(localName.substring(s + 1));
                }
            } else if (localName.startsWith("wsdl.endpoint")) {

                // Read a wsdl.endpoint
                localName = localName.substring("wsdl.endpoint(".length(), localName.length() - 1);
                int s = localName.indexOf('/');
                if (s == -1) {
                  error("InvalidWsdlElementAttr", reader, wsdlElement);
                    //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
                } else {
                    wsBinding.setServiceName(new QName(namespace, localName.substring(0, s)));
                    wsBinding.setEndpointName(localName.substring(s + 1));
                }
            } else if (localName.startsWith("wsdl.binding")) {

                // Read a wsdl.binding
                localName = localName.substring("wsdl.binding(".length(), localName.length() - 1);
                wsBinding.setBindingName(new QName(namespace, localName));

                wsdlElementIsBinding = true;

            } else {
              error("InvalidWsdlElementAttr", reader, wsdlElement);
                //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
            }
        }

        // Read wsdlLocation
        wsBinding.setLocation(reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION));
       
        // Handle extended attributes
        for (int a = 0; a < reader.getAttributeCount(); a++) {
            QName attributeName = reader.getAttributeName(a);
            if( attributeName.getNamespaceURI() != null && attributeName.getNamespaceURI() != WSDLI_NS && attributeName.getNamespaceURI().length() > 0) {
                if( (! Constants.SCA10_NS.equals(attributeName.getNamespaceURI()) &&
                    (! Constants.SCA10_TUSCANY_NS.equals(attributeName.getNamespaceURI()) ))) {
                    Object attributeValue = extensionAttributeProcessor.read(attributeName, reader);
                    Extension attributeExtension;
                    if (attributeValue instanceof Extension) {
                        attributeExtension = (Extension) attributeValue;
                    } else {
                        attributeExtension = extensionFactory.createExtension(attributeName, attributeValue, true);
                    }
                    wsBinding.getAttributeExtensions().add(attributeExtension);
                }
            }
        }


        ConfiguredOperation confOp = null;
        // Skip to end element
        while (reader.hasNext()) {
            int event = reader.next();
            switch (event) {
                case START_ELEMENT: {
                    if (END_POINT_REFERENCE.equals(reader.getName().getLocalPart())) {
                        if (wsdlElement != null && (wsdlElementIsBinding == null || !wsdlElementIsBinding)) {
                          error("MustUseWsdlBinding", reader, wsdlElement);
                            throw new ContributionReadException(wsdlElement + " must use wsdl.binding when using wsa:EndpointReference");
                        }
                        wsBinding.setEndPointReference(EndPointReferenceHelper.readEndPointReference(reader));
                    } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
                        confOp = configuredOperationProcessor.read(reader);
                        if (confOp != null) {
                            ((OperationsConfigurator)wsBinding).getConfiguredOperations().add(confOp);
                        }
View Full Code Here

            from.setTargetEndpoint(fromEndpoint);
            from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
            msg.setFrom(from);
            RuntimeEndpoint callbackEndpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint();
            //
            WebServiceBinding cbBinding = webServiceBindingFactory.createWebServiceBinding();
            cbBinding.setURI(callbackAddress);
            callbackEndpoint.setBinding(cbBinding);
            //
            callbackEndpoint.setURI(callbackAddress);
            callbackEndpoint.setUnresolved(true);
            from.setCallbackEndpoint(callbackEndpoint);
View Full Code Here

        policySubject.getRequiredIntents().add(soapIntent);
    }
   
    private void createWSBinding(JavaImplementation javaImplementation, Service service){
        if(service.getBindings().size() == 0){
            WebServiceBinding wsBinding = wsBindingFactory.createWebServiceBinding();
            wsBinding.setName(service.getName());
            ExtensionType bindingType = policyFactory.createBindingType();
            bindingType.setType(WebServiceConstants.BINDING_WS_QNAME);
            bindingType.setUnresolved(true);
            ((PolicySubject)wsBinding).setExtensionType(bindingType);
            service.getBindings().add(wsBinding);
View Full Code Here

                from.setTargetEndpoint(fromEndpoint);
                from.setStatus(EndpointReference.Status.WIRED_TARGET_FOUND_AND_MATCHED);
                requestMsg.setFrom(from);
                RuntimeEndpoint callbackEndpoint = (RuntimeEndpoint)assemblyFactory.createEndpoint();
                //
                WebServiceBinding cbBinding = webServiceBindingFactory.createWebServiceBinding();
                cbBinding.setURI(callbackAddress);
                callbackEndpoint.setBinding(cbBinding);
                //
                callbackEndpoint.setURI(callbackAddress);
                callbackEndpoint.setUnresolved(true);
                from.setCallbackEndpoint(callbackEndpoint);
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.binding.ws.WebServiceBinding

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.