Can't track the bug ,while creating user for domain through external API?

I am developing an application which is creating domains through an external API,

but there is problem when i create user through this API..

It sometimes works fine sometimes not..

there is no problem with the API i gues..

URL u=null;

HttpURLConnection=null;

int code=0;

boolean blnOK=false;

strUrl="http://externaldomain.net/domain/admin?pwd=admpassword&action=user_createdomain&domain=mynewdomain.domain.net&adminpassword=anypassword&diskquota=4522;

u=new URL(strUrl);

uc=(HttpURLConnection)u.openConnection();

code=uc.getResponseCode();

if(code == 200){

redirectUrl="DomainCreationComplete.jsp";

blnOK=true;

}else{

redirectUrl="DomainCreationError.jsp";

}

if(blnOK){

String strUrlUser="http://externaldomain.net/domain/admin?pwd=admpassword&action=user_createuser&username=mynewuser&password=myuserpassword&domain=mynewdomain.domain.net&communityname=Default&firstname=John&lastname=Doe;

URL u1=new URL(strUrlUser);

HttpURLConnectionuc1=(HttpURLConnection)u1.openConnection();

code=uc1.getResponseCode();

response1=uc1.getResponseMessage();

if(code == 200){

redirectUrl="/DomaincreationComplete.jsp";

}

}else{

redirectUrl="DomainCreationError.jsp";

}

}

[2231 byte] By [Jasdeep.Singha] at [2007-10-3 3:05:27]
# 1

HttpURLConnection=null;

does this compile.

Did not find any other problem with your code but you seems not encoding the parameters before sending.

Use the java.net.URLEncoder to encode the paameter names and values in the querystring. Otherwise there might be problems when sending special characters and spaces.

Probably the problem is in the servelet or what ever the code is executed at http://externaldomain.net/domain/admin

so can you post its code for us to take a look

LRMKa at 2007-7-14 20:55:32 > top of Java-index,Core,Core APIs...