Bookmark this site here
Tested on Firefox and IE. Please comment if you face any run-time or javascript errors with your favourite browser.
Sunday, April 30, 2006
Friday, April 14, 2006
Online tutorial to learn Web Services in Java
http://java.sun.com/webservices/docs/1.5/tutorial/doc/index.html
The above is a guide to developing Web applications with the Java Web Services Developer Pack (Java WSDP).
Sun's Application Server needs to be used in here to implement the examples.
The tutorials covers various things like
-The Java API for XML Processing (JAXP)
-The Java API for XML-based RPC (JAX-RPC)
-SOAP with Attachments API for Java (SAAJ)
-The Java API for XML Registries (JAXR)
Best part of this is -- all examples are available for download . Hardly any work is needed to get the simple examples working.
Worst part is --various jargons are in place like SAX(Simple API for XML), DCOM(Document Object Model) . These are XML processing models.
This link is a good starting point to parse XML documents using a SAX parser in Java.
The above is a guide to developing Web applications with the Java Web Services Developer Pack (Java WSDP).
Sun's Application Server needs to be used in here to implement the examples.
The tutorials covers various things like
-The Java API for XML Processing (JAXP)
-The Java API for XML-based RPC (JAX-RPC)
-SOAP with Attachments API for Java (SAAJ)
-The Java API for XML Registries (JAXR)
Best part of this is -- all examples are available for download . Hardly any work is needed to get the simple examples working.
Worst part is --various jargons are in place like SAX(Simple API for XML), DCOM(Document Object Model) . These are XML processing models.
This link is a good starting point to parse XML documents using a SAX parser in Java.
Friday, April 07, 2006
Pick up code for sending mail in Java
////Use Java 1.3 and above
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
/**
* A simple email sender class.
*/
public class SimpleSender
{
public static void main(String args[])
{
try
{
*************Change the smtpServer name ***************************
String smtpServer="mySMTP";//Use the respective smtpServer name
String to="shantanu.gg@gmail.com";
String from="shantanu.gg@gmail.com";
String subject="Please work";
String body="Consider urself lucky";
send(smtpServer, to, from, subject, body);
}
catch (Exception ex)
{
System.out.println("Usage:"
+" smtpServer toAddress fromAddress subjectText bodyText");
}
System.exit(0);
}
public static void send(String smtpServer, String to, String from
, String subject, String body)
{
try
{
Properties props = System.getProperties();
// -- Attaching to default Session, or we could start a new one --
props.put("mail.smtp.host", smtpServer);
Session session = Session.getDefaultInstance(props, null);
// -- Create a new message --
Message msg = new MimeMessage(session);
// -- Set the FROM and TO fields --
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
// -- We could include CC recipients too --
// if (cc != null)
// msg.setRecipients(Message.RecipientType.CC
// ,InternetAddress.parse(cc, false));
// -- Set the subject and body text --
msg.setSubject(subject);
msg.setText(body);
// -- Set some other header information --
msg.setHeader("X-Mailer", "MyMail");
msg.setSentDate(new Date());
// -- Send the message --
Transport.send(msg);
System.out.println("Message sent OK.");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
import javax.mail.*;
import javax.mail.internet.*;
import java.util.*;
/**
* A simple email sender class.
*/
public class SimpleSender
{
public static void main(String args[])
{
try
{
*************Change the smtpServer name ***************************
String smtpServer="mySMTP";//Use the respective smtpServer name
String to="shantanu.gg@gmail.com";
String from="shantanu.gg@gmail.com";
String subject="Please work";
String body="Consider urself lucky";
send(smtpServer, to, from, subject, body);
}
catch (Exception ex)
{
System.out.println("Usage:"
+" smtpServer toAddress fromAddress subjectText bodyText");
}
System.exit(0);
}
public static void send(String smtpServer, String to, String from
, String subject, String body)
{
try
{
Properties props = System.getProperties();
// -- Attaching to default Session, or we could start a new one --
props.put("mail.smtp.host", smtpServer);
Session session = Session.getDefaultInstance(props, null);
// -- Create a new message --
Message msg = new MimeMessage(session);
// -- Set the FROM and TO fields --
msg.setFrom(new InternetAddress(from));
msg.setRecipients(Message.RecipientType.TO,
InternetAddress.parse(to, false));
// -- We could include CC recipients too --
// if (cc != null)
// msg.setRecipients(Message.RecipientType.CC
// ,InternetAddress.parse(cc, false));
// -- Set the subject and body text --
msg.setSubject(subject);
msg.setText(body);
// -- Set some other header information --
msg.setHeader("X-Mailer", "MyMail");
msg.setSentDate(new Date());
// -- Send the message --
Transport.send(msg);
System.out.println("Message sent OK.");
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
}
Subscribe to:
Posts (Atom)