Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Forums:

Hi All
I am using IWEB Interface. I am passing a url to IWEB interface.
It is giving 400 error which stands for file not found.
But if I print the usr using DBGPRINTF and then execute it in the url it works finr. any clue
Thanx and regards
Pramod

Ok. What seems to be problem is the WEB_ERROR_PROTOCOL.
What is WEB_ERROR_PROTOCOL ? and where will I get the information regarding this and the particular error related to protocol. What I find is, the problem is length of the string that I am passing as url
Regds
Pramod

Ok. What seems to be problem is the WEB_ERROR_PROTOCOL.
What is WEB_ERROR_PROTOCOL ? and where will I get the information regarding this and the particular error related to protocol. What I find is, the problem is length of the string that I am passing as url
Regds
Pramod

HI All
Even though I am using the UrlEncode Using IWebUtil still I am getting WEB_ERROR_PROTOCOL
Can anybody help me
This is the piece of code
------------------------------------------------------------------------------------
Code:-
---------
char *sfUrl;
char *mCondn;
char *sUrl="http://192.168.100.78/BrwOrgniser/sc.asp?";
char *msisdn="Msi=";
char *mobileno="&Mn=";
char *Name="&N=";
char *Email="&Em=";
char *GName="&GN=";
char *GroupID= "&GID=";
char *HotList="&HL=";
char mfCondn[1024]={0};
char enCodeQS[1024]={0};
int decLen=0;
int encLen=0;
IWebUtil *pWebUtl;
// Create Condition String
if (Brg->m_WebUrl!=NULL)
{
FREE(Brg->m_WebUrl);
Brg->m_WebUrl=NULL;
}
mCondn=(char*)MALLOC(sizeof(msisdn)+sizeof(Brg->msidsn) * sizeof(char));
STRCAT(mCondn,msisdn);
STRCAT(mCondn,Brg->msidsn);
mCondn=(char*)REALLOC(mCondn,sizeof(mobileno)+sizeof(Brg->mobile)+1 * sizeof(char));
STRCAT(mCondn,mobileno);
STRCAT(mCondn,Brg->mobile);
mCondn=(char*) REALLOC(mCondn,sizeof(Name)+sizeof(Brg->Name)+1 *sizeof(char));
STRCAT(mCondn,Name);
STRCAT(mCondn,Brg->Name);
mCondn=(char*)REALLOC(mCondn,sizeof(Email)+sizeof(Brg->email)+1 * sizeof(char));
STRCAT(mCondn,Email);
STRCAT(mCondn,Brg->email);
DBGPRINTF(mCondn);
if (Brg->UsrGroup!=NULL)
{
mCondn=(char*)REALLOC(mCondn,sizeof(GName)+sizeof(Brg->UsrGroup)+1 * sizeof(char));
STRCAT(mCondn,GName);
STRCAT(mCondn,Brg->UsrGroup);
}
else if (Brg->hotlist==1)
{
mCondn=(char*)REALLOC(mCondn,sizeof(HotList)+sizeof("1")+1*sizeof(char));
STRCAT(mCondn,HotList);
STRCAT(mCondn,"1");
DBGPRINTF(mCondn);
}
else
{
mCondn=(char*)REALLOC(mCondn,sizeof(GroupID) + sizeof(Brg->GrpID)+1 *sizeof(char));
STRCAT(mCondn,GroupID);
STRCAT(mCondn,(char*)Brg->GrpID);
}
SPRINTF(mfCondn,"%s",mCondn);
DBGPRINTF(mfCondn);
MEMSET(enCodeQS, 0, sizeof(enCodeQS));
ISHELL_CreateInstance(Brg->a.m_pIShell,AEECLSID_WEBUTIL,(void**)&pWebUtl);
decLen=STRLEN(mfCondn);
encLen=sizeof(enCodeQS);
IWEBUTIL_UrlEncode(pWebUtl,mfCondn,&decLen,enCodeQS,&encLen);
DBGPRINTF(enCodeQS);
sfUrl=(char*)MALLOC((STRLEN(sUrl)+STRLEN(enCodeQS)+1) * sizeof(char));
STRCAT(sfUrl,sUrl);
STRCAT(sfUrl,enCodeQS);
DBGPRINTF(sfUrl);
DBGPRINTF(mfCondn);
ConnectServer(Brg,sfUrl);
*Brg->GrpID and others are char type pointer
------------------------------------------------------------------------------------
sfUrl:http://192.168.100.78/BrwOrgniser/sc.asp?Msi%3D9818307085%26Mn%3D9810245...
it is executing in the browser
Regards
Pramod

