axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Williams,Ed" <EWILLI...@cerner.com>
Subject RE: Explanation of how to use in/out parameters
Date Mon, 14 Jan 2002 23:50:01 GMT
Russell,
I guess you're right that my ReadContext class is a holder and not a true
in/out.
I admit I haven't firmly grasped all the layers in this animal, but let me
tell you officially state I was hoping and perhaps you can tell me why it's
not a good answer.
(excuse the length)

The RPC method is as you stated: Widget readWidget(ReadContextHolder rc,
WidgetQualifier wq);
First my goal is to produce an xml SOAP response similar to this:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <SOAP-ENV:Body>
  <ns1:readWidgetResponse xmlns:ns1="WidgetDirectory">
   <readWidgetResult href="#id0"/>     /* the Returned object */
   <rc href="#id1"/>                   /* the in/out ReadContext object */
   </ns1:readWidgetResponse>
  <multiRef id="id0" xsi:type="ns2:Widget"
xmlns:ns2="http://com.cerner.widget">
   <Widget>
    <WidgetId xsi:type="xsd:double">3968194.0</WidgetId>
    ....
    </Widget>
   </multiRef>
  <multiRef id="id1" xsi:type="ns2:ReadContext"
xmlns:ns2="http://com.cerner.widget">
   <ReadContext>
    <Status xsi:type="xsd:string">Success</Status>
    ....
    </ReadContext>
   </multiRef>  
</SOAP-ENV:Body>

Second, I was hoping that I could change my ReadContext class in the example
method to simply extend a tag interface called Holder (rather than renaming
the class to ReadContextHolder and changing the interface).
Java2WSDL could recognize the Holder interface through introspection and
create the appropriate WSDL that describes my ReadContext as an in/out
(maybe that is not the correct description for ReadContext).
Axis would also use introspection to know that it needs to add the
ReadContext in the SOAP response (possibly when it resolves the
'methodName="*"' from the servlet-config).  It would employ the serializer
that is mapped to this type.

Isn't this more elegant that wrapping the service and stubs in wrapper
methods?
Ok, now it's time to make me look stupid for missing the obvious pitfalls.
(BTW, I'm not sure why I get the hrefs/multiRefs, but I just went with
it...)

Ed

-----Original Message-----
From: Russell Butek [mailto:butek@us.ibm.com]
Sent: Friday, January 11, 2002 10:47 AM
To: axis-dev@xml.apache.org
Cc: axis-user@xml.apache.org
Subject: Re: Explanation of how to use in/out parameters


Andy, your suggestion is essentially what's being tossed around in
axis-dev.  And when I said "if ReadContext is not a bean" I didn't mean
arrays.  Arrays would be treated the same.  What I meant was a class like:

class X {
    private int a;
    public int method(String b, int c, float d);
}

This isn't a bean, so there's no way to extract/populate the data in a
beanish manner.

Russell Butek
butek@us.ibm.com


"Andy Longshaw" <andy@blueskyline.com> on 01/11/2002 10:15:24 AM

Please respond to axis-dev@xml.apache.org

To:   <axis-user@xml.apache.org>
cc:   <axis-dev@xml.apache.org>
Subject:  Re: Explanation of how to use in/out parameters



Hi Russell,

Please excuse me if any of this is simplistic or off-beam.

I would try to keep things as transparent as possible.
Could the in/out-ness of the parameter be indicated to
Java2WSDL by means of a config file (such as the extra
binding schema they had for JAXB last time I looked)
which would give information about which parameters
had to be treated this way. This could be deployed as
part of the Web app config info.

When you say "if ReadContext is not a bean"
do you mean it is a non-bean class or are you
thinking in terms of an array, as in (Object[] array)?

Cheers

Andy

----- Original Message -----
From: "Russell Butek" <butek@us.ibm.com>
To: <axis-user@xml.apache.org>
Cc: <axis-dev@xml.apache.org>
Sent: Friday, January 11, 2002 2:40 PM
Subject: RE: Explanation of how to use in/out parameters


