Examples of WebServiceBinding


Examples of org.apache.tuscany.binding.axis2.assembly.WebServiceBinding

    public void setTomcatHost(ServletHost tomcatHost) {
        this.tomcatHost = tomcatHost;
    }

    protected EntryPointContextFactory createEntryPointContextFactory(EntryPoint entryPoint, MessageFactory msgFactory) {
        WebServiceBinding wsBinding = (WebServiceBinding) entryPoint.getBindings().get(0);
        return new WSEntryPointContextFactory(entryPoint.getName(), messageFactory, tomcatHost, wsBinding);
    }
View Full Code Here

Examples of org.apache.tuscany.binding.axis2.assembly.WebServiceBinding

    }

    @SuppressWarnings("deprecation")
    public WebServiceBinding load(XMLStreamReader reader, LoaderContext loaderContext) throws XMLStreamException, ConfigurationLoadException {

        WebServiceBinding binding = WS_FACTORY.createWebServiceBinding();
        binding.setURI(reader.getAttributeValue(null, "uri"));
        binding.setPortURI(reader.getAttributeValue(null, "port"));
        binding.setTypeHelper(registry.getContext().getTypeHelper());
        binding.setWebAppName(registry.getContext().getWebAppName());
        binding.setResourceLoader(loaderContext.getResourceLoader());
        return binding;
    }
View Full Code Here

