You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Steven Gollery <sg...@cadrc.calpoly.edu> on 2002/04/02 22:34:06 UTC

RE: Document style service with two methods

Ramon,

I have the same problem -- I've been hoping that someone with more Axis
experience than I have would jump in and either tell us how to do this
or confirm that it can't be done for some reason.

The only solution I've been able to come up with is one that you've
probably already considered (and which I think is the same way that the
AdminClient works): have one service method, but put the real method
name in the document itself (probably in the root tag). Then the method
implementation checks to see what operation the client wants and calls
that method itself.

But this seems unsatisfactory to me. Hopefully the Axis people can come
up with a better approach.

Steve Gollery

Ramon Turnes wrote:

>Hi,
>
>I would like to have a service using Document style with two
>methods but it seems that this is not possible because the
>message dispatcher for Document style services checks for
>a method with the following signature:
>
>
>  Document MyMethod(MessageContext mc, Document xml) {
 > .....
  >}
>
>and the method name is not taken into consideration for
>deciding which method to call. But what if I want to have
>two methods in my service, let's say a Registration method
>and a Ordering method? Should I provide then two endpoints
>for each of the methods (I saw an example in WSTK that does it).
>Can I do this with Document style services or I need to use RPC?
>
>Thanks.




Re: Document style service with two methods

Posted by Stan Jordan <sk...@worldnet.att.net>.
Ramon & Steve...
This is not quite the answer you want, but may send you in the right
direction.  Take a look at this service:

http://samples.gotdotnet.com/quickstart/aspplus/samples/services/MathService
/VB/MathService.asmx
The service is style="document" and provides four methods:
    float Add(float a, float b);
    float Subtract(float a, float b);
    float Multiply(float a, float b);
    float Divide(float a, float b);
Do this:
Create wsdl file with your browser, create stubs, and compile the stubs.
Now compile & execute the client shown below.  Works fine!
By examining the stubs, maybe you will find what you are looking for.
Cheers.
Stan
--------------------------------
//This is client for a service with style="document"
import org.tempuri.MathServiceLocator;
import org.tempuri.MathServiceSoap;

public class Client {
  public static void main(String [] args) throws Exception {

    MathServiceLocator service = new MathServiceLocator();
    MathServiceSoap port = service.getMathServiceSoap();

 System.out.println("     add= " + port.add(1.1F, 2.5F));
 System.out.println("multiply= " + port.multiply(1.1F, 2.0F));
 System.out.println("  divide= " + port.divide(10.0F, 3.0F));
  }
}

--------------------------------
----- Original Message -----
From: "Steven Gollery" <sg...@cadrc.calpoly.edu>
To: <ax...@xml.apache.org>
Sent: Tuesday, April 02, 2002 1:34 PM
Subject: RE: Document style service with two methods


> Ramon,
>
> I have the same problem -- I've been hoping that someone with more Axis
> experience than I have would jump in and either tell us how to do this
> or confirm that it can't be done for some reason.
>
> The only solution I've been able to come up with is one that you've
> probably already considered (and which I think is the same way that the
> AdminClient works): have one service method, but put the real method
> name in the document itself (probably in the root tag). Then the method
> implementation checks to see what operation the client wants and calls
> that method itself.
>
> But this seems unsatisfactory to me. Hopefully the Axis people can come
> up with a better approach.
>
> Steve Gollery
>
> Ramon Turnes wrote:
>
> >Hi,
> >
> >I would like to have a service using Document style with two
> >methods but it seems that this is not possible because the
> >message dispatcher for Document style services checks for
> >a method with the following signature:
> >
> >
> >  Document MyMethod(MessageContext mc, Document xml) {
>  > .....
>   >}
> >
> >and the method name is not taken into consideration for
> >deciding which method to call. But what if I want to have
> >two methods in my service, let's say a Registration method
> >and a Ordering method? Should I provide then two endpoints
> >for each of the methods (I saw an example in WSTK that does it).
> >Can I do this with Document style services or I need to use RPC?
> >
> >Thanks.
>
>
>
>