简体   繁体   中英

How Spring Integration interacts with Web Service (Jersey)?

I want to know

How Spring Integration interacts with Web Service (Jersey):

I want to create a small project from scratch

Maven, Spring Integration, Java EE, Jersey, MySQL.

I think that:

The first step will be:

Adding Spring Integration to the Project.

Create input-channels and output-channel, create beans.

The output-channel will forward the request http://localhost:8080/{Project}/{package}/team/Manchester

to the Web Service (Jersey).

I think it can be something like:

@Path(“/team”)
public class TeamService{

    @GET
    @Path(“/{param}”)
    public Response getMsg(@PathParam(“param”) String msg){

        return Response.status(200).entity(msg).build();
    }
}

The POJO class Team :

public class Team(){

  private long id;
  private String name;

  // getters and setters

}

In the DB I will have 1 table team

  __id_|___name____
    1  | Manchester
    2  | Barcelona

The second step will be: Create methods getTeam() and getTeamName() for receive it's values from DB.

The Spring xml should be like?

<int-ws:outbound-gateway
     id="Team"
     request-channel="inputChannel"
     uri="http://localhost:8080/{Project}/{package}/team/"/>

I have read the tutorial of Spring Integration, but I do not quite understand how it interacts with Web Services.

How to pass the data to the Spring Integration? How the Spring Integration passes the data to the Jersey?

Where can I find an example of a project with a similar tasks? Or someone knows how to implement it?

It's not clear what your inputChannel is.. the mySql DB ? in that case you would need a JDBC inbound adapter that would query it ; the result of the query will be put in a Spring Message. That message will flow through your config until it reaches the outbound-gateway. Here againm depending on your config, messge will be read and a SOAP requets will be performed accordingly for this message.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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