简体   繁体   English

构建 SOAP XML Web 将数据存储到数据库并将响应结果存储到客户端的服务

[英]Build SOAP XML Web Service that stores data to DB and response result to client

I have been assigned to build SOAP XML web service which does the following:我已被分配构建 SOAP XML web 服务,该服务执行以下操作:

  1. Listens for a SOAP request from client application that will send the values for 2 parameter(login name, product_id)侦听来自客户端应用程序的 SOAP 请求,该请求将发送 2 个参数(登录名、产品 ID)的值
  2. Stores the SOAP request/outbound response transaction to a SQL database table将 SOAP 请求/出站响应事务存储到 SQL 数据库表
  3. Doing checking if login already exist or not in database.正在检查数据库中是否已经存在登录名。 if yes, send response to client.如果是,则向客户端发送响应。 If not, the values store in database and also response back to client如果不是,则将值存储在数据库中并返回给客户端

I am planning to do this JAVA.我打算这样做 JAVA。 Can anybody point me in the right direction for how this should be done?谁能指出我应该如何做到这一点的正确方向? Thank you in advance for any feedback.提前感谢您的任何反馈。

To build a SOAP XML web service you need web service provider and web service client. To build a SOAP XML web service you need web service provider and web service client. To do so there are two approaches:为此,有两种方法:

  1. Top Down自顶向下

Top down is the proper way of defining rules for the web service for both client and provider.自上而下是为客户端和提供者定义 web 服务规则的正确方法。 Top down means you have to create a WSDL file first in order to generate stubs out of it to create provider as well as client.自上而下意味着您必须首先创建一个 WSDL 文件,以便从中生成存根以创建提供程序和客户端。

  1. Bottom UP自下而上

Bottom is used for legacy application, to expose already existing application as a web service底部用于遗留应用程序,将现有应用程序公开为 web 服务

Wsdl to java is a plugin used to generate stubs(classes) out of wsdl file. Wsdl 到 java 是一个插件,用于从 wsdl 文件中生成存根(类)。 After creating wsdl and stubs out of it...you need to mark the pojo's with JAX-B Annotations and service methods(Your web service business logic methods) with JAX-WS Annotations.在创建 wsdl 并从中存根之后......您需要使用 JAX-WS 注释和服务方法(您的 web 服务业务逻辑方法)标记 pojo 和 JAX-WS 注释。 For this you could use Apache CXF JAX-WS Maven Dependency or others.为此,您可以使用 Apache CXF JAX-WS Maven 依赖或其他。 After that you need to publish an Endpoint for the web service you created using bus and Endpoint class from JAX-WS.之后,您需要为使用总线和来自 JAX-WS 的端点 class 创建的 web 服务发布端点。

After Exposing out the service, you can use the same wsdl to generate Client or Without creating a client you could test your web service using SOAP UI tool.暴露服务后,您可以使用相同的 wsdl 生成客户端,或者在不创建客户端的情况下,您可以使用 SOAP UI 工具测试您的 web 服务。

Follow this Link for more!关注此 链接了解更多!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM