Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp
Win a copy of Head First Agile this week in the Agile forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

trying to get a contract-last SOAP-based web service runnning - halfway there  RSS feed

 
Stuart Rogers
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java 1.7
Spring 3.1.1 with Spring-WS 2.1.1
Joda
Hibernate 3.6
SqlServer 2008 R2
Maven 3
Tomcat 7
Eclipse 3.7

Greetings all,

I've built a functioning webapp to verify connectivity to my database.
Now I'd like to break the webapp into two pieces - a contract-last SOAP-based web service
and a client.
And I'm stumbling quite a bit, drowning in hundreds of examples using hundreds of different
techniques across several versions of Spring.

I've placed XML annotations into my POJOs as such
FormTemplate.java


and built a com.foo.forms.web.endpoint package and placed within it
FormsEndpoint


and corresponding FormsEndpointImpl


and
src/main/webapp/WEB-INF/web.xml


and
src/main/webapp/WEB-INF/spring/root-context.xml


and
src/main/webapp/WEB-INF/spring/appServlet/servlet-context.xml



Note that some of the stuff in web.xml and servlet-context.xml are leftovers from
when I converted my webapp project into this newfangled web-service project. It no
doubt needs to be replaced by some other stuff.

So this proto-web-service compiles and produces a warfile which I can deploy.
But I know I'm missing some steps in between.
So I plea for wisdom from Those Who Have Gone Before - I'm at Point A, how do I get
to Point B? What configurations/code/steps do I need to add to arrive at a
functionng web service based upon the above parameters, and how do I call it?

TIA,

Still-learning Steve
 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given you're using a SOAPful web service JAX-WS and Spring:

1. Read Spring Framework Reference Documentation 4.0.4.RELEASE or the version you use

21.5 Web services
Exposing web services using JAX-WS

- Exposing servlet-based web services using JAX-WS or
- Exporting web services using the JAX-WS RI’s Spring support

2. If you read point 1, then it will clear to you.
 
Stuart Rogers
Ranch Hand
Posts: 141
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I made some changes :

web.xml


and servlet-context.xml


supposedly using apache cxf will autogenerate the wsdl upon deployment.

So this whole pile compiles and deploys successfully under Tomcat 7. Looking in Tomcat's manager webapp I see my forms_webservice running.
But I can't seem to get it to show me its wsdl I've tried:

http://localhost:8080/wiggs
http://localhost:8080/FormsService
http://localhost:8080/FormsServiceService
http://localhost:8080/wiggs.wsdl
http://localhost:8080/FormsService.wsdl
http://localhost:8080/FormsServiceService.wsdl

I tried manually running wsgen to make a wsdl from my FormsEndpointImpl but couldn't get that to work either.

So I'm (still) stuck, could use some help.

Thanks,

Still-learning Steve
 
H Paul
Ranch Hand
Posts: 491
5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Given you use Apache CXF as an implementation for JAX-WS and want to use Spring.

You need to set up CXF and Spring correctly. See Point 1.
Since Spring will control/manage your JAX-WS bean. See Point 1 + Point 2.
You can access the wsdl based up on Point 2. (See address="/FormsEndpointService"). See Point 3.

1. Revised web.xml



2. Revised servlet-context.xml



3. This wsdl url is based upon Point 2.
http://localhost:8080/YOUR_PROJECT_NAME/FormsEndpointService?wsdl

replace YOUR_PROJECT_NAME with your own project name.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!