HI All
Even though I am using the UrlEncode Using IWebUtil still I am getting WEB_ERROR_PROTOCOL
Can anybody help me
This is the piece of code
------------------------------------------------------------------------------------
Code:-
---------
char *sfUrl;
char *mCondn;
char *sUrl="http://192.168.100.78/BrwOrgniser/sc.asp?";
char *msisdn="Msi=";
char *mobileno="&Mn=";
char *Name="&N=";
char *Email="&Em=";
char *GName="&GN=";
char *GroupID= "&GID=";
char *HotList="&HL=";
char mfCondn[1024]={0};
char enCodeQS[1024]={0};
int decLen=0;
int encLen=0;
IWebUtil *pWebUtl;
// Create Condition String
if (Brg->m_WebUrl!=NULL)
{
FREE(Brg->m_WebUrl);
Brg->m_WebUrl=NULL;
}
mCondn=(char*)MALLOC(sizeof(msisdn)+sizeof(Brg->msidsn) * sizeof(char));
STRCAT(mCondn,msisdn);
STRCAT(mCondn,Brg->msidsn);
mCondn=(char*)REALLOC(mCondn,sizeof(mobileno)+sizeof(Brg->mobile)+1 * sizeof(char));
STRCAT(mCondn,mobileno);
STRCAT(mCondn,Brg->mobile);
mCondn=(char*) REALLOC(mCondn,sizeof(Name)+sizeof(Brg->Name)+1 *sizeof(char));
STRCAT(mCondn,Name);
STRCAT(mCondn,Brg->Name);
mCondn=(char*)REALLOC(mCondn,sizeof(Email)+sizeof(Brg->email)+1 * sizeof(char));
STRCAT(mCondn,Email);
STRCAT(mCondn,Brg->email);
DBGPRINTF(mCondn);
if (Brg->UsrGroup!=NULL)
{
mCondn=(char*)REALLOC(mCondn,sizeof(GName)+sizeof(Brg->UsrGroup)+1 * sizeof(char));
STRCAT(mCondn,GName);
STRCAT(mCondn,Brg->UsrGroup);
}
else if (Brg->hotlist==1)
{
mCondn=(char*)REALLOC(mCondn,sizeof(HotList)+sizeof("1")+1*sizeof(char));
STRCAT(mCondn,HotList);
STRCAT(mCondn,"1");
DBGPRINTF(mCondn);
}
else
{
mCondn=(char*)REALLOC(mCondn,sizeof(GroupID) + sizeof(Brg->GrpID)+1 *sizeof(char));
STRCAT(mCondn,GroupID);
STRCAT(mCondn,(char*)Brg->GrpID);
}
SPRINTF(mfCondn,"%s",mCondn);
DBGPRINTF(mfCondn);
MEMSET(enCodeQS, 0, sizeof(enCodeQS));
ISHELL_CreateInstance(Brg->a.m_pIShell,AEECLSID_WEBUTIL,(void**)&pWebUtl);
decLen=STRLEN(mfCondn);
encLen=sizeof(enCodeQS);
IWEBUTIL_UrlEncode(pWebUtl,mfCondn,&decLen,enCodeQS,&encLen);
DBGPRINTF(enCodeQS);
sfUrl=(char*)MALLOC((STRLEN(sUrl)+STRLEN(enCodeQS)+1) * sizeof(char));
STRCAT(sfUrl,sUrl);
STRCAT(sfUrl,enCodeQS);
DBGPRINTF(sfUrl);
DBGPRINTF(mfCondn);
ConnectServer(Brg,sfUrl);
*Brg->GrpID and others are char type pointer
------------------------------------------------------------------------------------
sfUrl:http://192.168.100.78/BrwOrgniser/sc.asp?Msi%3D9818307085%26Mn%3D9810245...
it is executing in the browser
Regards
Pramod

Hi Kurquhar
I had gone through the link mentioned before. Earlier I was thinking the error is with length of the url. But If I pass the url
like the one mentioned bellow it works fine for me
char* url1="http://192.168.100.78/BrwOrgniser/sC.asp?Msi=9818307085&Mn=9810484212&N=..." ;
*EM:stands for email
Even If I Create a URL (Run TIme) Omiting the email part it gives me the desired result.
Even If I Create URL passing email value withour @ and . then even it works fine for me
"http://192.168.100.78/BrwOrgniser/sC.asp?Msi=9818307085&Mn=9810484212&N=..." ;
But If I Pass a valid email it create a problem for me Even UrlEncode does not work for me
Could any body please help me out of this mess
Thanks and Regards
Pramod

Hi Kurquhar
I had gone through the link mentioned before. Earlier I was thinking the error is with length of the url. But If I pass the url
like the one mentioned bellow it works fine for me
char* url1="http://192.168.100.78/BrwOrgniser/sC.asp?Msi=9818307085&Mn=9810484212&N=..." ;
*EM:stands for email
Even If I Create a URL (Run TIme) Omiting the email part it gives me the desired result.
Even If I Create URL passing email value withour @ and . then even it works fine for me
"http://192.168.100.78/BrwOrgniser/sC.asp?Msi=9818307085&Mn=9810484212&N=..." ;
But If I Pass a valid email it create a problem for me Even UrlEncode does not work for me
Could any body please help me out of this mess
Thanks and Regards
Pramod

