Home Answers Viewqa Java-Beginners Java - Web Service

 
 


mydocumentsandmails
Java - Web Service
3 Answer(s)      a year ago
Posted in : Java Beginners

Hi,

I wanted a simple java program for web services development as per below:

------ IN REQUEST ------ <FileName>

FileName - Path of the file (For example: C/text.txt)

------ IN RESPONSE --------

<FileName> <Size> <Type> <ReadAccess> <WriteAccess> <LastModified>

FileName: This should be filename same as input. Size: size of the file in KB. Type: Type of the file i.e. Java File, ..or anything like. ReadAccess and WriteAccess: Boolean - True or false depending upon access rights. LastModified - Timestamp in the format ddMMyyyy'T'hhmmss

Please help me to get this done.

Thanks

View Answers

May 12, 2012 at 5:53 PM


Hi Thanks :)

But I wanted to use this program to create a WSDL file.

I wanted my Web Service request message as

print("<getFileDetailsRequest><file>--Here goes path of a file--</file></getFileDetailsRequest>"); >

Here file is string.


May 12, 2012 at 4:16 PM


The given code allow the user to input file name with path. The code will then determine the size of file, name of file, last modified date of file. It also check whether the given file is readable or writable.

import javax.swing.*;
import java.util.*;
import java.text.*;
import java.io.*;

public class FileOperations{
    public static void main(String[]args){
       File f=new File("c:/data.txt");
       long size=f.length();
       String name=f.getName();
       JFileChooser chooser = new JFileChooser();
       String fileType= chooser.getTypeDescription(f);
       boolean check1=f.canRead();
       boolean check2=f.canWrite();
       long s=f.lastModified();
       Date d=new Date(s);
       SimpleDateFormat sdf=new SimpleDateFormat("dd-MM-yyyy hh:mm:ss");
       String lastmodified=sdf.format(d);

       System.out.println("File Name: "+name);
       System.out.println("File Type: "+fileType);
       System.out.println("Is file Readable: "+check1);
       System.out.println("Is file Writable: "+check2);
       System.out.println("Last Modified Date: "+lastmodified);
    }
}

May 12, 2012 at 6:07 PM


And this request message should return response as

print("<getFileDetailsResponse><fileName>--Name of the file --</fileName><type>--File type--</type><size>--size of the file--</size><isReadable>--boolean--<isReadable><isWritable>--boolean--</isWritable><lastModified>--timestamp--</lastModified></getFileDetailsResponse>");









