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 5948541
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:07:19+00:00 2026-05-22T17:07:19+00:00

In the web service I’ve been working on, I’ve been displaying text to the

  • 0

In the web service I’ve been working on, I’ve been displaying text to the screen through methods like so in HTML:

@GET
@Produces(MediaType.TEXT_HTML)
public String sayHtmlHello() 
{
/**Do some stuff
    return "<html> " + "<title>" + "Hello" + "</title>"
            + "<body><h1>" + "Hello World" + "</h1></body></html>";
}

which displays to the screen quite nicely. In order to fit the project description of the project I’m working on, I’ve been working on moving toward an XML output by building a document, transforming it to a string, and returning the string. Using @Produces(MediaType.TEXT_XML) shows the XML tree like I would expect.

My question comes here: I need to be able to pass this XML data on using what the project description calls a Response Content-Type Header of application/xml;charset=UTF-8. So what would I need to do to accomodate using @Produces(MediaType.APPLICATION_XML) instead of @Produces(MediaType.TEXT_XML)?

  • 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-05-22T17:07:20+00:00Added an answer on May 22, 2026 at 5:07 pm

    application/xml is generally the preferred mime type. For text/xml it appears the encoding will generally be treated as us ascii regardless of what is specified in the XML document header (unless otherwise specified in the HTTP headers).

    For More Information:

    • http://www.grauw.nl/blog/entry/489
    • http://www.imc.org/ietf-xml-mime/mail-archive/msg00496.html
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

A web service running in IIS but through a factory doesn't keep up the
I have a web service method where I would like to throw some custom
I have written a web-service (in Java) which produces as a result a (rather
I'm calling web service (my web service) like this: var request = WebRequest.Create(Options.ServerUri +
I have a .NET web service that returns an object and I get an
I am testing a web service with soapUI. One of the responses looks like
Currently I have a web service (WCF) that exposes methods that are set to
if my web service has 5 methods, say method1(), method2(), method3(),method4() and method5(). and
I have a Web service set up using Zend_Soap, and some public methods in
My web service method returns a Page object which includes the following methods: public

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.