Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7876603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:11:32+00:00 2026-06-03T03:11:32+00:00

I am creating a Grails application that has read-only access to a web service

  • 0

I am creating a Grails application that has read-only access to a web service that returns XML. Other than a username/password, the entirety of the data for this application will come from this external web service.

What is the best way to map variables in my domain classes to this data source? I have found many examples for custom ORM with a database, but none for XML. Where would I write the logic to make the HTTP call and extract the fields?

Any and all help is greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:11:33+00:00Added an answer on June 3, 2026 at 3:11 am

    We are very successfully using spring web services with MarkupBuilder/XmlSlurper. You can use the WebServiceTemplate to create a web service client to a given Uri, and send your request via an XML built with MarkupBuilder.

    This has the big advantage for us to keep the WSDL as the central description of the interface, as a documentation artifact, no code generation and generated code to maintain, no annotations to add for jaxb bindings, no data objects.

    We don’t use domain classes, we use the GPathResult obtained by slurping the XML result of the web service invocation directly, because in a duck-typing kind of way it is equivalent for the client to java objects. However, we don’t have a web interface. If you have a web interface, I would create Command Objects with a

    def toXml(MarkupBuilder b) {
    }
    

    method, or maybe

    myCommandObject as XML 
    

    would work, depending on your wsdl’s XSD schema. this way you take advantage of grails data binding and validation.

    For the view’s data models, maybe passing a duck-type of the command object (compatible XML object) is enough, so you don’t have to marshall both ways.

    Another caveat is that the current version of the grails spring-ws plugin is out of date. I don’t event think it will play well with grails 2.0 because of old spring-security-core classes in ther. The good news is that if you’re only building a client, you hardly need the plugin at all. Just include the most recent spring web services jar and use the WebServiceTemplate.sendToEndpoint method.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am creating an application in grails that should read from one database and
I am creating one web application in GRAILS framework.In that I want to implement
I'm creating a DB web application with grails for my company and found myself
I'm developing a Grails web application (mainly as a learning exercise). I have previously
We have developed a Web Application using grails, groovy and oracle as database with
I'm creating a REST service in Grails to accept data from a python script.
I have an application that uses the grails multi-tenant-core plug-in to host multiple versions
I am developing a web based application in Grails. I have come across a
I am creating an application using Grails Framework for which I plan to use
I am creating a new Grails project that uses some Java code to do

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.