Patient Source Code
Patient Source Code
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package login;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebService;
import java.sql.*;
import java.util.Date;
import java.net.*;
/**
*
* @author Easter
*/
@WebService()
public class patient {
/**
* Web service operation
*/
@WebMethod(operationName = "getPatientInfo")
public String getPatientInfo(@WebParam(name = "User")
String User, @WebParam(name = "Pid")
String Pid)
{
String result="";
int flag=0;
try
{
String ss1[]=Pid.split("@");
Pid=ss1[0];
String sn=ss1[1];
String clip=ss1[2];
System.out.println("Comes in Patient Service");
String
addr[]=InetAddress.getLocalHost().toString().split("/");
System.out.println("Client Address : "+ss1[2]);
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection
con=DriverManager.getConnection("jdbc:odbc:LocalServer");
Statement st=con.createStatement();
st.executeUpdate("use RemoteService");
}
}
// con.close();
rs.close();
System.out.println("Flag : "+flag);
if(flag==1)
{
rs=st.executeQuery("select * from Patient where
PatientId='"+Pid+"'");
if(rs.next())
{
result=rs.getString(1)+"#"+rs.getString(2)+"#"+rs.getString(3);
}
else
{
result="Invalid Patient Id" ;
}
}
else
{
result="You are Not Allowed to Access This service at
this time";
}
System.out.println("Result : "+result);
}
catch(Exception e)
{
System.out.println(e);
}
//TODO write your implementation code here:
return result;
}