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

Developer

Forums

Forums:

hi!!

i m sending a http post request to my server. below is the code written for http post.
the prob is the request hits the server but, the WEBOPT_BODY buffer sent with the request is not received at the server.
could any 1 pls help me identify the prob.

i have also tried sending the ISource with WEBOPT_BODY...
all suggestions are welcome..

-Pribhi

{
ISourceUtil *pisu;
MIApp * pApp = pwa->pParent;
short len;

pwa->pszPostData = pApp->m_pszURL ;
len = STRLEN(pApp->m_pszURL );

if ((char *)0 != pwa->pszPostData) {
if ( SUCCESS ==
ISHELL_CreateInstance( pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
( void ** )&pisu ) ) {
if( ISOURCEUTIL_PeekFromMemory( pisu, pwa->pszPostData ,
len, NULL, NULL,
&pwa->pipPostData ) == SUCCESS)
{
DBGPRINTF("success");
}
else
DBGPRINTF("no success");
ISOURCEUTIL_Release( pisu );
}
}

CALLBACK_Init( &pwa->cb, WebAction_GotResp, pwa );
pwa->uStart = GETUPTIMEMS();

if ((IPeek *)0 != pwa->pipPostData) {
IWEB_GetResponse( pApp->m_pIWeb,
( pApp->m_pIWeb, &pwa->piWResp, &pwa->cb, "http://192.168.2.28:8080/App/Servlet",
WEBOPT_HANDLERDATA, pwa,
WEBOPT_HEADER, "X-Method: POST\r\n" ,//pApp->header,
WEBOPT_HEADERHANDLER, WebAction_Header,
WEBOPT_METHOD, "POST",
WEBOPT_BODY, pwa->pipPostData ,
WEBOPT_CONTENTLENGTH, len,
WEBOPT_END ));
}
else
DBGPRINTF("#####################");

}

pribhi wrote:hi!!
i m sending a http post request to my server. below is the code written for http post.
the prob is the request hits the server but, the WEBOPT_BODY buffer sent with the request is not received at the server.
could any 1 pls help me identify the prob.
i have also tried sending the ISource with WEBOPT_BODY...
all suggestions are welcome..
-Pribhi
{
ISourceUtil *pisu;
MIApp * pApp = pwa->pParent;
short len;
pwa->pszPostData = pApp->m_pszURL ;
len = STRLEN(pApp->m_pszURL );
if ((char *)0 != pwa->pszPostData) {
if ( SUCCESS ==
ISHELL_CreateInstance( pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
( void ** )&pisu ) ) {
if( ISOURCEUTIL_PeekFromMemory( pisu, pwa->pszPostData ,
len, NULL, NULL,
&pwa->pipPostData ) == SUCCESS)
{
DBGPRINTF("success");
}
else
DBGPRINTF("no success");
ISOURCEUTIL_Release( pisu );
}
}
CALLBACK_Init( &pwa->cb, WebAction_GotResp, pwa );
pwa->uStart = GETUPTIMEMS();
if ((IPeek *)0 != pwa->pipPostData) {
IWEB_GetResponse( pApp->m_pIWeb,
( pApp->m_pIWeb, &pwa->piWResp, &pwa->cb, "http://192.168.2.28:8080/App/Servlet",
WEBOPT_HANDLERDATA, pwa,
WEBOPT_HEADER, "X-Method: POST\r\n" ,//pApp->header,
WEBOPT_HEADERHANDLER, WebAction_Header,
WEBOPT_METHOD, "POST",
WEBOPT_BODY, pwa->pipPostData ,
WEBOPT_CONTENTLENGTH, len,
WEBOPT_END ));
}
else
DBGPRINTF("#####################");
}
len = STRLEN(pApp->m_pszURL ); ...
may be this code change needed?
if ((char *)0 != pwa->pszPostData) {
len=STRLEN(pwa->pszPostData);
if ( SUCCESS ==
ISHELL_CreateInstance( pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
( void ** )&pisu ) ) {
if( ISOURCEUTIL_PeekFromMemory( pisu, pwa->pszPostData ,
len, NULL, NULL,
&pwa->pipPostData ) == SUCCESS)
{
DBGPRINTF("success");
}
else
DBGPRINTF("no success");
ISOURCEUTIL_Release( pisu );
}
}
len=STRLEN(), not a len=STRLEN().

