Part I
Creating
web services in SAP Netweaver
platform takes 10 minutes if you
are ready to code your business
logic. Its really as easy as developing
a simple web site with a few pages.
In
this blog we will develop a web
service with Netweaver development
components, and make it dynamic
with deployable proxy configurations.
By using development components
we make our solution ready for
adding to DTR, which is SAP Netweaver's
technology for keeping source
files in repository organized,
and with the proxy configurations
we will make it our clients ready,
without coding, for the future
changes.
Easy
Web Services
In
order to generate a web service
we should first generate a DC
in EJB type. For doing this we
start to create a development
component project, choose +My
Components+,
write our vendor name, DC name
for your preference, and create
a project of type +J2EE > EJB
Module+.
!https://weblogs.sdn.sap.com/weblogs/images/251782120/image001.jpg|height=370|width=473|src=https://w...!
After
that we should create an Enterprise
Java Bean of type stateless session
bean and add one business method.
Right click to ejb-jar.xml,
choose new > EJB and
create your ejb of type stateless
session bean, and add your business
methods. (I add one method getDateAndTime
taking one parameter of string
and returning the date and time
with this string for seeing the
difference). For writing the business
logic code open ejb-jar.xml and
double click on your bean and
select bean tab from the bottom.
Deployable
Proxy
With
using same steps like EJB and
EAR project DCs, we start a deployable
proxy. we choose *deployable
proxy* under
web services.
After
creating the project right click
on the project and choose +new > client
proxy generation+.
Select your proxy name and packages,
and choose a wsdl from local file
system or give a web address.
Netweaver Developer Studio then
creates interfaces for reaching
the web service over the server.
You have created a proxy with
one default port pointing to the
web service you previously generated.
Right clicking on the project,
choosing +development
component > build+,
then deploying it the same way
creates your proxy on the server.
For
testing our web service proxy,
we will create a web module DC,
and call the proxy from our servlet.
We will go with the implementation
details later, however after creating
the web project DC, our projects
structure should look like the
picture below :
Result
of Part I ..
- One
proxy project for reaching the
web service
- One
enterprise archive project for
deploying ejbs and servlet code
to server
- One
EJB project for creating stateless
session beans and web services
- One
web project for creating servlets
to test the proxy
!https://weblogs.sdn.sap.com/weblogs/images/251782120/image004.jpg|height=167|width=337|src=https://w...!
We
will continue with developing
our proxy and caller objects and
configuring these to make them
dynamic in the How-To Create Dynamic & Configurable Web Services Easily With Netweaver Development Components (Part.....