• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Piet Souris
  • Carey Brown
  • Stephan van Hulst
Bartenders:
  • Frits Walraven
  • fred rosenberger
  • salvin francis

Generating API dynamically from WSDL

 
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

If i am correct, Axis API let you map a XML class description (from the WSDL) to the corresponding java class. But this java class must be on client side first, therefore we lost the dynamic part of it.

Hence, i would like to know if generating a JAVA API from a WSDL and invoking the methods of the generated API is actually possible.
[ May 25, 2004: Message edited by: Yann Emeraud ]
 
author and deputy
Posts: 3150
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Yann Emeraud:
But this java class must be on client side first, therefore we lost the dynamic part of it.


Can you explain this sentence more further ?
Actually Axis with the tool called WSDL2Java can generate stubs(java client codes) for a given WSDL URL/file. Now you can use this generated client java code to call the webservices methods.
The generated client codes(stubs or proxy) will have necessary properties and methods which can be used from your servlet/jsp/java code.
 
Yann Emeraud
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


Axis with the tool called WSDL2Java can generate stubs



I need a client capable
  • to show all the operations hold by a WSDL file given during execution time
  • to execute each of them.

  • Therefore a stub cannot help but the DII can do the job.


    Originally posted by Yann Emeraud:
    But this java class must be on client side first, therefore we lost the dynamic part of it.

    Can you explain this sentence more further ?


    If a new operation taking a custom Complex Type (let s say MyBook.java) is added to the server, i don t want to "manually" add the related class binarie (MyBook.class) to all the clients (i.e to patch them everytime i update the server).

    Client should be able to generate dynamically the needed binaries from WSDL.

    I hope this makes me more clear.
    [ May 25, 2004: Message edited by: Yann Emeraud ]
     
    author
    Posts: 11962
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Yann Emeraud:
    Client should be able to generate dynamically the needed binaries from WSDL.

    Why isn't DII enough?

    If you really need to generate the "binaries" (.class files) dynamically when the WSDL changes, I guess you could parse the WSDL document with WSDL4J and use some bytecode manipulation API such as ASM, BCEL, Javassist, etc. to generate the .class files.
     
    Lasse Koskela
    author
    Posts: 11962
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Yann Emeraud:
    If a new operation taking a custom Complex Type (let s say MyBook.java) is added to the server, i don t want to "manually" add the related class binarie (MyBook.class) to all the clients (i.e to patch them everytime i update the server).


    By the way, if you only add an operation, the clients don't need to change unless they suddenly need to use that new operation.
     
    Yann Emeraud
    Greenhorn
    Posts: 15
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    By the way, if you only add an operation, the clients don't need to change unless they suddenly need to use that new operation.



    In fact, the purpose of my client is to let the user execute any operation hold by the server at any moment.

    And several new operations are supposed to be added very often to the server.

    This is the problem
    [ May 26, 2004: Message edited by: Yann Emeraud ]
     
    Lasse Koskela
    author
    Posts: 11962
    5
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator

    Originally posted by Yann Emeraud:
    In fact, the purpose of my client is to let the user execute any operation hold by the server at any moment.


    How would the client know how to use one of the new operations?
    If the operation's signature is, for example, doSomethingNew(String, String, int), what will the client code pass in as parameters?
     
    Yann Emeraud
    Greenhorn
    Posts: 15
    • Mark post as helpful
    • send pies
      Number of slices to send:
      Optional 'thank-you' note:
    • Quote
    • Report post to moderator


    If the operation's signature is, for example, doSomethingNew(String, String, int), what will the client code pass in as parameters



    The client parse the WSDL file, retrieve the number of parameters and show the same number of inputBoxes for a selected operation.
    It cast whenever it is needed.
    And show the answer with a String.

    Reading the doSomethingNew specification, it will show 3 boxes and cast the input to String String and int respectively.

    The client knows that some Complex types may be passed as parameters (e.g MyBook.java with 2 fields name and id).

    If the Complex Types are update by server, i would like to see the client generating the relative binaries only by reading the WSDL file.

    If that is possible.
    [ May 26, 2004: Message edited by: Yann Emeraud ]
     
    You showed up just in time for the waffles! And this tiny ad:
    Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    reply
      Bookmark Topic Watch Topic
    • New Topic