pribhi wrote:hi!!
i m sending a http post request to my server. below is the code written for http post.
the prob is the request hits the server but, the WEBOPT_BODY buffer sent with the request is not received at the server.
could any 1 pls help me identify the prob.
i have also tried sending the ISource with WEBOPT_BODY...
all suggestions are welcome..
-Pribhi
{
ISourceUtil *pisu;
MIApp * pApp = pwa->pParent;
short len;
pwa->pszPostData = pApp->m_pszURL ;
len = STRLEN(pApp->m_pszURL );
if ((char *)0 != pwa->pszPostData) {
if ( SUCCESS ==
ISHELL_CreateInstance( pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
( void ** )&pisu ) ) {
if( ISOURCEUTIL_PeekFromMemory( pisu, pwa->pszPostData ,
len, NULL, NULL,
&pwa->pipPostData ) == SUCCESS)
{
DBGPRINTF("success");
}
else
DBGPRINTF("no success");
ISOURCEUTIL_Release( pisu );
}
}
CALLBACK_Init( &pwa->cb, WebAction_GotResp, pwa );
pwa->uStart = GETUPTIMEMS();
if ((IPeek *)0 != pwa->pipPostData) {
IWEB_GetResponse( pApp->m_pIWeb,
( pApp->m_pIWeb, &pwa->piWResp, &pwa->cb, "http://192.168.2.28:8080/App/Servlet",
WEBOPT_HANDLERDATA, pwa,
WEBOPT_HEADER, "X-Method: POST\r\n" ,//pApp->header,
WEBOPT_HEADERHANDLER, WebAction_Header,
WEBOPT_METHOD, "POST",
WEBOPT_BODY, pwa->pipPostData ,
WEBOPT_CONTENTLENGTH, len,
WEBOPT_END ));
}
else
DBGPRINTF("#####################");
}
len = STRLEN(pApp->m_pszURL ); ...
may be this code change needed?
if ((char *)0 != pwa->pszPostData) {
len=STRLEN(pwa->pszPostData);
if ( SUCCESS ==
ISHELL_CreateInstance( pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
( void ** )&pisu ) ) {
if( ISOURCEUTIL_PeekFromMemory( pisu, pwa->pszPostData ,
len, NULL, NULL,
&pwa->pipPostData ) == SUCCESS)
{
DBGPRINTF("success");
}
else
DBGPRINTF("no success");
ISOURCEUTIL_Release( pisu );
}
}
len=STRLEN(), not a len=STRLEN().

Dmitry V. Zhada wrote:len = STRLEN(pApp->m_pszURL ); ...
may be this code change needed?
if ((char *)0 != pwa->pszPostData) {
len=STRLEN(pwa->pszPostData);
if ( SUCCESS ==
ISHELL_CreateInstance( pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
( void ** )&pisu ) ) {
if( ISOURCEUTIL_PeekFromMemory( pisu, pwa->pszPostData ,
len, NULL, NULL,
&pwa->pipPostData ) == SUCCESS)
{
DBGPRINTF("success");
}
else
DBGPRINTF("no success");
ISOURCEUTIL_Release( pisu );
}
}
len=STRLEN(), not a len=STRLEN().
How to get ..because i get problems to when use WEB_OPT "POST"..thanks

Dmitry V. Zhada wrote:len = STRLEN(pApp->m_pszURL ); ...
may be this code change needed?
if ((char *)0 != pwa->pszPostData) {
len=STRLEN(pwa->pszPostData);
if ( SUCCESS ==
ISHELL_CreateInstance( pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
( void ** )&pisu ) ) {
if( ISOURCEUTIL_PeekFromMemory( pisu, pwa->pszPostData ,
len, NULL, NULL,
&pwa->pipPostData ) == SUCCESS)
{
DBGPRINTF("success");
}
else
DBGPRINTF("no success");
ISOURCEUTIL_Release( pisu );
}
}
len=STRLEN(), not a len=STRLEN().
How to get ..because i get problems to when use WEB_OPT "POST"..thanks

