Java Code Examples for javax.wsdl.WSDLException

The following examples show how to use javax.wsdl.WSDLException. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: development   Source File: BesDAO.java    License: Apache License 2.0 7 votes vote down vote up
void validateVersion(String wsdlUrl) {
    WSDLLocator locator = new BasicAuthWSDLLocator(wsdlUrl, null, null);
    WSDLFactory wsdlFactory;
    Definition serviceDefinition;
    try {
        wsdlFactory = WSDLFactory.newInstance();
        WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
        // avoid importing external documents
        wsdlReader.setExtensionRegistry(new WSVersionExtensionRegistry());
        serviceDefinition = wsdlReader.readWSDL(locator);
        Element versionElement = serviceDefinition
                .getDocumentationElement();
        if (!CTMGApiVersion.version.equals(versionElement.getTextContent())) {
            LOGGER.warn("Web service mismatches and the version value, expected: "
                    + CTMGApiVersion.version
                    + " and the one got from wsdl: "
                    + versionElement.getTextContent());
        }
    } catch (WSDLException e) {
        LOGGER.warn("Remote wsdl cannot be retrieved from CT_MG. [Cause: "
                + e.getMessage() + "]", e);
    }

}
 
Example 2
Source Project: j-road   Source File: XTeeSoapProvider.java    License: Apache License 2.0 6 votes vote down vote up
private List<SOAPHeader> makeHeaders(Definition definition) throws WSDLException {
  List<SOAPHeader> list = new ArrayList<SOAPHeader>();
  String[] parts = new String[] { XTeeHeader.CLIENT.getLocalPart(), XTeeHeader.SERVICE.getLocalPart(),
                                  XTeeHeader.USER_ID.getLocalPart(), XTeeHeader.ID.getLocalPart(),
                                  XTeeHeader.PROTOCOL_VERSION.getLocalPart() };
  ExtensionRegistry extReg = definition.getExtensionRegistry();
  for (int i = 0; i < parts.length; i++) {
    SOAPHeader header =
        (SOAPHeader) extReg.createExtension(BindingInput.class, new QName(SOAP_11_NAMESPACE_URI, "header"));
    header.setMessage(new QName(definition.getTargetNamespace(), XTeeWsdlDefinition.XROAD_HEADER));
    header.setPart(parts[i]);
    if (use.equalsIgnoreCase(LITERAL)) {
      header.setUse(LITERAL);
    } else {
      header.setUse(ENCODED);
      header.setEncodingStyles(Arrays.asList(ENCODING));
    }
    list.add(header);
  }

  return list;
}
 
Example 3
Source Project: cxf   Source File: WSDLCorbaWriterImpl.java    License: Apache License 2.0 6 votes vote down vote up
public Document getDocument(Definition wsdlDef) throws WSDLException {
    try {
        fixTypes(wsdlDef);
    } catch (Exception ex) {
        throw new WSDLException(WSDLException.PARSER_ERROR, ex.getMessage(), ex);
    }
    Document doc = wrapped.getDocument(wsdlDef);
    Element imp = null;
    Element child = DOMUtils.getFirstElement(doc.getDocumentElement());
    //move extensability things to the top
    while (child != null) {
        if (child.getNamespaceURI().equals(doc.getDocumentElement().getNamespaceURI())) {
            //wsdl node
            if (imp == null) {
                imp = child;
            }
        } else if (imp != null) {
            doc.getDocumentElement().removeChild(child);
            doc.getDocumentElement().insertBefore(child, imp);
        }
        child = DOMUtils.getNextElement(child);
    }

    return doc;
}
 
Example 4
Source Project: cxf   Source File: WSDLToSoapProcessor.java    License: Apache License 2.0 6 votes vote down vote up
private void setSoapOperationExtElement(BindingOperation bo) throws ToolException {
    if (extReg == null) {
        extReg = wsdlFactory.newPopulatedExtensionRegistry();
    }
    SoapOperation soapOperation = null;

    try {
        soapOperation = SOAPBindingUtil.createSoapOperation(extReg, isSOAP12());
    } catch (WSDLException wse) {
        Message msg = new Message("FAIL_TO_CREATE_SOAPBINDING", LOG);
        throw new ToolException(msg, wse);
    }
    soapOperation.setStyle((String)env.get(ToolConstants.CFG_STYLE));
    soapOperation.setSoapActionURI("");
    bo.addExtensibilityElement(soapOperation);
}
 
