singh gaurav

Ranch Hand
+ Follow
since Mar 28, 2010
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by singh gaurav



this console out put ,
i have created a web service using Axis2, tomcat , and eclipse, when i click http://localhost:8080/MyWebService/services/CreateDomain?wsdl

it gives
HTTP 500 error with following message


My Service class is



i dont understand what is the problem with my code ,"Dear RANCHERS" please suggest me a way to sort out my problem.
13 years ago
yes Bill i got your point........ i will go for command design pattern
13 years ago
@BIll See This CODE
>
13 years ago
@Bill,
Understand my need to call a method in loop, to persist connection .
13 years ago
@William :

Dear William consider a scenario , you have a connection (object- encapsulated a authenticated session) to a server. by using connection object you have to send some commands to server and taking response from server, to make this connection alive ,persists you have to call a method periodical in a infinite loop, in mean time if you want to execute a command by using connection ,you have to stop infinite loop method, and start executing other method using same connection object connection. and when commands are completed you have to recall infinite loop method to make connection alive continuously.

Here my problem is how switch between methods (infinite loop method and other command methods how to stop a infinite loop method by run time argument) i cant use recursion methods,can't call a method inside a method).

Hope you got my point .

Regards
Gaurav
13 years ago
It is possible in java to restrict a definite class loading ,if it is preciously running in a local host machine JVM,
i.e at one time only one process of the class running in JVM.

singh gaurav wrote:import

in this code i have to switch between two methods at run time useClient(int x) and contactInfo(EPPClient xy) at run time.

13 years ago
I am very sorry for not using "[code]" and hope in future it will not happen,

