Hi!
I am trying to send a HTTP Post message.
As documented, I am using the HTTP Client. Consider the following code:
void HTTP_SendRequest()
{
TRACE((TL_SOCK, "HTTP_SendRequest()"));
http_channel_pers = wip_HTTPClientCreateOpts(NULL, NULL, WIP_COPT_HTTP_HEADER, "User-Agent", "WIP-HTTP-Client/1.0", WIP_COPT_END);
if (http_channel_pers == NULL)
{
return;
}
HTTP_SwitchState(HTTPSENDREQUEST);
char* req = "http://195.158.145.72/demo/Connector/StandardConnector.aspx?serial=XXX&auth=XXX";
// do post request
wip_getFileOpts(http_channel_pers, req, HTTP_hdl_c, NULL,
WIP_COPT_HTTP_METHOD, WIP_HTTP_METHOD_POST,
WIP_COPT_HTTP_HEADER, "Accept", "*",
WIP_COPT_END);
}
// HANDLER
void HTTP_hdl_c(wip_event_t *event, void *context)
{
TRACE((TL_SOCK, "HTTP_hdl_c()"));
http_channel_comm = event->channel;
s32 ret;
switch(event->kind)
{
//response header message received
case WIP_CEV_OPEN:
TRACE((TL_SOCK, "HTTP_hdl_c(): WIP_CEV_OPEN"));
//as per documentation, in CEV_OPEN the HTTP_STATUS_CODE should be recieved.
//anyway this only works after receiving a CEV_READ event
break;
//response body message received
case WIP_CEV_READ:
TRACE((TL_SOCK, "HTTP_hdl_c(): WIP_CEV_READ"));
//check http_status
s32 code;
wip_getOpts(http_channel_comm, WIP_COPT_HTTP_STATUS_CODE, &code, WIP_COPT_END);
TRACE((TL_SOCK, "return code is %d", code));
if (code == 200) //OK
{
//...
}
break;
case WIP_CEV_PEER_CLOSE:
TRACE((TL_SOCK, "HTTP_hdl_c(): WIP_CEV_PEER_CLOSE"));
wip_close(http_channel_comm);
HTTP_SwitchState(HTTPREQUESTDONE);
break;
case WIP_CEV_ERROR:
TRACE((TL_SOCK, "HTTP_hdl_c(): WIP_CEV_ERROR"));
wip_close(http_channel_comm);
HTTP_SwitchState(HTTPREQUESTERROR);
break;
//write request body
case WIP_CEV_WRITE:
TRACE((TL_SOCK, "HTTP_hdl_c(): WIP_CEV_WRITE"));
ret = wip_write(http_channel_comm, "some request", 12);
TRACE((TL_SOCK, "wip_write ret: %d", ret));
wip_shutdown(http_channel_comm,FALSE,TRUE);
break;
}
}
My problem is, that after sending some request body after the CEV_WRITE Event in the HTTP Handler, an exception occurs:
Trace CUS4 2 HTTP_SendRequest()
Trace CUS4 2 HTTP_hdl_c()
Trace CUS4 2 HTTP_hdl_c(): WIP_CEV_OPEN
Trace CUS4 2 HTTP_hdl_c()
Trace CUS4 2 HTTP_hdl_c(): WIP_CEV_WRITE
Trace CUS4 2 wip_write ret: 12
ADS Bckt -> Unresolved symbol : 0x00053100
ADS Bckt -> Unresolved symbol : 0x00050CB7
ADS Bckt -------> ADS BACK TRACE <-------
ADS Bckt The function corresponding to this address : 0xbe, is not in the .axf file
Anybody know, what I am doing wrong? Trying to wip_shutdown the channel after the wip_write has the same effect.