Examples of org.apache.tuscany.binding.axis2.assembly.WebServiceBinding

        };
        return es;
    }

    private Binding createMockBinding() {
        WebServiceBinding b = new WebServiceBinding() {

            public void setPortURI(String portURI) {

            }
View Full Code Here

Examples of org.apache.tuscany.binding.axis2.assembly.WebServiceBinding

     * @see org.apache.tuscany.core.extension.ExternalServiceBuilderSupport#createExternalServiceContextFactory(org.apache.tuscany.model.assembly.ExternalService)
     */
    @Override
    protected ExternalServiceContextFactory createExternalServiceContextFactory(ExternalService externalService) {

        WebServiceBinding wsBinding = (WebServiceBinding) externalService.getBindings().get(0);
        Definition wsdlDefinition = wsBinding.getWSDLDefinition();
        WebServicePortMetaData wsPortMetaData = new WebServicePortMetaData(wsdlDefinition, wsBinding.getWSDLPort(), wsBinding.getURI(), false);

        ServiceClient serviceClient = createServiceClient(externalService.getName(), wsdlDefinition, wsPortMetaData);

        TypeHelper typeHelper = wsBinding.getTypeHelper();
        ClassLoader cl = wsBinding.getResourceLoader().getClassLoader();
        Class serviceInterface = externalService.getConfiguredService().getPort().getServiceContract().getInterface();
        Map<String, Axis2OperationInvoker> invokers = createOperationInvokers(serviceInterface, typeHelper, cl, wsPortMetaData);

        Axis2ServiceInvoker axis2Client = new Axis2ServiceInvoker(serviceClient, invokers);

View Full Code Here

Examples of org.apache.tuscany.binding.celtix.assembly.WebServiceBinding

    @SuppressWarnings("deprecation")
    public WebServiceBinding load(XMLStreamReader reader, LoaderContext loaderContext)
        throws XMLStreamException, ConfigurationLoadException {

        WebServiceBinding binding = WS_FACTORY.createWebServiceBinding(wsdlRegistry);
        binding.setURI(reader.getAttributeValue(null, "uri"));
        binding.setPortURI(reader.getAttributeValue(null, "port"));
        binding.setTypeHelper(registry.getContext().getTypeHelper());
        binding.setResourceLoader(loaderContext.getResourceLoader());
        binding.setBus(bus);
        return binding;
    }
View Full Code Here

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

    }

    public WebServiceBinding read(XMLStreamReader reader, ProcessorContext context) throws ContributionReadException, XMLStreamException {
        Monitor monitor = context.getMonitor();
        // Read a <binding.ws>
        WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
        /*ExtensionType bindingType = intentAttachPointTypeFactory.createBindingType();
        bindingType.setName(getArtifactType());
        bindingType.setUnresolved(true);
        ((PolicySubject)wsBinding).setType(bindingType);*/
        wsBinding.setUnresolved(true);

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

        // Read the binding name
        String name = reader.getAttributeValue(null, NAME);
        if (name != null) {
            wsBinding.setName(name);
        }
       
        // a collection of endpoint specifications so that we can test that
        // only one is present
        List<String> endpointSpecifications = new ArrayList<String>();

        // Read URI
        String uri = getURIString(reader, URI);
        if (uri != null) {
            wsBinding.setURI(uri);
           
            // BWS20001
            if (context.getParentModel() instanceof Reference){
                try {
                    URI tmpURI = new URI(uri);
                   
                    if (!tmpURI.isAbsolute()){
                        error(monitor, "URINotAbsolute", reader, uri);
                    }
                } catch (URISyntaxException ex){
                    error(monitor, "InvalidURISyntax", reader, ex.getMessage());
                }
                endpointSpecifications.add("uri");
            }
           
            // BWS20020
            if ((context.getParentModel() instanceof Callback) &&
                (((Callback)context.getParentModel()).getParentContract() instanceof org.apache.tuscany.sca.assembly.Service)){
                error(monitor, "URIFoundForServiceCallback", reader, uri);
            }
        }

        // Read a qname in the form:
        // namespace#wsdl.???(name)
        Boolean wsdlElementIsBinding = null;
        String wsdlElement = getURIString(reader, WSDL_ELEMENT);
        if (wsdlElement != null) {
            int index = wsdlElement.indexOf('#');
            if (index == -1) {
              error(monitor, "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")) {

                // BWS20003
                if (context.getParentModel() instanceof org.apache.tuscany.sca.assembly.Service){
                    error(monitor, "WSDLServiceOnService", reader, wsdlElement);
                }
               
                // Read a wsdl.service
                localName = localName.substring("wsdl.service(".length(), localName.length() - 1);
                wsBinding.setServiceName(new QName(namespace, localName));
               
                endpointSpecifications.add("#wsdl.service");

            } 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(monitor, "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));
                }
               
                endpointSpecifications.add("#wsdl.port");
            } 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(monitor, "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(monitor, "InvalidWsdlElementAttr", reader, wsdlElement);
                //throw new ContributionReadException("Invalid WebService binding wsdlElement attribute: " + wsdlElement);
            }
        }

        // Read wsdlLocation
        String wsdliLocation = reader.getAttributeValue(WSDLI_NS, WSDL_LOCATION);
        if (wsdliLocation != null) {
            if (wsdlElement == null) {
                error(monitor, "WsdliLocationMissingWsdlElement", reader);
            }
            String[] iris = wsdliLocation.split(" ");
            if (iris.length % 2 != 0) {
                error(monitor, "WsdliLocationNotIRIPairs", reader);
            }
            for (int i=0; i<iris.length-1; i=i+2) {
                wsBinding.getWsdliLocations().put(iris[i], iris[i+1]);
            }
        }

        // 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(monitor, "MustUseWsdlBinding", reader, wsdlElement);
                            throw new ContributionReadException(wsdlElement + " must use wsdl.binding when using wsa:EndpointReference");
                        }
                       
                        wsBinding.setEndPointReference(EndPointReferenceHelper.readEndPointReference(reader));
                        endpointSpecifications.add("wsa:EndpointReference");
                    }
                }
                    break;

