Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 4.0

The good thing here is that the client does not have to know about the Book class. It is automatically generated during the proxy creation time and can be used by your client. Here it is located in the defaultnamespace package since no package was used on the server side.

Here is how the client looks like now:

Code Block

def proxy = new WSClient("http://localhost:6981/BookService?wsdl", this.class.classLoader)
proxy.initialize() // from 0.5.0

def books =  proxy.getBooks()

for (book in books) println book

def book = proxy.create("defaultnamespace.Book")

book.title = "Groovy in Action" = "Dierk"
book.isbn = "123"


def bks =  proxy.getBooks()

println bks.books[0].isbn

Iterating over the books is slightly more complicated since SOAP wrap the arrays in an element (in our case ArrayOfBook). Therefore you have to extract a field from that element. In our case:

Code Block
def aob =  proxy.getBooks()

for (book in aob.books) println