Anne,

Thanks for the explanation Anne.

Now some more question:

1.) What is the "Message" message style you referred to below? I have seen that being referred in
Axis docs too. What are the differences between the "Message" and "Document" message
styles?



2.)
>The first thing to understand about SOAP and WSDL is that the WSDL service
>interface is an abstraction of the method signature. There's no specific
>requirement for the two to map one-to-one.


As per what I gather from above, there are no specific restrictions on how the object interface
could look like for a wrapped-literal or a pure doc-literal service (or for any style of service),
especailly in terms of the parameters it accepts/returns. But from some of the posts on the Axis
archive, it would seems that if one wants to use a doc-literal service the web service method
should (or atleast ideally) have a signature that looks something like this (note the input and
output param types):


        public SOAPBodyElement [] method(SOAPBodyElement [])
        public void method(SOAPEnvelope, SOAPEnvelope)
        public Element [] method(Element [])
        public Document method(Document)

Is the above true? Or is it that any web service method (irrespective of its signature) could be a
candidate for a doc-literal service?


3.) Regarding the web service I am trying to develop, I have a stateless Session bean with the
following method signature:


          public String loadXMLData(String xmlString)

What it does is that it accepts a xml string and processes that xml and returns a xml string that
gives info about the success/failure of the process. I want to expose this as a doc-literal
web service. The xmlString param is an xml string. Internally, I validate the xml string using a
DTD and then if the xml is well-formed and valid do I proceed to process the xml, else I return
an error XML string right away as a return value.
Now, I want to expose this as a web service. I have also developed an XSD from the DTD to be
used for the web service implementation. The questions that arise are:


* What style of web service should I use?
I understand that I want to use a doc-literal service. But trying to decide whether to
use wrapped or non-wrapped (pure doc-lit) style. From what I have read about your
comments on wrapped, I am now more inclined towards pure doc-lit just so that it does
not put restrictions as you mentioned. But still trying to make sense before I take the
final plunge.
* How and where does the XSD I developed fits into the whole web service thingee?
Would I import/reference the XSD in the WSDL for the service? Do I need to validate the
XML using the XSD or is this just an unnecessary step because the loadXMLData() method
internally does validate the XML string against the DTD anyway?
* Do I need a wrapper for the EJB and in turn expose that wrapper as a web service instead
of the EJB itself? Are there any best practices for exposing web services?


Hopefully the above questions would give you more insight about the doubts/confusion I have.

Thanks very much.

Rahul.














From: "Anne Thomas Manes" <[EMAIL PROTECTED]>
Reply-To: [EMAIL PROTECTED]
To: <[EMAIL PROTECTED]>
Subject: RE: Exposing an EJB as a doc-literal web service
Date: Tue, 15 Jun 2004 20:38:21 -0400

Rahul,

Per the WS-I Basic Profile, a document/literal style service (whether
wrapped or not wrapped) must contain at most one message part.

The first thing to understand about SOAP and WSDL is that the WSDL service
interface is an abstraction of the method signature. There's no specific
requirement for the two to map one-to-one. Axis tends to tie the WSDL
interface pretty closely to the object interface (it makes automatic
generation much more straightforward), but it doesn't have to work that way.
You can create a custom provider that processes the message exactly the way
you want it to.


Regardless of the message style (RPC/Wrapped/Document/Message), the message
is received by the Axis runtime. It looks at the message signature (the
QName of the child element of the <soap:Body>) and maps it to a deployment
descriptor to determine how to process the message. The deployment
descriptor indicates which provider to route the message to (RPC, EJB, MSG,
or a custom provider). The provider processes the message, maps the message
elements to Java or DOM objects, and invokes the appropriate method.

The key distinction between RPC/encoded and Doc/Literal is in the way the
message is constructed. In the first case, the message is constructed
according to the SOAP encoding data model (which is under-specified, and
therefore a source of interoperability problems). In the second case, the
message is constructed according to the schema that defines your message.

The routing of messages is orthogonal to the method used to construct the
message.

Anne

