Package org.apache.tuscany.sca.interfacedef.wsdl

Examples of org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface


            }

            PortType portType = getPortType(model);
            if (portType != null) {
                WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
                WSDLInterface wsdlInterface;
                try {
                    wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver);
                } catch (InvalidInterfaceException e) {
                    throw new ContributionResolveException(e);
                }
View Full Code Here


    /**
     * Resolve a WSDL interface.
     */
    static WSDLInterface resolve(final QName name, final ModelResolver res, final ProcessorContext ctx, final WSDLFactory wif) throws ContributionResolveException {
        final WSDLInterface wi = res.resolveModel(WSDLInterface.class, interfaze(name, wif), ctx);
        if(!wi.isUnresolved())
            return domBound(wi);

        final WSDLDefinition wd = res.resolveModel(WSDLDefinition.class, definition(wi.getName(), wif), ctx);
        if(wd.isUnresolved())
            throw new ContributionResolveException("Couldn't find " + name.getNamespaceURI());

        WSDLObject<PortType> pt = wd.getWSDLObject(PortType.class, name);
        if(pt == null)
            throw new ContributionResolveException("Couldn't find " + name);
        try {
            final WSDLInterface nwi = wif.createWSDLInterface(pt.getElement(), wd, res, ctx.getMonitor());
            nwi.setWsdlDefinition(wd);
            res.addModel(nwi, ctx);
            return domBound(nwi);
        } catch(InvalidInterfaceException e) {
            throw new ContributionResolveException(e);
        }
View Full Code Here

       
        // Load the test WSDL definitions (could also construct the WSDL
        // and XSD models in code but that'd be quite painful, so just
        // load them from XML for now)
        final Contribution contrib = build(contrib("test", here()), ec);
        WSDLInterface Hello_wsdl = build(wsdli("Hello.wsdl", "http://sample/hello", "Hello", contrib), ec);
        WSDLInterface Upper_wsdl = build(wsdli("Upper.wsdl", "http://sample/upper", "Upper", contrib), ec);

        // Assemble a test composite model (see EmbedUtil
        // for the little DSL used here, much more concise
        // than using the assembly model interfaces)
        final Composite comp =
View Full Code Here

    /**
     * Return a WSDL interface configured to use a DOM databinding.
     */
    static WSDLInterface domBound(WSDLInterface wi) throws ContributionResolveException {
        try {
            final WSDLInterface domwi = (WSDLInterface)wi.clone();
            domwi.resetDataBinding(DOMDataBinding.NAME);
            return domwi;
        } catch(CloneNotSupportedException e) {
            throw new ContributionResolveException(e);
        }
    }
View Full Code Here

            }

            PortType portType = getPortType(model);
            if (portType != null) {
                WSDLInterfaceContract interfaceContract = wsdlFactory.createWSDLInterfaceContract();
                WSDLInterface wsdlInterface = null;
                try {
                    wsdlInterface = wsdlFactory.createWSDLInterface(portType, wsdlDefinition, resolver, context.getMonitor());
                } catch (InvalidInterfaceException e) {
                  warning(monitor, "InvalidInterfaceException", wsdlFactory, model.getName(), e.getMessage());
                }
                interfaceContract.setInterface(wsdlInterface);
                interfaceContract.setCallbackInterface(wsdlInterface.getCallbackInterface());
                model.setBindingInterfaceContract(interfaceContract);
            }
           
            validateWSDL(context, model);
        } else {
View Full Code Here

        WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("stockquote.wsdl"), url, context);
        resolver.addModel(definition, context);
        definition = resolver.resolveModel(WSDLDefinition.class, definition, context);
        PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);
       
        WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor());
        WSDLOperation op = (WSDLOperation) wi.getOperations().get(0);

        DataType<List<DataType>> inputType = op.getInputType();
        Assert.assertEquals(1, inputType.getLogical().size());
        DataType<XMLType> type = inputType.getLogical().get(0);
        Assert.assertEquals(new QName("http://example.com/stockquote.xsd", "getLastTradePrice"), type.getLogical().getElementName());
