Package org.apache.cxf.wsdl

Examples of org.apache.cxf.wsdl.WSDLManager


    }


    private void getSchemas(Definition def, ServiceInfo serviceInfo) {
        ServiceSchemaInfo serviceSchemaInfo = null;
        WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
        if (wsdlManager != null) {
            serviceSchemaInfo = wsdlManager.getSchemasForDefinition(def);
        }

        if (serviceSchemaInfo == null) {
            SchemaUtil schemaUtil = new SchemaUtil(bus, this.schemaList);
            schemaUtil.getSchemas(def, serviceInfo);
            serviceSchemaInfo = new ServiceSchemaInfo();
            serviceSchemaInfo.setSchemaElementList(this.schemaList);
            serviceSchemaInfo.setSchemaCollection(serviceInfo.getXmlSchemaCollection());
            serviceSchemaInfo.setSchemaInfoList(serviceInfo.getSchemas());
            if (wsdlManager != null) {
                wsdlManager.putSchemasForDefinition(def, serviceSchemaInfo);
            }
        } else {
            serviceInfo.setServiceSchemaInfo(serviceSchemaInfo);
            schemaList.putAll(serviceSchemaInfo.getSchemaElementList());
        }
View Full Code Here


    @Test
    public void testConstructionWithExtensions() throws BusException {
       
        IMocksControl control;
        BindingFactoryManager bindingFactoryManager;
        WSDLManager wsdlManager;
        InstrumentationManager instrumentationManager;
        PhaseManager phaseManager;
       
        control = EasyMock.createNiceControl();
       
View Full Code Here


    private void createSoapBinding(final SoapBindingInfo bi) throws WSDLException {
        boolean isSoap12 = bi.getSoapVersion() instanceof Soap12;
        Bus bs = getBus();
        WSDLManager m = bs.getExtension(WSDLManager.class);
        ExtensionRegistry extensionRegistry = m.getExtensionRegistry();

        SoapBinding soapBinding = SOAPBindingUtil.createSoapBinding(extensionRegistry, isSoap12);
        soapBinding.setStyle(bi.getStyle());
        soapBinding.setTransportURI(bi.getTransportURI());
        bi.addExtensor(soapBinding);
View Full Code Here

    @BeforeClass
    public static void oneTimeSetUp() throws Exception {
       
        IMocksControl control = EasyMock.createNiceControl();
        Bus bus = control.createMock(Bus.class);
        WSDLManager manager = new WSDLManagerImpl();      
        WSDLServiceBuilder builder = new WSDLServiceBuilder(bus);
        DestinationFactoryManager dfm = control.createMock(DestinationFactoryManager.class);
        EasyMock.expect(bus.getExtension(DestinationFactoryManager.class)).andReturn(dfm).anyTimes();
        EasyMock.expect(dfm.getDestinationFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
        BindingFactoryManager bfm = control.createMock(BindingFactoryManager.class);
        EasyMock.expect(bus.getExtension(BindingFactoryManager.class)).andReturn(bfm).anyTimes();
        EasyMock.expect(bfm.getBindingFactory(EasyMock.isA(String.class))).andReturn(null).anyTimes();
        control.replay();
       
        int n = 19;
        services = new ServiceInfo[n];
        endpoints = new EndpointInfo[n];
        for (int i = 0; i < n; i++) {
            String resourceName = "/attachment/wsdl11/test" + i + ".wsdl";
            URL url = Wsdl11AttachmentPolicyProviderTest.class.getResource(resourceName);      
            try {
                services[i] = builder.buildServices(manager.getDefinition(url)).get(0);
            } catch (WSDLException ex) {
                ex.printStackTrace();
                fail("Failed to build service from resource " + resourceName);
            }
            assertNotNull(services[i]);
View Full Code Here

            bus = BusFactory.getThreadDefaultBus();
            env.put(Bus.class, bus);
        }
        WSDLDefinitionBuilder builder = new WSDLDefinitionBuilder(bus);
        wsdlDefinition = builder.build(wsdlURL);
        WSDLManager mgr = bus.getExtension(WSDLManager.class);
        mgr.removeDefinition(wsdlDefinition);
       
        wsdlFactory = mgr.getWSDLFactory();
        extReg = mgr.getExtensionRegistry();
        wsdlPlugins = builder.getWSDLPlugins();
    }
View Full Code Here


    private void createSoapBinding(final SoapBindingInfo bi) throws WSDLException {
        boolean isSoap12 = bi.getSoapVersion() instanceof Soap12;
        Bus bs = getBus();
        WSDLManager m = bs.getExtension(WSDLManager.class);
        ExtensionRegistry extensionRegistry = m.getExtensionRegistry();

        SoapBinding soapBinding = SOAPBindingUtil.createSoapBinding(extensionRegistry, isSoap12);
        soapBinding.setStyle(bi.getStyle());
        soapBinding.setTransportURI(bi.getTransportURI());
        bi.addExtensor(soapBinding);
View Full Code Here

    public WSDLRefValidator(final String wsdl, final Document doc, final Bus b) {
        WSDLDefinitionBuilder wsdlBuilder = new WSDLDefinitionBuilder(b);

        try {
            this.definition = wsdlBuilder.build(wsdl);
            WSDLManager mgr = b.getExtension(WSDLManager.class);
            mgr.removeDefinition(this.definition);

            if (wsdlBuilder.getImportedDefinitions().size() > 0) {
                importedDefinitions = new ArrayList<Definition>();
                importedDefinitions.addAll(wsdlBuilder.getImportedDefinitions());
            }
View Full Code Here

                                                           String wsdlDocumentLocation,
                                                           List<Element> referenceParameters) {
        QName portType = null;
        if (serviceName != null && portName != null && wsdlDocumentLocation != null) {
            Bus bus = BusFactory.getThreadDefaultBus();
            WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);         
            try {
                Definition def = wsdlManager.getDefinition(wsdlDocumentLocation);
                portType = def.getService(serviceName).getPort(portName.getLocalPart()).getBinding()
                    .getPortType().getQName();
            } catch (Exception e) {
                // do nothing
            }
View Full Code Here

    public List<ServiceInfo> buildMockServices(Definition d) {
        List<ServiceInfo> serviceList = new ArrayList<ServiceInfo>();
        List<Definition> defList = new ArrayList<Definition>();
        defList.add(d);
        parseImports(d, defList);
        WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
        for (Definition def : defList) {

            for (Iterator ite = def.getPortTypes().entrySet().iterator(); ite.hasNext();) {
                Entry entry = (Entry)ite.next();
                PortType portType = def.getPortType((QName)entry.getKey());
                ServiceInfo serviceInfo = this.buildMockService(def, portType);
                serviceList.add(serviceInfo);
            }

            if (def.getPortTypes().size() == 0) {

                DescriptionInfo description = new DescriptionInfo();
                description.setProperty(WSDL_DEFINITION, def);
                description.setName(def.getQName());
                description.setBaseURI(def.getDocumentBaseURI());
                copyExtensors(description, def.getExtensibilityElements());
                copyExtensionAttributes(description, def);

                ServiceInfo service = new ServiceInfo();
                service.setDescription(description);
                service.setProperty(WSDL_DEFINITION, def);
                getSchemas(def, service);
                if (wsdlManager != null) {
                    ServiceSchemaInfo serviceSchemaInfo = new ServiceSchemaInfo();
                    serviceSchemaInfo.setSchemaCollection(service.getXmlSchemaCollection());
                    serviceSchemaInfo.setSchemaInfoList(service.getSchemas());
                    wsdlManager.putSchemasForDefinition(def, serviceSchemaInfo);
                }

                service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);
                serviceList.add(service);
            }
View Full Code Here

        service.setProperty(WSDL_SCHEMA_ELEMENT_LIST, this.schemaList);

        buildInterface(service, p);

        WSDLManager wsdlManager = bus.getExtension(WSDLManager.class);
        if (wsdlManager != null) {
            ServiceSchemaInfo serviceSchemaInfo = new ServiceSchemaInfo();
            serviceSchemaInfo.setSchemaCollection(service.getXmlSchemaCollection());
            serviceSchemaInfo.setSchemaInfoList(service.getSchemas());
            wsdlManager.putSchemasForDefinition(def, serviceSchemaInfo);
        }

        return service;
    }
View Full Code Here

TOP

Related Classes of org.apache.cxf.wsdl.WSDLManager

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.