Hi friends,
I am creating an application in C++ to send image to
webservice(developed ib DOTNET) end. I am using gSoap for the same.
using gSoap I am able to send images upto 2 to 3 mb but while sending
heavy images it returns error. I am using following code.
enGSLayerErrCode ImportComponentRequest(const char* kUrl,
vector<string&refXMLRequest, bool &refImportStatus)
{
enGSLayerErrCode retval = eFAILURE;
struct soap stSoap;
soap_init(&stSoap);
//setup input/output parameters
_MediaLink__WS_USCOREImportComponent stIn;
_MediaLink__WS_USCOREImportComponentResponse stOut;
do{
stSoap.recv_timeout = 0; //MAX_RECV_TIMEOUT; 0 for disabling
timeout
stSoap.send_timeout = 0; //MAX_SEND_TIMEOUT;
stIn.arrXML = new MediaLink__ArrayOfString();
int nRequestSize = refXMLRequest.size();
stIn.arrXML->__sizestring = nRequestSize;
stIn.arrXML->string = new char*[nRequestSize];
int i=0;
for(i = 0 ; i< nRequestSize ; i++)
{
int nSize = refXMLRequest[i].size();
char *tempstr = new char[nSize+1];
memcpy(tempstr, refXMLRequest[i].c_str(), nSize);
tempstr [nSize] = NULL;
stIn.arrXML->string[i] = tempstr ;
}
//call webmethod ImportComponent() //kURL is the URL for webservice
if(soap_call___MediaLink__WS_USCOREImportComponent (&stSoap, kUrl,
NULL, &stIn, &stOut)
== SOAP_OK)
{
//get the update or insert query status
refImportStatus = stOut.WS_USCOREImportComponentResult;
retval = eSUCCESS;
}
else //if error in webmethod ------------here enters for heavy
images...................
{
if( (stSoap.error eSUCCESS) || (stSoap.error <= eSOAP_LENGTH) ||
(EOF == stSoap.error) )
{
retval = enGSLayerErrCode(stSoap.error);
}
}
for(i = 0 ; i< nRequestSize ; i++)
{
if(stIn.arrXML->string[i])
delete stIn.arrXML->string[i];
}
if(stIn.arrXML->string)
delete [] stIn.arrXML->string;
if(stIn.arrXML)
delete stIn.arrXML;
}while(false);
soap_destroy(&stSoap);
soap_end(&stSoap); \
soap_done(&stSoap);
return retval;
}
Please help me to sort out the problem.
Thanks
Dharmendra Singh Tomar