Example 5
Source Project: development   Source File: ApplicationServiceBean.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates the operation service adapter that delegates to the real the
 * port. If a provisioning user is specified, basic authentication will be
 * used.
 * 
 * @param op
 *            the {@link TechnicalProductOperation} to get the action url
 *            from
 * @return the {@link OperationService}
 * @throws IOException
 * @throws ParserConfigurationException
 * @throws WSDLException
 */
protected OperationService getServiceClient(TechnicalProductOperation op)
        throws IOException, WSDLException, ParserConfigurationException {

    TechnicalProduct techProduct = op.getTechnicalProduct();
    String username = techProduct.getProvisioningUsername();
    String password = techProduct.getProvisioningPassword();

    // Get the timeout value for the outgoing WS call from the configuration
    // settings
    Integer wsTimeout = Integer
            .valueOf(cs.getConfigurationSetting(ConfigurationKey.WS_TIMEOUT,
                    Configuration.GLOBAL_CONTEXT).getValue());

    return OperationServiceAdapterFactory.getOperationServiceAdapter(op,
            wsTimeout, username, password);
}
 
Example 6
Source Project: development   Source File: WSPortConnector.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Creates an instance of port connector.
 * 
 * @param remoteWsdlUrl
 *            The URL at which the WSDL can be accessed.
 * @param userName
 *            The userName to be used for authentication. <code>null</code>
 *            if no authentication is required.
 * @param password
 *            The password for the user. <code>null</code> if not required.
 * @param host
 *            optional - if specified, this host will be used instead the
 *            one from the wsdl
 * 
 * @throws IOException
 * @throws WSDLException
 */
public WSPortConnector(String remoteWsdlUrl, String userName,
        String password, String host) throws IOException, WSDLException {
    this.userName = userName;
    this.password = password;
    URL url = new URL(remoteWsdlUrl);
    if (requiresUserAuthentication(userName, password)) {
        url = BasicAuthLoader.load(url, userName, password);
    }

    WSDLLocator locator = new BasicAuthWSDLLocator(remoteWsdlUrl, userName,
            password);

    try {
        details = getServiceDetails(locator, host);
    } finally {
        locator.close();
    }
}
 
Example 7
Source Project: cxf   Source File: SchemaFactory.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Get a new instance of a WSDLFactory. This method
 * returns an instance of the class factoryImplName.
 * Once an instance of a WSDLFactory is obtained, invoke
 * newDefinition(), newWSDLReader(), or newWSDLWriter(), to create
 * the desired instances.
 *
 * @param factoryImplName the fully-qualified class name of the
 * class which provides a concrete implementation of the abstract
 * class WSDLFactory.
 */
public static SchemaFactory newInstance(String factoryImplName) throws WSDLException {
    if (factoryImplName != null) {
        try {
            // get the appropriate class for the loading.
            ClassLoader loader = Thread.currentThread().getContextClassLoader();
            Class<?> cl = loader.loadClass(factoryImplName);

            return (SchemaFactory)cl.newInstance();
        } catch (Exception e) {
            /*
             Catches:
             ClassNotFoundException
             InstantiationException
             IllegalAccessException
             */
            throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Problem instantiating factory "
                                                                       + "implementation.", e);
        }
    }
    throw new WSDLException(WSDLException.CONFIGURATION_ERROR, "Unable to find name of factory "
                                                               + "implementation.");
}
 