> (I'm cross posting this to both axis-dev and axis-user.  For the axis-dev
> folks who haven't been monitoring axis-user, in short we have an existing
> class that we'd like to turn into a Web Service.  This class has method "
> Widget readWidget(ReadContext rc, WidgetQualifier wq);" where the
> implementation updates ReadContext and the caller receives those updates.
> When called remotely, the caller doesn't receive these updates because
> ReadContext is treated as a simple input parameter.  This isn't such an
> outlandish use of Java, the Java classes themselves have instances like
> this, for example:  java.util.Vector.toArray(Object[] array),
> java.lang.StringBuffer.getChars(int srcBegin, int srcEnd, char[] dst, int
> dstBegin).)
>
> I've giving this a bit more thought.  I said this is a spec issue, but
the
> JAX-RPC spec weasels out of it (section 5.2.2 Remote Reference Passing):
>
> "The JAX-RPC specification does not require support for the passing or
> return of a
> remote reference across a remote method invocation. The reason is that
SOAP
> [5]
> specifies object-by-reference as out of scope in both the 1.1 and 1.2
> versions. Any
> support for remote reference passing in the JAX-RPC would be non-standard
> and hence
> constrain interoperability."
>
> Java's parameter passing mode is really object-by-reference even though
> it's not often used that way.  This particular example IS using it that
way
> and the SOAP specs themselves don't even want to deal with it.  That
> doesn't mean AXIS can't provide a solution, but I suspect it would be
> difficult.  Obviously, if we DO solve this, it will be completely
> non-interoperable.  It would ONLY work AXIS->AXIS.
>
> Time for a little brainstorming (and PLEASE join in!)  A possible
solution
> is to somehow tell Java2WSDL that a particular parameter on a particular
> method should be treated specially - in other words, sent on both the
> request message AND the reply message.  If we can get the runtime to
> recognize this special case, then another issue is how does this look on
> the client?  Can we keep the same signature or does it have to be marked
> somehow?  How does the stub distinguish between an input parameter and
this
> special inout parameter?  Will the stub be able to receive the new
> ReadContext and make the updates?  If ReadContext is simply a bean, then
> the stub may be able to simply call the accessors and transfer data.  If
> ReadContext is NOT a bean, then I don't know whether we can solve this
> problem.  Thoughts?  Ideas?
>
> Russell Butek
> butek@us.ibm.com
>
>
> Russell Butek/Austin/IBM@IBMUS on 01/11/2002 07:20:33 AM
>
> Please respond to axis-user@xml.apache.org
>
> To:   axis-user@xml.apache.org
> cc:
> Subject:  RE: Explanation of how to use in/out parameters
>
>
>
> I'm puzzled.  Java does not have the concept of an inout parameter.  So
> there's no way for ReadContext to be inout in the existing readWidget
> method.  Do you mean that the implementation of readWidget updates
> ReadContext?  (It's a nit, but that's not quite the same as ReadContext
> being in/out, the fields within ReadContext are in/out and ReadContext is
> essentially a holder.)
>
> This is a problem, and it's bigger than AXIS, it's a spec issue.  We
assume
> parameters are input unless they're holders.  This covers the vast
majority
> of situations because parameters in Java are primarily input.  In order
for
> your situation to work we'd have to treat all parameters as in/out
(without
> holders which means we might get into other problems) and ALWAYS send the
> parameter back on the response message.  This is a lot of overhead since
> most of the time the parameters are really only input and, therefore, the
> response parameters will most often be ignored.
>
> I don't have a solution for you.  Perhaps someone else would care to
> respond?
>
> Russell Butek
> butek@us.ibm.com
>
>
> "Williams,Ed" <EWILLIAMS@cerner.com> on 01/10/2002 03:40:20 PM
>
> Please respond to axis-user@xml.apache.org
>
> To:   "'axis-user@xml.apache.org'" <axis-user@xml.apache.org>
> cc:
> Subject:  RE: Explanation of how to use in/out parameters
>
>
>
> Thank you Russell for the explanation and link (sorry about the user's
> guide
> thing).
> Here is my problem with this solution that might be common (hopefully you
> can offer a solution).
> I have an existing, established, published set of services (Directory
> classes with 'read', 'write', 'delete', etc).  Hundreds and hundreds of
> them
> that have been exposed at the java level (through the Directory classes)
> and
> through XML servlets (non-SOAP).  It would be a great burden, not to
> consider a non-passive change to all my users, to change the classnames
to
> 'Holders' to indicate in/out.  Can't this be done some other way, like
> making the class implement the Holder interface instead?  This would be
> passive and it seems more elegant than parsing the name of a class.
> Granted, I have no grasp on all the issues that went into this decision.
>
>
> -----Original Message-----
> From: Russell Butek [mailto:butek@us.ibm.com]
> Sent: Thursday, January 10, 2002 2:54 PM
> To: axis-user@xml.apache.org
> Subject: Re: Explanation of how to use in/out parameters
>
>
> The holders are documented in the JAX-RPC spec
> (http://java.sun.com/xml/jaxrpc/index.html).
>
> The users's guide is out of date.  Thanks for bringing this up!  I'll
have
> to fix it when I get the chance.  WSDL2Java ONLY generates holders if
> they're needed.  What you want to do is to change your signature to read:
>
> Widget readWidget(ReadContextHolder rc, WidgetQualifier wq);
>
> Java2WSDL recognizes any parameter ending in "Holder" and having a public
> value field as a JAX-RPC holder.  Here's what your holder class should
look
> like:
>
> public final class ReadContextHolder implements java.io.Serializable {
>     public ReadContext value;
>
>     public ReadContextHolder() {
>     }
>
>     public ReadContextHolder(ReadContext value) {
>         this.value = value;
>     }
> }
>
> Russell Butek
> butek@us.ibm.com
>
>
> "Williams,Ed" <EWILLIAMS@cerner.com> on 01/10/2002 02:40:09 PM
>
> Please respond to axis-user@xml.apache.org
>
> To:   "'axis-user@xml.apache.org'" <axis-user@xml.apache.org>
> cc:
> Subject:  Explanation of how to use in/out parameters
>
>
>
> Can anyone point me to where in/out parameters have been
> discussed/explained, because I seem to be left out?  I've picked up from
> that Holders are probably the answer, but I can find nothing on them.
>
> Alternatively, someone please answer the questions I am finding:
> The User's Guide (only doc I can find) has a section on Holders in which
it
> says: "You'll notice that for each data class that Wsdl2java generates,
> there is a corresponding "Holder" class".  I don't see any "Holder"
classes
> generated for my service.
> My service has the following method in it:
> Widget readWidget(ReadContext rc, WidgetQualifier wq);
> I want the ReadContext to be "in/out" and the WidgetQualifier to be "in".
> How do you indicate this to the AxisServlet and to the Java2WSDL (?WSDL)
> generator?
> Any help or info would be greatly appreciated.
> Ed
> CONFIDENTIALITY NOTICE
>
> This message and any included attachments are from Cerner Corporation and
> are intended only for the addressee. The information contained in this
> message is confidential and may constitute inside or non-public
information
> under international, federal, or state securities laws. Unauthorized
> forwarding, printing, copying, distribution, or use of such information
is
> strictly prohibited and may be unlawful. If you are not the addressee,
> please promptly delete this message and notify the sender of the delivery
> error by e-mail or you may call Cerner's corporate offices in Kansas
City,
> Missouri, U.S.A at (+1) (816)221-1024.
> -------------------------------------------
>
>
> CONFIDENTIALITY NOTICE
>
> This message and any included attachments are from Cerner Corporation and
> are intended only for the addressee. The information contained in this
> message is confidential and may constitute inside or non-public
information
> under international, federal, or state securities laws. Unauthorized
> forwarding, printing, copying, distribution, or use of such information
is
> strictly prohibited and may be unlawful. If you are not the addressee,
> please promptly delete this message and notify the sender of the delivery
> error by e-mail or you may call Cerner's corporate offices in Kansas
City,
> Missouri, U.S.A at (+1) (816)221-1024.
> -------------------------------------------
>
>
>
>
>


CONFIDENTIALITY NOTICE

This message and any included attachments are from Cerner Corporation and are intended only
for the addressee. The information contained in this message is confidential and may constitute
inside or non-public information under international, federal, or state securities laws. Unauthorized
forwarding, printing, copying, distribution, or use of such information is strictly prohibited
and may be unlawful. If you are not the addressee, please promptly delete this message and
notify the sender of the delivery error by e-mail or you may call Cerner's corporate offices
in Kansas City, Missouri, U.S.A at (+1) (816)221-1024.
-------------------------------------------


Mime
View raw message