Examples of WSDLDefinition


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

    static Builder<WSDLInterface> wsdli(final String uri, final String ns, final String name, final Contribution c) {
        return new Builder<WSDLInterface>() {
            public WSDLInterface build(final Context ec) {
                try {
                    final ProcessorContext ctx = new ProcessorContext();
                    final WSDLDefinition wd = ec.aproc.read(null, new URI(uri), new URL(new URL(c.getLocation()), uri), ctx, WSDLDefinition.class);
                    c.getModelResolver().addModel(wd, ctx);
                    c.getModelResolver().resolveModel(WSDLDefinition.class, wd, ctx);
                    final WSDLObject<PortType> pt = wd.getWSDLObject(PortType.class, new QName(ns, name));
                    if(pt == null)
                        throw new ContributionResolveException("Couldn't find " + name);
                    final WSDLInterface nwi = ec.wif.createWSDLInterface(pt.getElement(), wd, c.getModelResolver(), null);
                    nwi.setWsdlDefinition(wd);
                    nwi.resetDataBinding(DOMDataBinding.NAME);
View Full Code Here

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

    /**
     * Convert a WSDL qname to a WSDL definition.
     */
    static WSDLDefinition definition(final QName name, final WSDLFactory wif) {
        final WSDLDefinition wdr = wif.createWSDLDefinition();
        wdr.setUnresolved(true);
        wdr.setNamespace(name.getNamespaceURI());
        wdr.setNameOfPortTypeToResolve(name);
        return wdr;
    }
View Full Code Here

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

        WSDLInterfaceContract wsdlContract = wsdlFactory.createWSDLInterfaceContract();
        WSDLInterface wsdlInterface = wsdlFactory.createWSDLInterface();

        wsdlContract.setInterface(wsdlInterface);
        WSDLDefinition wsdlDefinition = new DefaultWSDLFactory().createWSDLDefinition();
        wsdlDefinition.setDefinition(def);
        wsdlInterface.setWsdlDefinition(wsdlDefinition);
        wsdlInterface.setRemotable(true);
        wsdlInterface.setConversational(contract.getInterface().isConversational());
        wsdlInterface.setUnresolved(false);
        wsdlInterface.setRemotable(true);
View Full Code Here

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

    public void resolve(WebServiceBinding model, ModelResolver resolver, ProcessorContext context) throws ContributionResolveException {
       
      if (model == null || !model.isUnresolved())
        return;
      Monitor monitor = context.getMonitor()
      WSDLDefinition wsdlDefinition = wsdlFactory.createWSDLDefinition();
        wsdlDefinition.setUnresolved(true);
        wsdlDefinition.setNamespace(model.getNamespace());
        wsdlDefinition.setNameOfBindingToResolve(model.getBindingName());
        wsdlDefinition.setNameOfServiceToResolve(model.getServiceName());
        wsdlDefinition.getWsdliLocations().putAll(model.getWsdliLocations());
        WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, wsdlDefinition, context);

        if (!resolved.isUnresolved()) {
            wsdlDefinition.setDefinition(resolved.getDefinition());
            wsdlDefinition.setLocation(resolved.getLocation());
            wsdlDefinition.setURI(resolved.getURI());
            wsdlDefinition.getImportedDefinitions().addAll(resolved.getImportedDefinitions());
            wsdlDefinition.getXmlSchemas().addAll(resolved.getXmlSchemas());
            wsdlDefinition.setUnresolved(false);
            model.setUserSpecifiedWSDLDefinition(wsdlDefinition);
            if (model.getBindingName() != null) {
                WSDLObject<Binding> binding = wsdlDefinition.getWSDLObject(Binding.class, model.getBindingName());
                if (binding != null) {
View Full Code Here

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

       
        policyProcessor.resolvePolicies(model, resolver, context);
    }

    private void validateWSDL(ProcessorContext context, WebServiceBinding model) {
        WSDLDefinition wsdlDefinition = model.getUserSpecifiedWSDLDefinition();
       
        Port port = model.getPort();
       
        if (port != null){
            validateWSDLPort(context, model, port);
View Full Code Here

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

       }
     }

    public WSDLDefinition read(URL contributionURL, URI artifactURI, URL artifactURL, ProcessorContext context) throws ContributionReadException {
        try {
            WSDLDefinition definition = indexRead(artifactURL);
            definition.setURI(artifactURI);
            return definition;
        } catch (Exception e) {
          ContributionReadException ce = new ContributionReadException(e);
          error(context.getMonitor(), "ContributionReadException", artifactURL, ce);
            //throw ce;
View Full Code Here

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

                        continue;
                    }
                    if (imp.getLocationURI() == null) {
                        // FIXME: [rfeng] By the WSDL 1.1 Specification, the location attribute is required
                        // We need to resolve it by QName
                        WSDLDefinition proxy = factory.createWSDLDefinition();
                        proxy.setUnresolved(true);
                        proxy.setNamespace(imp.getNamespaceURI());
                        WSDLDefinition resolved = resolver.resolveModel(WSDLDefinition.class, proxy, context);
                        if (resolved != null && !resolved.isUnresolved()) {
                            imp.setDefinition(resolved.getDefinition());
                            if (!model.getImportedDefinitions().contains(resolved)) {
                                model.getImportedDefinitions().add(resolved);
                            }
                        }
                    } else {
                        String location = imp.getLocationURI();
                        if (location.indexOf(' ') != -1) {
                            location = location.replace(" ", "%20");
                        }
                        URI uri = URI.create(location);
                        if (uri.isAbsolute()) {
                            WSDLDefinition resolved;
                            try {
                                resolved = read(null, uri, uri.toURL(), context);
                                imp.setDefinition(resolved.getDefinition());
                                if (!model.getImportedDefinitions().contains(resolved)) {
                                    model.getImportedDefinitions().add(resolved);
                                }
                            } catch (Exception e) {
                              ContributionResolveException ce = new ContributionResolveException(e);
                              error(monitor, "ContributionResolveException", resolver, ce);
                                //throw ce;
                            }
                        } else {
                            if (location.startsWith("/")) {
                                // This is a relative URI against a contribution
                                location = location.substring(1);
                                // TODO: Need to resolve it against the contribution
                            } else {
                                // This is a relative URI against the WSDL document
                                URI baseURI = URI.create(model.getDefinition().getDocumentBaseURI());
                                URI locationURI = baseURI.resolve(location);
                                WSDLDefinition resolved;
                                try {
                                    resolved = read(null, locationURI, locationURI.toURL(), context);
                                    imp.setDefinition(resolved.getDefinition());
                                    if (!model.getImportedDefinitions().contains(resolved)) {
                                        model.getImportedDefinitions().add(resolved);
                                    }
                                } catch (Exception e) {
                                  ContributionResolveException ce = new ContributionResolveException(e);
View Full Code Here

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

     * @return
     * @throws IOException
     * @throws XMLStreamException
     */
    protected WSDLDefinition indexRead(URL doc) throws Exception {
        WSDLDefinition wsdlDefinition = factory.createWSDLDefinition();
        wsdlDefinition.setUnresolved(true);
        wsdlDefinition.setLocation(doc.toURI());

        Attribute attr1 = new Attribute(WSDL11, "targetNamespace");
        Attribute attr2 = new Attribute(XSD, "targetNamespace");
        Attribute[] attrs = helper.readAttributes(doc, attr1, attr2);

        wsdlDefinition.setNamespace(attr1.getValues().get(0));
        // The definition is marked as resolved but not loaded
        wsdlDefinition.setUnresolved(false);
        wsdlDefinition.setDefinition(null);

        int index = 0;
        for (String tns : attr2.getValues()) {
            XSDefinition xsd = xsdFactory.createXSDefinition();
            xsd.setUnresolved(true);
            xsd.setNamespace(tns);
            xsd.setLocation(URI.create(doc.toURI() + "#" + index));
            index++;
            // The definition is marked as resolved but not loaded
            xsd.setUnresolved(false);
            xsd.setSchema(null);
            wsdlDefinition.getXmlSchemas().add(xsd);
        }
       
        if (attr2.getValues().size() == 0){
            // if there are no schema defined add in the XSD schema
            // so this at least gets resolved otherwise we'll get
            // errors when trying to resolve part types that
            // use primitive types
            XSDefinition xsd = xsdFactory.createXSDefinition();
            xsd.setUnresolved(true);
            xsd.setNamespace("http://www.w3.org/2001/XMLSchema");
            xsd.setUnresolved(false);
            xsd.setSchema(null);
            wsdlDefinition.getXmlSchemas().add(xsd);
        }
       
        return wsdlDefinition;
    }
View Full Code Here

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

        }

    }

    public void addModel(Object resolved, ProcessorContext context) {
        WSDLDefinition definition = (WSDLDefinition)resolved;
        for (XSDefinition d : definition.getXmlSchemas()) {
            if (contribution != null) {
                contribution.getModelResolver().addModel(d, context);
            }
        }
        List<WSDLDefinition> list = map.get(definition.getNamespace());
        if (list == null) {
            list = new ArrayList<WSDLDefinition>();
            map.put(definition.getNamespace(), list);
        }
        list.add(definition);
    }
View Full Code Here

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

        }
        list.add(definition);
    }

    public Object removeModel(Object resolved, ProcessorContext context) {
        WSDLDefinition definition = (WSDLDefinition)resolved;
        List<WSDLDefinition> list = map.get(definition.getNamespace());
        if (list == null) {
            return null;
        } else {
            return list.remove(definition);
        }
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.