Example 8
Source Project: iaf   Source File: WsdlXmlValidator.java    License: Apache License 2.0 6 votes vote down vote up
@IbisDoc({"the wsdl to read the xsd's from", " "})
public void setWsdl(String wsdl) throws ConfigurationException {
	this.wsdl = wsdl;
	WSDLReader reader  = FACTORY.newWSDLReader();
	reader.setFeature("javax.wsdl.verbose", false);
	reader.setFeature("javax.wsdl.importDocuments", true);
	ClassLoaderWSDLLocator wsdlLocator = new ClassLoaderWSDLLocator(getConfigurationClassLoader(), wsdl);
	URL url = wsdlLocator.getUrl();
	if (wsdlLocator.getUrl() == null) {
		throw new ConfigurationException("Could not find WSDL: " + wsdl);
	}
	try {
		definition = reader.readWSDL(wsdlLocator);
	} catch (WSDLException e) {
		throw new ConfigurationException("WSDLException reading WSDL or import from url: " + url, e);
	}
	if (wsdlLocator.getIOException() != null) {
		throw new ConfigurationException("IOException reading WSDL or import from url: " + url,
				wsdlLocator.getIOException());
	}
}
 
Example 9
Source Project: development   Source File: TriggerProcessListener.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Sends a notification on the modification of a subscription to the
 * receiver specified in the trigger definition.
 * 
 * @param process
 *            The current process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleModifySubscription(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOSubscription subscription = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            VOSubscription.class);
    List<VOParameter> modifiedParameters = ParameterizedTypes
            .list(getParamValue(
                    process.getParamValueForName(TriggerProcessParameterName.PARAMETERS),
                    List.class), VOParameter.class);
    serviceClient.onModifySubscription(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(subscription), VOCollectionConverter
                    .convertList(modifiedParameters,
                            org.oscm.vo.VOParameter.class));

    updateProcessState(process);
}
 
Example 10
Source Project: j-road   Source File: XTeeSoapProvider.java    License: Apache License 2.0 6 votes vote down vote up
@Override
protected void populatePort(Definition definition, Port port) throws WSDLException {
  super.populatePort(definition, port);
  ExtensionRegistry extensionRegistry = definition.getExtensionRegistry();
  extensionRegistry.mapExtensionTypes(Port.class,
                                      new QName(XTeeWsdlDefinition.XROAD_NAMESPACE,
                                                "address",
                                                XTeeWsdlDefinition.XROAD_PREFIX),
                                      UnknownExtensibilityElement.class);
  UnknownExtensibilityElement element =
      (UnknownExtensibilityElement) extensionRegistry.createExtension(Port.class,
                                                                      new QName(XTeeWsdlDefinition.XROAD_NAMESPACE,
                                                                                "address",
                                                                                XTeeWsdlDefinition.XROAD_NAMESPACE));
  Document doc;
  try {
    doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
  } catch (ParserConfigurationException e) {
    throw new RuntimeException(e);
  }
  Element xRoadAddr = doc.createElementNS(XTeeWsdlDefinition.XROAD_NAMESPACE, "address");
  xRoadAddr.setPrefix(XTeeWsdlDefinition.XROAD_PREFIX);
  xRoadAddr.setAttribute("producer", xRoadDatabase);
  element.setElement(xRoadAddr);
  port.addExtensibilityElement(element);
}
 
Example 11
Source Project: development   Source File: TriggerProcessListener.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Sends a notification on the deactivation of a product to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current trigger process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleDeactivateProduct(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOService product = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.PRODUCT),
            VOService.class);
    serviceClient.onDeactivateProduct(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(product));

    updateProcessState(process);
}
 
Example 12
Source Project: development   Source File: TriggerProcessListener.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Sends a notification on the activation of a product to the receiver
 * specified in the trigger definition.
 * 
 * @param process
 *            The current trigger process to be handled.
 * @param facade
 *            Localizer facade to determine translated reason.
 * @throws ParserConfigurationException
 * @throws WSDLException
 * @throws IOException
 */
private void handleActivateProduct(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    VOService product = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.PRODUCT),
            VOService.class);
    serviceClient.onActivateProduct(VOConverter.convertToApi(vo),
            VOConverter.convertToApi(product));

    updateProcessState(process);
}
 
