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

  • Home
  • SEARCH
  • 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 5973591
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:49:17+00:00 2026-05-22T20:49:17+00:00

I am writing a simple web service on java, that should read an xml

  • 0

I am writing a simple web service on java, that should read an xml file and generate a string for result. I am, however, at loss as to:

a) where should xml file be placed in the file system for it to be accessible to web service?

b) what would the relative way to the file from the service

c) alternatelyt, how can i add xml file to the project, so that it would be deployed along with web service

I am using NetBeans as IDE and maven as a build system.

  • 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-22T20:49:18+00:00Added an answer on May 22, 2026 at 8:49 pm

    Usually I provide a resource-bundle (.jar) in my web application. If the file should not be modified during runtime, this should be the best way to access it. This will be c) in your question. There you can access the file with:

    ClassLoader cl = this.getClass().getClassLoader();
    InputStream is = cl.getResourceAsStream("resourceName");
    

    "resourceName" will be the path inside the jar file. I you are packaging with Maven, everything in src/main/webapp/WEB-INF/classes will be available in your classpath and can be loaded with getResourceAsStream.


    An alternative way with maven is to create a new module and place all required resources in src/main/resources and then add a dependency to this artifact in your webapp pom.

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

Sidebar

Related Questions

I am writing an app that’s a very simple web service client. I have
I am writing a simple rails app that caches values from a web service.
I'm writing a very simple web service, written in Python and run as CGI
I'm writing a simple web app in PHP that needs to have write access
I am writing a simple Python web application that consists of several pages of
I'm writing a simple Google Web Toolkit service which acts as a proxy, which
I'm writing an ASP.NET web service using C# that has a DoLookup() function. For
I've been tasked with writing a web service that can be called from one
I'm writing a Python module that wraps out a certain web service API. It's
I am writing a simple proof-of-concept web service using ASP.NET MVC3 controller with JSON

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.