0

I am pretty new to spring and currently I was able to create a complete web service with spring-ws. Now I want to separate the functionalities of my web service in to two separate web services. But except the service layer there are other spring components (business layer) which are common to both of these services.

So my question is there a way to make spring web service depend on another spring project (business layer)? If you can provide such example or a tutorial where a spring web service depends on another spring project it will be really helpful.

Thanks in advance.


UPDATE

I could achieve above by building my business layer as a jar file and adding it as a dependency to the service. But now my supervisor wants me to deploy the business layer in a separate server. But I could not find any information on how to handle communication here between web service and the business layer. Any idea?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Thudani Hettimulla
  • 754
  • 1
  • 12
  • 32
  • I'm not sure what you want to do: do you want to create two endpoints in one project or do you want to create two projects that depend on some common code? I'd say go with the multiple endpoints approach - if that won't work you just need to create a seperate project which contains your service layer and distribute this .jar file in both projects. – evandongen Apr 09 '14 at 13:19
  • Thanks @evandongen: Yes, I could successfully create separate project which contains service layer and added other components as a jar dependency. But now further I want to deploy those components in separate server and communicate rather than adding as a jar file dependency. Do you have an idea how to achieve this. – Thudani Hettimulla Apr 10 '14 at 03:01
  • Finally I could deploy them separately and communication was handled with spring http invoker. Now another problem, I am using tomcat container authentication with springs preAuthenticatedAuthenticationProvider to authenticate my web service. Now I need a way to pass this authentication to my business logic. any idea? – Thudani Hettimulla Apr 10 '14 at 09:44
  • I'm sorry, I don't. I can't figure out why you want to separate this even further. But if you create multiple layers and run those in different contexts/servers you've got to find a way to communicate. JSON, tokens you can pass, the possibilities are endless I supoose. – evandongen Apr 10 '14 at 13:53

0 Answers0