Example 13
Source Project: development   Source File: TriggerProcessListener.java    License: Apache License 2.0 6 votes vote down vote up
private void handleSubscriptionTermination(TriggerProcess process,
        LocalizerFacade facade) throws IOException, WSDLException,
        ParserConfigurationException {
    INotificationServiceAdapter serviceClient = getServiceClient(process
            .getTriggerDefinition());
    VOTriggerProcess vo = TriggerProcessAssembler.toVOTriggerProcess(
            process, facade);
    String subscriptionId = getParamValue(
            process.getParamValueForName(TriggerProcessParameterName.SUBSCRIPTION),
            String.class);
    Invariants.assertNotNull(subscriptionId,
            "mandatory parameter 'subscriptionId' not set");

    VONotificationBuilder builder = new VONotificationBuilder();
    builder.addParameter(VOProperty.SUBSCRIPTION_SUBSCRIPTION_ID,
            subscriptionId);
    VONotification notification = builder.build();

    serviceClient.onSubscriptionTermination(VOConverter.convertToApi(vo),
            notification);
    updateProcessState(process);
}
 
Example 14
Source Project: cxf   Source File: WSDLGetUtils.java    License: Apache License 2.0 6 votes vote down vote up
/**
 * Create a wsdl Definition object from the endpoint information and register
 * it in the local data structure for future reference.
 *
 * @param bus CXF's hub for access to internal constructs
 * @param mp  a map of known wsdl Definition objects
 * @param message
 * @param smp a map of known xsd SchemaReference objects
 * @param base the request URL
 * @param endpointInfo information for a web service 'port' inside of a service
 * @throws WSDLException
 */
protected void updateWSDLKeyDefinition(Bus bus,
                                       Map<String, Definition> mp,
                                       Message message,
                                       Map<String, SchemaReference> smp,
                                       String base,
                                       EndpointInfo endpointInfo) throws WSDLException {
    if (!mp.containsKey("")) {
        ServiceWSDLBuilder builder =
            new ServiceWSDLBuilder(bus, endpointInfo.getService());

        builder.setUseSchemaImports(
            MessageUtils.getContextualBoolean(message, WSDL_CREATE_IMPORTS, false));

        // base file name is ignored if createSchemaImports == false!
        builder.setBaseFileName(endpointInfo.getService().getName().getLocalPart());

        Definition def = builder.build(new HashMap<String, SchemaInfo>());

        mp.put("", def);
        updateDefinition(bus, def, mp, smp, base, "", "");
    }

}
 
Example 15
Source Project: jolie   Source File: WSDLDocCreator.java    License: GNU Lesser General Public License v2.1 6 votes vote down vote up
public Definition initWsdl( String serviceName, String filename ) {
	try {
		wsdlFactory = WSDLFactory.newInstance();
		localDef = wsdlFactory.newDefinition();
		extensionRegistry = wsdlFactory.newPopulatedExtensionRegistry();
		if( serviceName != null ) {
			QName servDefQN = new QName( serviceName );
			localDef.setQName( servDefQN );
		}
		localDef.addNamespace( NameSpacesEnum.WSDL.getNameSpacePrefix(), NameSpacesEnum.WSDL.getNameSpaceURI() );
		localDef.addNamespace( NameSpacesEnum.SOAP.getNameSpacePrefix(), NameSpacesEnum.SOAP.getNameSpaceURI() );
		localDef.addNamespace( "tns", tns );
		localDef.addNamespace( NameSpacesEnum.XML_SCH.getNameSpacePrefix(),
			NameSpacesEnum.XML_SCH.getNameSpaceURI() );
		localDef.setTargetNamespace( tns );
		localDef.addNamespace( "xsd1", tnsSchema );
	} catch( WSDLException ex ) {
		Logger.getLogger( WSDLDocCreator.class.getName() ).log( Level.SEVERE, null, ex );
	}

	return localDef;
}
 