View Full Code Here

        WSDLDefinition definition = (WSDLDefinition)documentProcessor.read(null, new URI("unwrapped-stockquote.wsdl"), url, context);
        resolver.addModel(definition, context);
        definition = resolver.resolveModel(WSDLDefinition.class, definition, context);
        PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);

        WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor());
        WSDLOperation op = (WSDLOperation) wi.getOperations().get(1);
        Assert.assertFalse(op.isWrapperStyle());
        Assert.assertEquals(1, op.getInputType().getLogical().size());

        op = (WSDLOperation) wi.getOperations().get(2);
        Assert.assertFalse(op.isWrapperStyle());
        Assert.assertEquals(2, op.getInputType().getLogical().size());
    }
View Full Code Here

        resolver.addModel(definition, context);
        definition = resolver.resolveModel(WSDLDefinition.class, definition, context);
        PortType portType = definition.getDefinition().getPortType(PORTTYPE_NAME);

        try {
            WSDLInterface wi = wsdlFactory.createWSDLInterface(portType, definition, resolver, context.getMonitor());
            WSDLOperation op = (WSDLOperation) wi.getOperations().get(0);

            op.isWrapperStyle();
            fail("InvalidWSDLException should have been thrown");
        } catch (InvalidInterfaceException e) {
            // Expected
View Full Code Here

       
        // the Java interface may be replaced by a WSDL contract picked up from JAXWS annotation
        // if so we need to fluff up a WSDL contract and set it to be the normalized contract
        // for the Java interface so it's used during contract mapping
        if (javaInterface != null && javaInterface.getJAXWSWSDLLocation() != null){
            WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();
            wsdlInterface.setUnresolved(true);
            wsdlInterface.setRemotable(true);
           
            WSDLInterfaceContract wsdlInterfaceContract = wsdlFactory.createWSDLInterfaceContract();
            wsdlInterfaceContract.setInterface(wsdlInterface);
            wsdlInterfaceContract.setLocation(javaInterface.getJAXWSWSDLLocation());
            javaInterfaceContract.setNormalizedWSDLContract(wsdlInterfaceContract);
           
            ProcessorContext wsdlContext = new ProcessorContext(javaInterface.getContributionContainingClass(),
                                                                context.getMonitor());
            extensionProcessor.resolve(wsdlInterfaceContract, resolver, wsdlContext);
           
            // check that the Java and WSDL contracts are compatible
            interfaceContractMapper.checkCompatibility(wsdlInterfaceContract,
                                                       javaInterfaceContract,
                                                       Compatibility.SUBSET,
                                                       false,
                                                       false);
           
            // copy policy from the WSDL interface to the Java interface
            javaInterface.getPolicySets().addAll(wsdlInterface.getPolicySets());
            javaInterface.getRequiredIntents().addAll(wsdlInterface.getRequiredIntents());
           
           // TODO - is there anything else to be copied from the user specified WSDL?
           
        }
       
View Full Code Here

            c.getModelResolver().addModel(wd, ctx);
            c.getModelResolver().resolveModel(WSDLDefinition.class, wd, ctx);
            PortType pt = (PortType)wd.getDefinition().getAllPortTypes().values().iterator().next();
           
            WSDLFactory wsdlFactory = registry.getExtensionPoint(FactoryExtensionPoint.class).getFactory(WSDLFactory.class);
            WSDLInterface nwi = wsdlFactory.createWSDLInterface(pt, wd, c.getModelResolver(), null);
            nwi.setWsdlDefinition(wd);
            WSDLInterfaceContract wsdlIC = wsdlFactory.createWSDLInterfaceContract();
            wsdlIC.setInterface(nwi);
           
            wsdlFile.delete();
           
View Full Code Here

TOP

Related Classes of org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface

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.