View Full Code Here

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

       
        // Test that generated WSDL matches expected
        // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
        // No other services on ComponentB should have <binding.ws>
        Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
        WebServiceBinding wsBinding = null;
   
        for (ComponentService service : componentB.getServices()) {
            WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
            if ("Service2".equals(service.getName())) {
                wsBinding = wsb;
            } else {
                assert wsb == null;
            }
View Full Code Here

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

        Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
        if (!nonWiring) {
            // Should create component service $promoted$.Service1 on innermost component
            //  ComponentD, with <binding.ws> and uri="/Service1"
            // No other services on ComponentD should have <binding.ws>
            WebServiceBinding wsBinding = null;
            for (ComponentService service : componentD.getServices()) {
                WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
                if ("$promoted$.Service1".equals(service.getName())) {
                    wsBinding = wsb;
                } else {
                    assert wsb == null;
                }
            }
            assert "/Service1".equals(wsBinding.getURI());

            // Should create WSDL document for ComponentD/$promoted$.Service1 with endpoint uri="/Service1"
            Definition def = wsBinding.getWSDLDocument();
            javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
            Port port = svc.getPort("Service3Port");
            assert "/Service1".equals(TestUtils.getPortAddress(port));
        } else {
            // Should not create component service $promoted$.Service1 on innermost component ComponentD
            // No component services on ComponentD should have <binding.ws>
            for (ComponentService service : componentD.getServices()) {
                assert !"$promoted$.Service1".equals(service.getName());
                assert service.getBinding(WebServiceBinding.class) == null;
            }
        }

        // No services on ComponentB should have <binding.ws>
        Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
        for (ComponentService service : componentB.getServices()) {
            assert service.getBinding(WebServiceBinding.class) == null;
        }

        // No services on CompositeC should have <binding.ws>
        Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario1", "CompositeC"));
        for (Service service : compositeC.getServices()) {
            assert service.getBinding(WebServiceBinding.class) == null;
        }

        if (nonWiring) {
            // Should not add a WSDL document to domain composite service Service1
            WebServiceBinding wsBinding = null;
            for (Service service : domainComposite.getServices()) {
                if ("Service1".equals(service.getName())) {
                    wsBinding = service.getBinding(WebServiceBinding.class);
                }
            }
            assert wsBinding.getWSDLDocument() == null;
        }
    }
View Full Code Here

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

        Composite domainComposite = customBuilder.getDomainComposite();

        // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
        // No other services on ComponentB should have <binding.ws>
        Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
        WebServiceBinding wsBinding = null;
        for (ComponentService service : componentB.getServices()) {
            WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
            if ("Service2".equals(service.getName())) {
                wsBinding = wsb;
            } else {
                assert wsb == null;
            }
View Full Code Here

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

    private void checkScenario4Results(boolean nonWiring) {
        Composite domainComposite = customBuilder.getDomainComposite();

        // Should create WSDL document for ComponentD/Service3 with endpoint uri="/ComponentD/Service3"
        Component componentD = TestUtils.getComponent(domainComposite, "ComponentD");
        WebServiceBinding wsBinding = null;
        for (ComponentService service : componentD.getServices()) {
            if ("Service3".equals(service.getName())) {
                wsBinding = service.getBinding(WebServiceBinding.class);
            }
        }
        Definition def = wsBinding.getWSDLDocument();
        javax.wsdl.Service svc = def.getService(new QName("http://builder.itest.sca.tuscany.apache.org/", "Service3Service"));
        Port port = svc.getPort("Service3Port");
        assert "/ComponentB/ComponentD/Service3".equals(TestUtils.getPortAddress(port));

        // Should add <binding.ws> to inner composite service CompositeC/Service2
        // No other services on CompositeC should have <binding.ws>
        Composite compositeC = TestUtils.getComposite(domainComposite, new QName("http://scenario4", "CompositeC"));
        wsBinding = null;
        for (Service service : compositeC.getServices()) {
            WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
            if ("Service2".equals(service.getName())) {
                wsBinding = wsb;
            } else {
                assert wsb == null;
            }
        }
        assert "/ComponentB/Service2".equals(wsBinding.getURI());

        // Should add <binding.ws> to outer component service ComponentB/Service2
        // Should create WSDL document for ComponentB/Service2 with endpoint uri="/ComponentB/Service2"
        // No other services on ComponentB should have <binding.ws>
        Component componentB = TestUtils.getComponent(domainComposite, "ComponentB");
        wsBinding = null;
        for (ComponentService service : componentB.getServices()) {
            WebServiceBinding wsb = service.getBinding(WebServiceBinding.class);
            if ("Service2".equals(service.getName())) {
                wsBinding = wsb;
            } else {
                assert wsb == null;
            }
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.