Example 16
Source Project: cxf   Source File: SoapTransportFactory.java    License: Apache License 2.0 6 votes vote down vote up
private void createSoapExtensors(Bus bus, EndpointInfo ei, SoapBindingInfo bi, boolean isSoap12) {
    try {

        String address = ei.getAddress();
        if (address == null) {
            address = "http://localhost:9090";
        }

        ExtensionRegistry registry = bus.getExtension(WSDLManager.class).getExtensionRegistry();
        SoapAddress soapAddress = SOAPBindingUtil.createSoapAddress(registry, isSoap12);
        soapAddress.setLocationURI(address);

        ei.addExtensor(soapAddress);

    } catch (WSDLException e) {
        e.printStackTrace();
    }
}
 
Example 17
Source Project: cxf   Source File: AttributeVisitor.java    License: Apache License 2.0 6 votes vote down vote up
/** Generates a corba:operation in the corba:binding container within a wsdl:binding.
 *
 * Only one (or none) corba parameter and only one (or none) corba return parameter are supported.
 *
 * @param op is the wsdl operation to bind.
 * @param param is the corba parameter, none if null.
 * @param arg is the corba return parameter, none if null.
 * @return the generated corba:operation.
 */
private OperationType generateCorbaOperation(Operation op, ParamType param, ArgType arg) {
    OperationType operation = null;
    try {
        operation = (OperationType)extReg.createExtension(BindingOperation.class,
                                                          CorbaConstants.NE_CORBA_OPERATION);
    } catch (WSDLException ex) {
        throw new RuntimeException(ex);
    }
    operation.setName(op.getName());

    if (param != null) {
        operation.getParam().add(param);
    }

    if (arg != null) {
        operation.setReturn(arg);
    }

    return operation;
}
 
Example 18
Source Project: tesb-studio-se   Source File: CompressAndEncodeTool.java    License: Apache License 2.0 6 votes vote down vote up
/**
    * Gets WSDL as ZLIB-compressed and Base64-encoded String.
    * Use ZipStream -> InflaterStream -> Base64Stream to read.
    * @return WSDL as String object. Or null in case errors/not possible to create object.
    * @throws WSDLException 
    * @throws IOException 
    */
public static String compressAndEncode(Definition definition) throws IOException, WSDLException {
   	ByteArrayOutputStream wsdlOs = new ByteArrayOutputStream();
       OutputStream os = compressAndEncodeStream(wsdlOs);
       ZipOutputStream zipOs = new ZipOutputStream(os);
       try {
       	ZipEntry zipEntry = new ZipEntry("main.wsdl");
		zipOs.putNextEntry(zipEntry);
           WSDLFactory.newInstance().newWSDLWriter().writeWSDL(definition, zipOs);
           appendImportDifinitions(definition, zipOs);
	} finally {
           if (null != zipOs) {
               zipOs.close();
           }
       }
       return wsdlOs.toString();
   }
 
Example 19
Source Project: cxf   Source File: OperationVisitor.java    License: Apache License 2.0 6 votes vote down vote up
private BindingOperation generateBindingOperation(Binding wsdlBinding, Operation op,
                                                  String corbaOpName) {
    BindingOperation bindingOperation = definition.createBindingOperation();
    //OperationType operationType = null;
    try {
        corbaOperation = (OperationType)extReg.createExtension(BindingOperation.class,
                                                               CorbaConstants.NE_CORBA_OPERATION);
    } catch (WSDLException ex) {
        throw new RuntimeException(ex);
    }
    corbaOperation.setName(corbaOpName);
    bindingOperation.addExtensibilityElement((ExtensibilityElement)corbaOperation);
    bindingOperation.setOperation(op);
    bindingOperation.setName(op.getName());
    binding.addBindingOperation(bindingOperation);
    return bindingOperation;
}
 