Thanks for your kind response.
Thanks for your response, i think to implement this logic can you justify it
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.openrtk.idl.epprtk.epp_Command;
import org.openrtk.idl.epprtk.epp_Exception;
import org.openrtk.idl.epprtk.epp_Greeting;
import org.openrtk.idl.epprtk.epp_Response;
import org.openrtk.idl.epprtk.epp_Result;
import org.openrtk.idl.epprtk.epp_XMLException;
import org.openrtk.idl.epprtk.contact.epp_ContactInfoReq;
import org.openrtk.idl.epprtk.contact.epp_ContactInfoRsp;
import com.tucows.oxrs.epprtk.rtk.EPPClient;
import com.tucows.oxrs.epprtk.rtk.transport.EPPTransportException;
import com.tucows.oxrs.epprtk.rtk.xml.EPPContactInfo;
public class ClientTest {
static EPPClient my_client;
static int timeout = 1000*60;
static epp_Greeting greeting;
static String epp_host_name = "dfgfds";
static int epp_host_port = df;
static String epp_client_id = "dfg";
static String epp_password = "dgdg";
//Creating EPP Client
public static EPPClient getClient()
{
try
{
my_client = new EPPClient(epp_host_name, epp_host_port, epp_client_id, epp_password);
my_client.setEPPTimeout(timeout);
my_client.setLang("en-US");
greeting = my_client.connectAndGetGreeting();
//my_client.login(epp_client_id,epp_password);
if(greeting != null)
{
System.out.println("Greeting Recieved");
}
else
{
System.out.println("No Greeting Receieved");
}
}
catch ( Exception xcp )
{
System.err.println("Exception! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]");
xcp.printStackTrace();
}

return my_client;
}
public static EPPClient useClient(int x)
{
EPPClient client = getClient();
if(x==1)
{
int i;
System.out.println("Hold Client Alive");
for(i=5;i>0;i++)
{
try
{
client.hello();
greeting = client.connectAndGetGreeting();
Thread.sleep(1000*60); // 1 Min delay
}
catch (InterruptedException ie)
{
System.out.println(ie.getMessage());
} catch (epp_Exception e) {
e.printStackTrace();
} catch (epp_XMLException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (EPPTransportException e) {
e.printStackTrace();
}
if(my_client != null)
{System.out.println("Client Alive");}
}
}
if(x==2)
System.out.println("Returning EPP Client");
return client;

}
public static void contactInfo(EPPClient xy)//2.3.4
{
try
{
xy.login(epp_client_id,epp_password);
epp_Command command_data ;
System.out.println(" EPP Contact INFO command");
String default_contact_id = "OTE-C5";
epp_ContactInfoReq contact_info_request = new epp_ContactInfoReq();
command_data = new epp_Command();
command_data.m_client_trid = getClientTrid(epp_client_id);
contact_info_request.m_cmd = command_data;
contact_info_request.m_id = default_contact_id;
EPPContactInfo contact_info = new EPPContactInfo();
contact_info.setRequestData(contact_info_request);
contact_info = (EPPContactInfo) xy.processAction(contact_info);
epp_ContactInfoRsp contact_info_response = contact_info.getResponseData();
epp_Response response = contact_info_response.m_rsp;
if(response != null)
{
epp_Result[] results = response.m_results;
// epp_AuthInfo contact_auth_info = contact_info_response.m_auth_info;
System.out.println("ContactInfo results: ["+results[0].m_code+"] ["+results[0].m_msg+"]");
System.out.println(" Contact ID: ["+contact_info_response.m_id+"]");
System.out.println(" Contact Name: ["+contact_info_response.m_addresses[0].m_name+"]");
System.out.println(" Contact Organization: ["+contact_info_response.m_addresses[0].m_org+"]");
System.out.println(" Contact Address Street1: ["+contact_info_response.m_addresses[0].m_address.m_street1+"]");
System.out.println(" Contact Address Street2: ["+contact_info_response.m_addresses[0].m_address.m_street2+"]");
System.out.println(" Contact Address City: ["+contact_info_response.m_addresses[0].m_address.m_city+"]");
System.out.println(" Contact Address State/Province: ["+contact_info_response.m_addresses[0].m_address.m_state_province+"]");
System.out.println(" Contact Address Postal Code: ["+contact_info_response.m_addresses[0].m_address.m_postal_code+"]");
System.out.println(" Contact Address Country: ["+contact_info_response.m_addresses[0].m_address.m_country_code+"]");
System.out.println(" Contact Voice: ["+contact_info_response.m_voice.m_value+"]");
System.out.println(" Contact Voice Extension: ["+contact_info_response.m_voice.m_extension+"]");//extension)
System.out.println(" Fax: ["+contact_info_response.m_fax.m_value+":"+contact_info_response.m_fax.m_extension+"]");
System.out.println(" Contact EMail: ["+contact_info_response.m_email+"]");
System.out.println(" Auth INFO: ["+contact_info_response.m_auth_info+"]");
System.out.println("End of the EPP Contact Info command");
System.out.println();
System.out.println("****************"); System.out.println();
}
else
{
System.out.println("No Response For ontact INFO command");
}
}
catch(epp_XMLException xcp)
{
System.err.println("epp_XMLException! ["+xcp.m_error_message+"]");
}
catch ( epp_Exception xcp )
{
System.err.println("epp_Exception!");
epp_Result[] results = xcp.m_details;
System.err.println("\tresults: "+results[0]+"]");
}
catch ( Exception xcp )
{
System.err.println("Contact Info failed! ["+xcp.getClass().getName()+"] ["+xcp.getMessage()+"]");
xcp.printStackTrace();
}

}
protected static String getClientTrid(String epp_client_id)
{
return "ABC:"+epp_client_id+":"+System.currentTimeMillis();
}
public static void main (String []args)
{
System.out.println("Enter your Choice '1'- Hold '2'- Execute Command ");
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int choice =0;
try {
choice =Integer.parseInt( br.readLine());
} catch (IOException ioe) {
System.out.println("IO error !");
System.exit(1);
}
useClient(choice);
EPPClient y = useClient(choice);
contactInfo(y);
}
}


in this code i have to switch between two methods at run time useClient(int x) and contactInfo(EPPClient xy) at run time.
13 years ago
@Bill can i use multithreading to implement this??
13 years ago