RSS feed

JSP Web Services Example - XML, XSLT in JSP - XML Web Services in Java

Published by: San (9/19/2007)

SEP 19 2007

I am trying to code a web service for remote server to write out little information. Can you help me in finding an example of jsp web services? I am trying to use the xml response as the requesting server is going to parse the information and publish it the user. Please help me in finding a jsp web services using xml.

Web services are way better than writing a separate application or connecting a remote database to get some information. Parsing the information in the form of xml is the most standard way maintained in the web world. This article describes to code a web service using jsp pages.

<% response.setContentType("text/xml"); %>
<% response.setCharacterEncoding("UTF-8"); %>
<myco:JSPWebService
xmlns:myco="http://www.softcomptools.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.softcomptools.com" >
<% // variable declared and initiated for this web service application
String WebServices = "xml";
%> <Header><![CDATA[
This is an example of jsp web service for <%=WebServices%> data.
]]></Header>
</myco:JSPWebService>

Here you can add or ![CDATA[, by adding this tag you can make sure the data is being transmitted even it is not in xml format. On needed the xml data is being parsed to get the optimal result.

This code is debugged and works fine, if you find any problem or error on running this script then post your comment here.

 

Sample Codes for Sending Emails from JSP Page Using Gmail >>

<< How to Email from JSP Page?

 

COMMENT

*Name:
*Comment:
You can use HTML tags here.
*Code: Please enter the sum of 5+2