Quote:Originally posted by samalPramod
But If I Pass a valid email it create a problem for me Even UrlEncode does not work for me
The '@' character is reserved in URLs for authentication and must be URL encoded when it appears elsewhere.
How much of the URL are you trying to encode? What needs to be encoded is what comes after the '?'.

Quote:Originally posted by samalPramod
But If I Pass a valid email it create a problem for me Even UrlEncode does not work for me
The '@' character is reserved in URLs for authentication and must be URL encoded when it appears elsewhere.
How much of the URL are you trying to encode? What needs to be encoded is what comes after the '?'.

Hi
I am encoding after ? mark and even I am getting the desired url
If I used that url in browser it works for me and returns the result , but brew does not. The Url is some what like the one mention bellow
char * url1="http://192.168.100.78/BrwOrgniser/sc.asp?Msi%3D9818307085%26Mn%3D9818307...";
It still gives me the same 400 error mentioned earlier
If u find a solution please help
Regards
Pramod

Hi
I am encoding after ? mark and even I am getting the desired url
If I used that url in browser it works for me and returns the result , but brew does not. The Url is some what like the one mention bellow
char * url1="http://192.168.100.78/BrwOrgniser/sc.asp?Msi%3D9818307085%26Mn%3D9818307...";
It still gives me the same 400 error mentioned earlier
If u find a solution please help
Regards
Pramod

Do you have access to the server? A TCP packet dump would likely shed some light on why the server does not like the request.

Do you have access to the server? A TCP packet dump would likely shed some light on why the server does not like the request.

Hi Kurquhar
I have access to the server. If I am passing the url hardcoded, that I am getting form brew using DBGPRINTF, it works fine for me and gives the desired result. But If I am generating it dynamically then and then try to get response using brew it gives me 400 error.
URL Like this
char * url1="http://192.168.100.78/BrwOrgniser/sc.asp? Msi%3D9818307085%26Mn%3D9818307085%26N%3DNavaneet%
26Em%3DNv%40brew.com%26HL%3D1"
and URL like this
char* url1="http://192.168.100.78/BrwOrgniser/sC.asp?Msi=9818307085&Mn=9810484212&N=..."
both works fine for me if it is hard coded and gives the desired result through brew
Regards
Pramod

Hi Kurquhar
I have access to the server. If I am passing the url hardcoded, that I am getting form brew using DBGPRINTF, it works fine for me and gives the desired result. But If I am generating it dynamically then and then try to get response using brew it gives me 400 error.
URL Like this
char * url1="http://192.168.100.78/BrwOrgniser/sc.asp? Msi%3D9818307085%26Mn%3D9818307085%26N%3DNavaneet%
26Em%3DNv%40brew.com%26HL%3D1"
and URL like this
char* url1="http://192.168.100.78/BrwOrgniser/sC.asp?Msi=9818307085&Mn=9810484212&N=..."
both works fine for me if it is hard coded and gives the desired result through brew
Regards
Pramod

so it works if its hard coded, but not dynamic?
sounds like they are not generating the same urls.
try again accessing the same url hard coded and dynamic, then check your server logs to see if the urls are the same (they probably arent).
-Tyndal

so it works if its hard coded, but not dynamic?
sounds like they are not generating the same urls.
try again accessing the same url hard coded and dynamic, then check your server logs to see if the urls are the same (they probably arent).
-Tyndal

Hi
The Url I am passing hard coded is generated dynamically. I used to print the url generated dynamically and use that url for hardcode. In this case the url generated dynamically, if passed hard coded returns the result while the url it self not and returns 400 error i.e WEB_ERROR_PROTOCOL.
Regards
Pramod

Hi
The Url I am passing hard coded is generated dynamically. I used to print the url generated dynamically and use that url for hardcode. In this case the url generated dynamically, if passed hard coded returns the result while the url it self not and returns 400 error i.e WEB_ERROR_PROTOCOL.
Regards
Pramod

The URL must remain in scope until the callback occurs. This means it can not be declared on the stack, nor can it be freed before the callback.
In your original code post, it looks like you use MALLOC for the URL, but since the pointer is on the stack, you are likely FREE'ing it right after calling IWEB_GetResponse()? If so, you need to store the pointer in your app context, and then FREE it in the callback.

The URL must remain in scope until the callback occurs. This means it can not be declared on the stack, nor can it be freed before the callback.
In your original code post, it looks like you use MALLOC for the URL, but since the pointer is on the stack, you are likely FREE'ing it right after calling IWEB_GetResponse()? If so, you need to store the pointer in your app context, and then FREE it in the callback.

Thankx Kurquhar
I got the error. The problem is with that I am freeing the url just after the function I am calling for getting response.
Thanks
Regards
Pramod

Thankx Kurquhar
I got the error. The problem is with that I am freeing the url just after the function I am calling for getting response.
Thanks
Regards
Pramod