Example 20
Source Project: juddi   Source File: API_051_BindingTemplateWSDLTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test 
public void testClerkCall() throws ConfigurationException, WSDLException, RemoteException, TransportException, MalformedURLException {
	try {
		tckTModel.saveJoePublisherTmodel(authInfoJoe);
		tckBusiness.saveJoePublisherBusiness(authInfoJoe);
		
		UDDIClerk clerk = new UDDIClient("META-INF/uddi.xml").getClerk("joe");
		clerk.registerWsdls();
		
		
		String portTypeName = "StockQuotePortType";
		String namespace    = "http://example.com/stockquote/";
		FindTModel findTModelForPortType = WSDL2UDDI.createFindPortTypeTModelForPortType(portTypeName, namespace);
		System.out.println(new PrintUDDI<FindTModel>().print(findTModelForPortType));
		
		clerk.unRegisterWsdls();
	} catch (Exception e) {
		e.printStackTrace();
		Assert.fail();
	} finally {
		tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
		tckTModel.deleteJoePublisherTmodel(authInfoJoe);
	}
}
 
Example 21
Source Project: juddi   Source File: BPEL2UDDITest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testHelloWorld_UDDIBindingModel() throws WSDLException, JAXBException, Exception {

	// Reading the WSDL
	Definition wsdlDefinition = rw.readWSDL("bpel/HelloWorld.wsdl");
    @SuppressWarnings("unchecked")
	Map<QName,Binding> bindings = (Map<QName,Binding>) wsdlDefinition.getAllBindings();
    Set<TModel> bindingTModels = bpel2UDDI.createWSDLBindingTModels(wsdlDefinition.getDocumentBaseURI(), bindings);
    
	for (TModel tModel : bindingTModels) {
		System.out.println("***** UDDI Binding TModel: " + tModel.getName().getValue());
                       if (serialize)
		System.out.println(pTModel.print(tModel));
	}
	Assert.assertEquals(1,bindingTModels.size());
}
 
Example 22
Source Project: container   Source File: ODEEndpointUpdater.java    License: Apache License 2.0 6 votes vote down vote up
private Map<QName, List<File>> updateProvidedWSDLAddresses(final Map<QName, List<File>> changeMap) throws WSDLException {
    final Map<QName, List<File>> notChanged = new HashMap<>();
    for (final QName portType : changeMap.keySet()) {
        final List<File> notUpdateWSDLs = new ArrayList<>();

        for (final File wsdlFile : changeMap.get(portType)) {
            if (!this.updateProvidedWSDLAddresses(portType, wsdlFile)) {
                notUpdateWSDLs.add(wsdlFile);
            }
        }
        if (!notUpdateWSDLs.isEmpty()) {
            notChanged.put(portType, notUpdateWSDLs);
        }
    }
    return notChanged;
}
 
Example 23
Source Project: cxf   Source File: ReflectionServiceFactorBeanTest.java    License: Apache License 2.0 6 votes vote down vote up
@Test
public void testEmptyWsdlAndNoServiceClass() throws Exception {
    final String dummyWsdl = "target/dummy.wsdl";
    ReflectionServiceFactoryBean bean = new ReflectionServiceFactoryBean();
    Bus bus = control.createMock(Bus.class);

    WSDLManager wsdlmanager = control.createMock(WSDLManager.class);
    EasyMock.expect(bus.getExtension(WSDLManager.class)).andReturn(wsdlmanager);
    EasyMock.expect(wsdlmanager.getDefinition(dummyWsdl))
        .andThrow(new WSDLException("PARSER_ERROR", "Problem parsing '" + dummyWsdl + "'."));
    EasyMock.expect(bus.getExtension(FactoryBeanListenerManager.class)).andReturn(null);

    control.replay();

    bean.setWsdlURL(dummyWsdl);
    bean.setServiceName(new QName("http://cxf.apache.org/hello_world_soap_http", "GreeterService"));
    bean.setBus(bus);

    try {
        bean.create();
        fail("no valid wsdl nor service class specified");
    } catch (ServiceConstructionException e) {
        // ignore
    }
}
 
Example 24
Source Project: apicurio-registry   Source File: WSDLReaderAccessor.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected WSDLReader initialValue() {
    WSDLReader wsdlReader = null;
    try {
        WSDLFactory wsdlFactory = WSDLFactory.newInstance();
        wsdlReader = wsdlFactory.newWSDLReader();
    } catch (WSDLException e) {
        throw new RuntimeException(e);
    }
    return wsdlReader;
}
 
