aspose file tools*
The moose likes Web Services and the fly likes web service class method but with different signatures dont compile Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "web service class method but with different signatures dont compile " Watch "web service class method but with different signatures dont compile " New topic
Author

web service class method but with different signatures dont compile

Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
hello
why when i try to compile the class that has the web service method then i try to add same method but with different signatures
this is my class :


can't i have multiple method signatures in my class?
the jaxws process is failed? gives me this error :


[apt] error: Request wrapper bean names must be unique and must not clash with other generated classes. Class: com.WebServices.adapters.WSAdapter method Invoke(java.lang.String,java.lang.String)

[apt] error: Response wrapper bean names must be unique and must not clash with other generated classes. Class: com.WebServices.adapters.WSAdapter method Invoke(java.lang.String,java.lang.String)
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
As far as I recall WSDL 2.0 and the Basic Profile disallow method overloading. It was only WSDL 1.1 that allowed it.
Meir Yan
Ranch Hand

Joined: Apr 27, 2006
Posts: 597
is there any way to overcome this problem?
Peer Reynders
Bartender

Joined: Aug 19, 2005
Posts: 2922
    
    5
There is only one solution - give each method a different name like
  • QueryByServantMethodError(String servantName,String methodName,int error)
  • QueryByServantMethod(String servantName,String methodName)
  • QueryByError(int error)


  • Ultimately this is only a problem because you are attempting to use Web services as a Java RPC mechanism. XML Schema has no problem accommodating optional elements in a document schema.

    Returning List<Object> will possibly give your clients headaches.
  • Non Java-based clients have no clue what a List<Object> is. They are going to have to deal with some awful generated XML representation that is specific to the Java2WSDL tool that generated it.
  • Pre Java 5 SE based clients have not clue what a List<Object> is. If they are lucky their WSDL2Java may give them an array of Objects.
  • Even Java 5 based clients may not end up with a List<Object> if they rely solely on the published WSDL. Sure Java EE clients may use mapping files to map it back to the List<Object>. However that is information that is outside of the WSDL and the mapping option isn't necessarily available to plain Java clients.


  • Production Web Services aren't simply a matter of exposing some Java methods.

    Web services != RPC
    Patterns and Strategies for Building Document-Based Web Services
    Meir Yan
    Ranch Hand

    Joined: Apr 27, 2006
    Posts: 597
    hello and thanks for the fast reply
    well im coming from corba background and im beginner in web services and every day im learning something new
    like for me one of the main differences that web service can't return value by reference so i need always to return
    my results in some kind of list of objects , don't worry about the return list<Object>
    the client in my case will know what the service will return . also the difficulty to deal with complex objects when sending them .. you have to think in different way in adapters and converter between your application data types and the ones web services understand this is not easy when you dealing with legacy application that needs to implement web services ...
    so where can i understand it better or there is easy solutions for this kind of jobs ?

    thanks
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2922
        
        5
    Originally posted by Meir Yan:
    well im coming from corba background


    If I recollect correctly from my very brief exposure to CORBA, "IDL first" (i.e. design interface first) is considered a best practice.

    Analogous to that "WSDL first" is considered a best practice with Web Services, i.e. :

  • Figure out what raw data you need to exchange to get the job done.
  • Design an "XML Application" (an XML Schema for the request and response documents) to structure this data in XML - or even better use an existing XML Application.
  • Use the XML Request and Response document definitions in a WSDL to define your Web service interface.
  • Use WSDL2Java to generate your server stubs and the supporting Java data classes.


  • 3.4.1 Designing the Interface.
    See Also:
    Java2WSDL & WSDL2Java tools ?
    [ November 23, 2006: Message edited by: Peer Reynders ]
    Meir Yan
    Ranch Hand

    Joined: Apr 27, 2006
    Posts: 597
    hello again
    i started to read the links you gave me very informative indeed
    onoter thing i need to learn more about the uses of jaxws and jaxb
    is there any good book i can buy about this subject ?
    Peer Reynders
    Bartender

    Joined: Aug 19, 2005
    Posts: 2922
        
        5
    Originally posted by Meir Yan:
    another thing i need to learn more about the uses of jaxws and jaxb
    is there any good book i can buy about this subject ?


    Its too recent and not that widely used yet. Its only going to be pervasive once most of the vendors comply with Java EE 5 or development with Java 6 SE is more commonplace (Java 6 is still in beta and many places aren't using Java 5 yet).

    Currently the best source of information is the java web services development pack (JWSDP) 2.0 and its tutorial

    JWSDP 2.0.
    On-line: The Java Web Services Tutorial

    Once you've exhausted the tutorial you can get most of the other information from the various specifications (JSRs).

    Both JAX-WS and JAXB are also featured in the Java EE 5 tutorial:
    Building Web Services with JAX-WS
    Binding between XML Schema and Java Classes
     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: web service class method but with different signatures dont compile