Related Pages:
Fax service in Java application.
Fax service in Java application.  Hello, I want to develop a Java application to send fax to any destination fax numbers. Anyone who knows about this, please tell how I can do this. Is there any free libraries
Running Java Applications as a Windows Service
Running Java Applications as a Windows Service  sample code for "Run a Java application as a Windows Service
Servlet service method - Java Beginners
Servlet service method  Hi EveryOne , I have a simple... and the other one is normal java class ,What i want to do is that i want to send path... java class) i want to get this path, i wrote the code for stand alone
Doctors Answering Service
Open source forum software in Java/Spring  Open source forum software in Java/Spring
minor project on service center management in core java
minor project on service center management in core java  I need a minor project on service center management in core java...If u have then plz send me
Java Message Service(JMS)
Java Message Service(JMS)       JMS (Java Message Service) is a Java API that allows java... other. Java package "javax.jms" provides JMS api. To use JMS, one
Fed Ex service (tracking number)
Java Application Server  Java Application Server
java program for Denial of Service (DoS) attacks detection - Swing AWT
java program for Denial of Service (DoS) attacks detection  i want a simple program to generate and detect a Denial of Service (DoS) attacks. using java program
Apache Tomcat service error - Java Server Faces Questions
Apache Tomcat service error  Hello Sir,While i am starting the tomcat service i am getting the following error please give me solution. ERROR... information,review the system event log.If this is a non-Microsoft service, contact
Need simple java code to start and stop the remote windows service.
Need simple java code to start and stop the remote windows service.  Hi, I Need simple java code to start and stop the remote windows service... is running on Server A,I want to close that service i.e notepad.exe from my remote
sample jsp-servlet-service-db program
sample jsp-servlet-service-db program  <%@ page language="java...; <%@ page language="java" contentType="text/html; charset...; <%@ page language="java" contentType="text/html; charset=ISO-8859-1
servlet Service
servlet Service  Defined servlet Service
Mobile Software Testing Services, Mobile Application Software Testing Service RoseIndia
mobile software testing according to the type and version of software like Java.... We offer mobile application software testing, mobile software testing service... testing department, can contact to us for getting world class service at most
Mocking a service that calls another service
Mocking a service that calls another service  I have a method, say m1 in class, say C1. Method m1 calls a method, say m2 from another service class, say C2. So I mock m2 in junit test-cases for m1. However, m2 itself calls
unable to open the service tomcat5
unable to open the service tomcat5  While trying to run tomcat server getting "unable to open the service tomcat5" error after installed tomcat
Creating a service - JSP-Servlet
the results.The DAO Is written using Hibernate Then I should create a service which...) to get the data back from the database.(Service is a seperate class not like webservice ect) Can anyone tell me how to create a service.   
creating windows service - RMI
service for this server so that it can start/stop at any time. please help me
What is the default cache service of hibernate?
What is the default cache service of hibernate?  Hi, What is the default cache service of hibernate? Thanks
GPS Mobile Tracking Service
GPS Mobile Tracking Service The mobile tracking system is currently.... In this response, several companies have begin the mobile tracking service... Global Positioning System (GPS) based mobile tracking service at nominal charges
Difference between httpService and Data Service
Difference between httpService and Data Service  Hi.. Please tell me What is the difference between httpService and Data Service? Thanks  Solution: When we use flex Data Services we have to need
OS service via bluetooth socket
OS service via bluetooth socket  through bluetooth socket i want to send instructions to the OS, where i dont want any server code for this on my PC or Laptop. My instructions should be handled by the OS inbuilt bluetooth
Data Service and Query Builder Tool
Data Service and Query Builder Tool       Data Service is more than data manager or data organization, it is data service perspective. It will be able to manage
courier management service (using servlets,jsp,jdbc)
courier management service (using servlets,jsp,jdbc)   is anyone having information about courier management service ? plz share it .its urgent THANKING YOU IN ADVANCE
Service Oriented Architecture
Service Oriented Architecture          Service Oriented Architecture or SOA for short is a new.... In fact service-oriented architecture is collection of many services
clarify bt/w service() and doget/dopost()
clarify bt/w service() and doget/dopost()   Dear friends, i ve question regarding service()and doget/dopost.. the container calls service() where it does the service for the request so then wat is the role of doget/dopost plz
Fleet tracking service
There are many fleet tracking service available in the market one can choose... their fleet and maintaining their security. Fleet tracking service acts, as life... whenever the need be. Fleet tracking service have become the spine of fleet
Java Transaction API
Java Transaction API        JTA is a service-oriented API specification that allows applications... or more networked computer resources. JTA is supposed as the service API used
Service Apartments in Gurgaon
Service Apartments in Gurgaon The city of Gurgaon is one of the upcoming... periods. To provide them with quality accommodation there are some good service... hubs of the city. These service apartments in this high-tech city in the NCR
Java Around the Globe
Java Around the Globe         Sony Ericsson Virtual Lab will provide Java developers an online testing service to test and monitor Java applications
Leading VoIP Service Providers
. The top rated VoIP service providers worldwide are mainly focused at households... service providers which provides the equipments for free. In addition... lower. It has emerged as an top most VoIP service providers due to its excellent
BI: Improving performance in financial service
BI: Improving performance in financial service       FINANCIAL SERVICE INDUSTRY generally includes..., detecting fraud, interpreting transaction pattern and efficient customer service
Java
Java  can we write doget() and service() in same servlet
Java Help Center
Java Help Center       Welcome to Java help Center service of RoseIndia.net, a renowned Java tutorial website that provides you the latest and up
JNDI Context
; Like JDBC (Java Database Connectivity), JNDI is not a service, but a set of interfaces that allows applications to access many different directory service... context that contains the resource (a Java object). The java.naming.Context
GPS Fleet Control Management Service
GPS Fleet Control Management Service A real time GPS Fleet Control Management service plays a crucial role in tracking and controlling assets real time... management service are used in most transportation industries including road
Ask JDBC question online
;    Hurry! In the latest development of enjoying the service...-answer service ‘Ask Question in JDBC’ for all our visitors. Now you.... To offer the quicker and superior service and to resolve the queries regarding
java swings - Java Beginners
java swings  Hi, I have two listboxes.I need to move the lisstbox... listbox. This is my xml code .... jboss.mq:service=DestinationManager jboss.mq:service=SecurityManager
java swings - Java Beginners
java swings   Hi, I already posted the question for three times... code............. jboss.mq:service=DestinationManager jboss.mq:service=SecurityManager
java swings - Java Beginners
java swings  Hi, I have two listboxes.If i select first value................ jboss.mq:service=DestinationManager jboss.mq:service=SecurityManager jboss.mq:service
java swings - Java Beginners
java swings  Hi, I have two listboxes.If i select first value................ jboss.mq:service=DestinationManager jboss.mq:service=SecurityManager jboss.mq:service
Java Naming and Directory Interface (JNDI)
Java Naming and Directory Interface (JNDI)       The Java Naming and Directory Interface (JNDI) is a directory service based API to allow the clients to discover and lookup data
Cheapest Fleet Management Service India
of the cheapest fleet management service to small to large transportation... and most advanced fleet management service solution containing all essential... take our service? The answer is: first look at the characteristics of our fleet
Location Based Service (LBS) in Tourism
Location Based Service (LBS) in Tourism   ... say that it is a service that determines where a mobile device and its user... is the nearby attraction? Where is the nearest service? etc. and the answer
JUnit Factory
JUnit Factory       JUnit Factory is an experimental test-generation service from Agitar.... The problem is that many Java applications are too brittle to extend and enhance
Find Suitable Service Provider, How to Find a Suitable Company for Outsourcing
, there are factors like client satisfaction and good service that have to be considered. There has to be a balance between quality service and pricing. Training cost should... while considering selecting the off shore service provider. Geographically, too
java
java  what is ment by daemon   Java Daemon Threads Daemon threads are like a service providers for other threads or objects running in the same process as the daemon thread. Daemon threads are used for background
java swings - Java Beginners
java swings  Hi, I need how to get the one class textfield....... jboss.mq:service=DestinationManager jboss.mq:service... jboss.mq:service=DestinationManager jboss.mq:service=SecurityManager
Location Based Service (LBS)
Location Based Service (LBS)     ... location based services. So in nutshell, LBS is a wireless service that determines... fleet navigation, emergency service, road navigation and some others where

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.