Example 25
Source Project: activiti6-boot2   Source File: WSDLImporter.java    License: Apache License 2.0 5 votes vote down vote up
public void importFrom(String url) {
  this.wsServices.clear();
  this.wsOperations.clear();
  this.structures.clear();

  this.wsdlLocation = url;

  try {
    Definition definition = this.parseWSDLDefinition();
    this.importServicesAndOperations(definition);
    this.importTypes(definition.getTypes());
  } catch (WSDLException e) {
    throw new ActivitiException(e.getMessage(), e);
  }
}
 
Example 26
Source Project: activiti6-boot2   Source File: WSDLImporter.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Parse the WSDL definition using WSDL4J.
 */
protected Definition parseWSDLDefinition() throws WSDLException {
  WSDLFactory wsdlFactory = WSDLFactory.newInstance();
  WSDLReader reader = wsdlFactory.newWSDLReader();
  reader.setFeature("javax.wsdl.verbose", false);
  reader.setFeature("javax.wsdl.importDocuments", true);
  Definition definition = reader.readWSDL(this.wsdlLocation);
  return definition;
}
 
Example 27
Source Project: iaf   Source File: WsdlXmlValidatorTest.java    License: Apache License 2.0 5 votes vote down vote up
@Test
public void wsdlValidateWithInclude() throws IOException, PipeRunException, SAXException, WSDLException, ConfigurationException, XmlValidatorException {
    WsdlXmlValidator val = new WsdlXmlValidator();
    val.setWsdl(SIMPLE_WITH_INCLUDE);
    val.setSoapBody("TradePriceRequest");
    val.setThrowException(true);
    val.registerForward(new PipeForward("success", null));
    val.configure();
    val.validate("<Envelope xmlns=\"http://schemas.xmlsoap.org/soap/envelope/\"><Body><TradePriceRequest xmlns=\"http://example.com/stockquote.xsd\"><tickerSymbol>foo</tickerSymbol></TradePriceRequest></Body></Envelope>", session);
}
 
Example 28
Source Project: j-road   Source File: XTeeSoapProvider.java    License: Apache License 2.0 5 votes vote down vote up
@Override
protected void populateSoapBody(SOAPBody soapBody) throws WSDLException {
  if (use.equalsIgnoreCase(LITERAL)) {
    soapBody.setUse(LITERAL);
  } else {
    soapBody.setUse(ENCODED);
    List<String> encStyles = new ArrayList<String>(1);
    encStyles.add(ENCODING);
    soapBody.setEncodingStyles(encStyles);
  }
}
 
Example 29
Source Project: pentaho-kettle   Source File: Wsdl.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Get a WSDLReader.
 *
 * @return WSDLReader.
 * @throws WSDLException
 *           on error.
 */
private WSDLReader getReader() throws WSDLException {

  WSDLFactory wsdlFactory = WSDLFactory.newInstance();
  WSDLReader wsdlReader = wsdlFactory.newWSDLReader();
  ExtensionRegistry registry = wsdlFactory.newPopulatedExtensionRegistry();
  wsdlReader.setExtensionRegistry( registry );
  wsdlReader.setFeature( "javax.wsdl.verbose", true );
  wsdlReader.setFeature( "javax.wsdl.importDocuments", true );
  return wsdlReader;
}
 
Example 30
Source Project: cxf   Source File: TestWSDLCorbaWriterImpl.java    License: Apache License 2.0 5 votes vote down vote up
protected void printBindingFaults(@SuppressWarnings("rawtypes") Map bindingFaults,
                                  Definition def,
                                  java.io.PrintWriter pw)
    throws WSDLException {
    Map<Object, Object> bfaults = new TreeMap<>(comparator);
    bfaults.putAll(CastUtils.cast(bindingFaults));
    super.printBindingFaults(bfaults, def, pw);
}