搜索

此内容没有您所选择的语言版本。

Chapter 4. Migrating a SOAP application to RESTful web services

download PDF

You can use the WSDL-to-Camel Rest wizard to migrate from an existing JAX-WS SOAP web services implementation to a RESTful web services implementation by using an existing WSDL. The wizard is available as part of Fuse Tooling and it is based on the wsdl2rest utility, available in Github wsdl2rest project.

It supports the following specifications/configurations:

  • Document/literal (doc/lit)
  • Document/literal Wrapped (doc/lit wrap)
  • RPC/literal (rpclit)

4.1. Wizard workflow

The wizard uses a WSDL path which can be a valid URL (in the file:// URL form) or a remote URL (using http or https) and the selected Fuse project. In the wizard, you provide the paths for the generated Java code, the generated Camel configuration file, the target address for the generated camel endpoint, and the bean implementation class.

The wizard generates the destination Java and Camel paths based on the project. The generated Java code is available in src/main/java and the Camel file in an appropriate location for Spring or Blueprint, such as src/main/resources/META-INF/spring.

You can modify the generated classes and configure them to a certain point.

4.2. Prerequisites

Before you begin, you must meet these prerequisites:

  • A pre-existing Fuse Integration Project. You can create a new project using the FileNewFuse Integration Project wizard.
  • A WSDL file accessible through URL. It can be local (file:// url) or remote (http or https).

4.3. Migrating a sample SOAP application to RESTful web services

Follow these steps to run the wizard:

  1. In CodeReady Studio, select your Fuse project in the Project Explorer view.
  2. Right-click on the Fuse project and then select New Camel Rest DSL from WSDL.

    The Select Incoming WSDL and Project for Generated Output page opens. The Destination Project field is automatically pre-populated with the Fuse project selected in the Project Explorer. This project is the destination for the artifacts that the wizard generates.

    wsdl to rest p1
  3. For WSDL File, specify the original SOAP service for processing.
  4. Click Next. The Specify Advanced Options for WSDL-to-REST Processing page appears.

    wsdl to rest p2
    1. For Destination Java Folder, specify the location of the CXF-generated Java classes.
    2. For Destination Camel Folder, specify the location of the generated Camel Rest DSL configuration file.

      Note

      The path and name of the generated Camel file varies based on the type of Camel project:

      • For Spring projects: src/main/resources/META-INF/rest-camel-context.xml
      • For Spring Boot projects: src/main/resources/spring/rest-springboot-context.xml
      • For Blueprint projects: src/main/resources/OSGI-INF/rest-blueprint-context.xml
    3. Optionally, for Target Service Address provide the SOAP address specified in the WSDL binding. You can change this option to match the actual address of the SOAP service referenced by the WSDL.
    4. Optionally, for Target REST Service Address provide the URL for accessing the REST service. This URL is decomposed into settings for the <restConfiguration> and <rest> tags in the Rest DSL to specify the complete URL for REST operations mapped to the SOAP service.
  5. Click Finish to create two files as the output:

    • The Camel configuration with Rest DSL.
    • Java classes from CXF to wrap the SOAP service.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.