Hi Steve,
I've been reading your email over and over again and still not 100%
sure
what you meant... I've done lots of reading and research and trying to
put
the pieces together.... appreciate your help.
Without having web service in mind, this is what I had done (it's not
complete
yet, but just to share the idea with you).
1. I have MOServlet extends HttpServet. This servlet overrides
doPost()
and get parameters from request object. Then, pass the parameter
to
MOService instance.
2. MOService has a method "deliverMOMessage(...)" . This method
performs
validation on some of the params and insert the params into
database.
(I can't find ways to use JMS with MSMQ, so for now, I just use
database).
So to make this as a service:
1. I've created deploy.wsdd and undeploy.wsdd files. I used
AdminClient
to publich my MOService.deliverMOMessage(). So far I was able to
see this
when I ran the AxisServlet.
Question: The wsdl file is created on the fly, right? Does it
creates any other
files? I don't see other files generated. My server-config.wsdd
file was updated
to include the MOService. Is that all it does?
2. Based on your sample code below, few questions.
a. Do I need to extend AxisServlet instead of HttpServlet?
b. By extending HttpServlet, I thought I could do as follows:
MessageContext ctx = MessageContext.getCurrentContext();
SOAPMessage msg = ctx.getMessage();
.... go through until I get to SOAPBody.
c. Then I can use getChiildElements() to retrieve the
parameters.
3. Once I have all the params, I can pass them to MOService
deliverMOMessage(<params>).
So far, does this seems right? Appreciate your time.
Thanks,
--Kawthar
>>> [EMAIL PROTECTED] 23/03/2004 04:48:32 PM >>>
Hi Kawthar,
Axis is a servlet or server in your case.
The way to use web services in general is to have a normal java
application
that exposes services via an interface. These are just plain old java
objects.
Once you have an interface you can the run java2WSDL against the
interface to
generate a WSDL file that describes your service.
Once you have the WSDL you can then use WSDL2java to produce all or
your server
classes, your [un]deploy.wsdd and a whole host of serializable objects
and
Exceptions (if your service throws them).
If you have already implemented your service i.e. it runs but not
currently as
a web service you will want to tell WSDL2java not to generate the
server side
Stub. This will then create an Imple class that will also be the
deployed
service class in the [un]deploy.wsdd.
In the stubbed methods of this class you can defer all the calls to
your
implementation. The signatures of the methods should be identicle to
those
defined in your oridinal interface.
As you will already have a fully functional service just not as a web
service
all of the created serializable classes and exception created by
WSDL2java can
be thrown away and you can just keep the originaly implemented
objects.
Now you should have a deployable web service. Use the Axis Admin
Service to
deploy your web service and hey presto....
To retrieve the request that was made to invoke your service you use
the Axis
MessageContext to aquire the ServletContext from which you can then get
the
original Servlet Request and from there all of the parameters passed.
here is an example of how to aquire the ServletContext from within a
method in
the deployed Impl class.
org.apache.axis.MessageContext axisContext =
org.apache.axis.MessageContext.getCurrentContext();
javax.servlet.ServletContext sc = ((javax.servlet.http.HttpServlet)
axisContext.getProperty
(org.apache.axis.transport.http.HTTPConstants.MC_HTTP_SERVLET)).getServletContex
t();
Hope this helps you out and gets you on the road to creating some
useful web
services in the future.
Regards
Steve
Quoting Kawthar Bt M Sulaiman <[EMAIL PROTECTED]>:
>
> How do I retrieve SOAP message from HttpServletRequest?
> Do I need to use request.getParameter("???")?
>
> I'm trying to implement a server. This is what I've done:
>
> 1. I have deploy.wsdd file and was able to see it under
AxisServlet.
> I'm still not 100% clear what this does? Does it only creates
a
> wsdl file?
> It doesn't create the stub classes, does it??
>
> 2. I have MOService.class, which has one method:
> public String deliverMOMessage(int appId, String msisdn,
....)
>
> 3. I have MOServlet.class. Inside the doPost(), I need to retrieve
> the
> SOAP message from request object and retrieve all the params.
> Then
> I can invoke MOService service = new MOService();
> service.deliverMOMesasge(<params>).
>
> Is this how you implement a server?? Most of the samples I found
> implement
> client.. so I'm not so sure how the server works (with servlet).
>
> Thanks,
> --Kawthar
>
> Confidential information may be contained in this e-mail and any
files
> transmitted with it ('Message'). If you are not the addressee
indicated in
> this Message (or responsible for delivery of this Message to such
person),
> you are hereby notified that any dissemination, distribution,
printing or
> copying of this Message or any part thereof is strictly prohibited.
In such a
> case, you should delete this Message immediately and advise the
sender by
> return e-mail. Opinions, conclusions and other information in this
Message
> that do not relate to the official business of Maxis shall be
understood as
> neither given nor endorsed by Maxis.
>
---------------------------------------------------
This message was sent using Spansurf Web Mail
Internet access in Spain - http://www.spansurf.com/
Confidential information may be contained in this e-mail and any files transmitted
with it ('Message'). If you are not the addressee indicated in this Message (or
responsible for delivery of this Message to such person), you are hereby notified that
any dissemination, distribution, printing or copying of this Message or any part
thereof is strictly prohibited. In such a case, you should delete this Message
immediately and advise the sender by return e-mail. Opinions, conclusions and other
information in this Message that do not relate to the official business of Maxis shall
be understood as neither given nor endorsed by Maxis.