learner2010
learner2010

Reputation: 4167

Calling a web service from struts application

Would anyone be able to tell me how I can call a webservice in my struts application?

Upvotes: 2

Views: 3689

Answers (1)

Russell Shingleton
Russell Shingleton

Reputation: 3196

Well, I can think of several ways to do this depending on the web service. Most IDEs have ways to auto-generate webservice clients. I would probably create a java library package that which wraps the service client and provides an interface for your Struts application to invoke the client methods from within your Struts action class.

For example, if the service has a method getPerson(), I would create a remote DAO class that invokes the web service getPerson() method:

public class PersonServiceInterface{

    public Person getPersonFromService(){
        // web service calls to retrieve person object

        return person;
    }
}

Upvotes: 2

Related Questions