It is stream/data you want to post. What specific issues you have?

It is stream/data you want to post. What specific issues you have?

i want post data...
i use code like example net diagnosis..
pwa->pszPostData = STRCHR(pszUrl, 1);
// if there's post data, construct a stream for IWeb to consume
if ((char *)0 != pwa->pszPostData) {
*pwa->pszPostData = 0;
if (SUCCESS ==
ISHELL_CreateInstance(pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
(void **)&pisu)) {
ISOURCEUTIL_PeekFromMemory(pisu, pwa->pszPostData + 1,
STRLEN(pwa->pszPostData + 1), 0, 0,
&pwa->pipPostData);
ISOURCEUTIL_Release(pisu);
}
}
if ((IPeek *)0 != pwa->pipPostData) {
IWEB_GetResponse(pApp->m_pIWeb,
(pApp->m_pIWeb, &pwa->piWResp, &pwa->cb, pszUrl,
WEBOPT_HANDLERDATA, pwa,
WEBOPT_HEADER, "X-Method: POST\r\n", /* for kicks */
WEBOPT_HEADERHANDLER, WebAction_Header,
WEBOPT_STATUSHANDLER, WebAction_Status,
WEBOPT_METHOD, "POST",
WEBOPT_BODY, pwa->pipPostData,
WEBOPT_CONTENTLENGTH, STRLEN(pwa->pszPostData + 1),
WEBOPT_END));
} else {
IWEB_GetResponse(pApp->m_pIWeb,
(pApp->m_pIWeb, &pwa->piWResp, &pwa->cb, pszUrl,
WEBOPT_HANDLERDATA, pwa,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_HEADERHANDLER, WebAction_Header,
WEBOPT_STATUSHANDLER, WebAction_Status,
WEBOPT_END));
}
and in PHP i use
Tes Post:
echo " POST : \"" .$_POST[""aa""].""\"" and \"""".$_POST[""bb""].""\"""";
and when open empty..data aa and bb that submit not sent..
and when i debug..pwa->pszPostData is always empty..
thanks"

i want post data...
i use code like example net diagnosis..
pwa->pszPostData = STRCHR(pszUrl, 1);
// if there's post data, construct a stream for IWeb to consume
if ((char *)0 != pwa->pszPostData) {
*pwa->pszPostData = 0;
if (SUCCESS ==
ISHELL_CreateInstance(pApp->a.m_pIShell,AEECLSID_SOURCEUTIL,
(void **)&pisu)) {
ISOURCEUTIL_PeekFromMemory(pisu, pwa->pszPostData + 1,
STRLEN(pwa->pszPostData + 1), 0, 0,
&pwa->pipPostData);
ISOURCEUTIL_Release(pisu);
}
}
if ((IPeek *)0 != pwa->pipPostData) {
IWEB_GetResponse(pApp->m_pIWeb,
(pApp->m_pIWeb, &pwa->piWResp, &pwa->cb, pszUrl,
WEBOPT_HANDLERDATA, pwa,
WEBOPT_HEADER, "X-Method: POST\r\n", /* for kicks */
WEBOPT_HEADERHANDLER, WebAction_Header,
WEBOPT_STATUSHANDLER, WebAction_Status,
WEBOPT_METHOD, "POST",
WEBOPT_BODY, pwa->pipPostData,
WEBOPT_CONTENTLENGTH, STRLEN(pwa->pszPostData + 1),
WEBOPT_END));
} else {
IWEB_GetResponse(pApp->m_pIWeb,
(pApp->m_pIWeb, &pwa->piWResp, &pwa->cb, pszUrl,
WEBOPT_HANDLERDATA, pwa,
WEBOPT_HEADER, "X-Method: GET\r\n",
WEBOPT_HEADERHANDLER, WebAction_Header,
WEBOPT_STATUSHANDLER, WebAction_Status,
WEBOPT_END));
}
and in PHP i use
Tes Post:
echo " POST : \"" .$_POST[""aa""].""\"" and \"""".$_POST[""bb""].""\"""";
and when open empty..data aa and bb that submit not sent..
and when i debug..pwa->pszPostData is always empty..
thanks"