How can i expose a Java legacy app as a soap web services?

Our company is moving some components to our internal cloud and I am working in a project and one of the task is to expose an existing legacy java class as soap web service. Can anyone please help me stir in the right direction? How can  I write a soap Producer on existing new class and methods? Should I write a new class and extend this class or should I write a subclass? What is the best  way  to approach  this?I  am new  to integration projects. The company is using  Mule  Esb as an integration solution? Also how Mule esb fitst together  with all this?I am new to  Mule  esb.
Frank DannyAsked:
Who is Participating?
 
girionisCommented:
There are two approaches.

The first is you build the WSDL and from the WSDL you generate the skeleton Java code. Then you fill in the gaps.

The second approach is to write the Java class first, build it, deploy it, and then get the WSDL form the Java code.

The second approach is easier.
0
 
girionisCommented:
You should use composition. Write your web service and within your web service just call the methods in your legacy code.

@WebService
public class NewWebService {
    private LegacyJavaObject legacy = new LegacyJavaObject();

    @WebMethod
    public void doSomething() {
        legacy.doSomething();
    }
}

Open in new window

0
 
Frank DannyAuthor Commented:
Thank  you @girionis...............how can I publish  it?Build  it and get the wsdl?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.