-----Original Message-----
From: Rahul Jain [mailto:[EMAIL PROTECTED]
Sent: Monday, June 14, 2004 2:28 PM
To: [EMAIL PROTECTED]
Subject: RE: Exposing an EJB as a doc-literal web service

Hi Anne,

Attached is the WSDL file.
Your hunch was right. And as soon as I changed the service to a
wrapped-literal, it started working. I don't know why the Java2WSDL tool
would generate the wrong WSDL when I used the flags ( --style DOCUMENT --use


LITERAL). I then changed the style to WRAPPED and it was fine. So does this
mean that doc-literal services should always take one param and not more?

Also can you clarify something: According to me, say there is a class with a

method signature (from my case)
public String loadXMLData(String user, String xmlData)

and if one wants to expose this as a web service, then one can/should either

expose this as a RPC-encoded service or as a doc-literal web service
(wrapped or non-wrapped). The difference between the three being how the
SOAP request and response message looks. Now what I don't get is this: For
the RPC-encoded the method will be invoked like a RPC call, while
doc-literal is supposed to act in a different manner and I don't see how.
The method still gets invoked for a doc-literal service and the same data
gets passed in and worked upon. I don't see a difference in how RPC-encoded
and doc-literal is different in the example above. Obviously, I am missing
something here and I would really appreciate if you can clarify this.

Thanks.

Rahul.


>From: "Anne Thomas Manes" <[EMAIL PROTECTED]>
>Reply-To: [EMAIL PROTECTED]
>To: <[EMAIL PROTECTED]>
>Subject: RE: Exposing an EJB as a doc-literal web service
>Date: Thu, 10 Jun 2004 10:29:26 -0400
>
>Can you send us your WSDL?
>
>My first hunch is that you aren't using a wrapper element for your two
>parameters. A doc/literal message must contain only one child element in
>the
><soap:Body>. Axis will process only the first element and ignore any
>subsequent elements. That first child element should be a wrapper element
>that contains all your parameters.
>
>Anne
>
>-----Original Message-----
>From: Rahul Jain [mailto:[EMAIL PROTECTED]
>Sent: Tuesday, June 08, 2004 8:20 PM
>To: [EMAIL PROTECTED]
>Subject: RE: Exposing an EJB as a doc-literal web service
>
>Hi,
>
>Thanks for the help, Wei.
>
>I did what you suggested and it worked, but partially.
>
>The issue is there is a method called loadXMLData(String param1, String
>param2) on the EJB. I deployed the EJB as a web service exposing this
>method. I then wrote a client to invoke (actually used the Junit test case
>generated by WSDL2Java) to test the service. What happens is the EJB on the
>server only get the value for param1, but param2 is null. On the client
>side
>
>I checked that the Axis generated <ServiceName>SoapBindingStub which
>actually invoked the call using org.apache.axis.client.Call instance
>invoke(Object[]) method, passes in the proper values to the invoke()
>method.
>
>But somehow on the server (EJB) only the first param (param1) is obtained
>fine...param2 is somehow null. Also checked the EJB code and its is not
>doing anything funky. It just receives the param2 as null and hence throws
>an exception.
>
>Thanks.
>
>Rahul.
>
>
>
> >From: Wei Hsu <[EMAIL PROTECTED]>
> >Reply-To: [EMAIL PROTECTED]
> >To: "'[EMAIL PROTECTED]'" <[EMAIL PROTECTED]>
> >Subject: RE: Exposing an EJB as a doc-literal web service
> >Date: Mon, 7 Jun 2004 15:53:45 -0700
> >
> >Actually, the build-in Axis EJB Provider can expose the EJB as a
> >doc-literal
> >web service. In the simplest case, all you have to do is change one line
> >in
> >your deploy.wsdd:
> >
> >From
> >
> ><service name="MyService" provider="java:EJB">
> >
> >to
> >
> ><service name="MyService" provider="java:EJB" style="wrapped"
> >use="literal">
> >
> >If you want to use straight up doc-lit and not wrapped style, just set
> >style="document" instead.
> >
> >-Wei
> >
> >-----Original Message-----
> >From: Rahul Jain [mailto:[EMAIL PROTECTED]
> >Sent: Monday, June 07, 2004 10:12 AM
> >To: [EMAIL PROTECTED]
> >Subject: Exposing an EJB as a doc-literal web service
> >
> >Hi,
> >
> >Can somebody plz gudie me how I would expose an EJB as a doc-literal web
> >service? The build-in Axis EJB Provider exposes it as a RPC service only.
> >
> >Thanks.
> >
> >Rahul.
> >
> >_________________________________________________________________
> >Looking to buy a house? Get informed with the Home Buying Guide from MSN
> >House & Home. http://coldwellbanker.msn.com/
>
>_________________________________________________________________
>Getting married? Find great tips, tools and the latest trends at MSN Life
>Events. http://lifeevents.msn.com/category.aspx?cid=married
>


_________________________________________________________________
MSN 9 Dial-up Internet Access fights spam and pop-ups - now 3 months FREE!
http://join.msn.click-url.com/go/onm00200361ave/direct/01/


_________________________________________________________________
Stop worrying about overloading your inbox - get MSN Hotmail Extra Storage! http://join.msn.click-url.com/go/onm00200362ave/direct/01/




Reply via email to