Haxx ad

curl's project page on


cURL > Mailing List > Monthly Index > Single Mail

curl-users Mailing List Archives

Fw: Problem using libcurl - Resending - SOAP USERS!!!!!!!

From: Francis Dagenais <>
Date: Tue, 16 Jul 2002 15:09:06 -0400

  I'm using libcurl to send SOAP-XML messages over HTTPS. I'm now able to do 1 post, and receive the answer without problem. But when I try to do 2 post in a row, the second post doesn't end correctly, and my C program ends in a core dump. Here is what I've programmed:

CURL *ch;
struct curl_slist *headerlist=NULL;
struct MemoryStruct *bodyStruct=NULL;
char _gatineauSoapReq[2000]="";

void _gatineauInit() {
  ch = curl_easy_init();
  curl_easy_setopt(ch, CURLOPT_URL, transactionServerUrl3);
  curl_easy_setopt(ch, CURLOPT_POST, 1);
  curl_easy_setopt(ch, CURLOPT_HEADER, 1);
  curl_easy_setopt(ch, CURLOPT_VERBOSE, 1);
  curl_easy_setopt(ch, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
  if ((bodyStruct = (struct MemoryStruct *) malloc(sizeof(struct MemoryStruct))) == NULL) exit(1);
  curl_easy_setopt(ch, CURLOPT_FILE, bodyStruct);

void _gatineauEndReq() {

int _gatineauExtractRetour(char *response) {
  char *tok="", buf[64]="", *p="";
  p = strstr(response, "<Retour>");
  tok = strtok(p, ">");
  tok = strtok(NULL, "<");
  strcpy(buf, tok);

void _gatineauValidateNow(const char *arg1, const char *arg2, const char *arg3, const char *arg4) {
  // I make sure that headerlist is erased before rebuilding it with the soap function
  headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
  headerlist = curl_slist_append(headerlist, "SOAPAction: \"\"");
  sprintf(_gatineauSoapReq, "<?xml version=\"1.0\" encoding=\"utf-8\"?>\
<soap:Envelope xmlns:xsi=\"\" \
xmlns:xsd=\"\" xmlns:soap=\"\">\
<ValidateNow xmlns=\"namespace://\">\
</soap:Envelope>", arg1, arg2, arg3, arg4);
  curl_easy_setopt(ch, CURLOPT_POSTFIELDS, _gatineauSoapReq);
  curl_easy_setopt(ch, CURLOPT_HTTPHEADER, headerlist);

void _gatineau() {
  char *strToSend="", buf[2000]="", buf2[256]="", *dtmf="",
         *msgDir="", msgPath[128]="", *periodInfo="";
  int i=0, retour=0;
  _gatineauValidateNow("1234", "0052", "654321", "0");
  printf("Retour: %s\n", bodyStruct->memory);
  retour = _gatineauExtractRetour(bodyStruct->memory);
  printf("Retour1: --%d--\n", retour);

  _gatineauValidateNow("1235", "0053", "123456", "1");
  printf("Retour: %s\n", bodyStruct->memory);
  retour = _gatineauExtractRetour(bodyStruct->memory);
  printf("Retour2: --%d--\n", retour);

I think that may be the problem is within the headerlist function :
headerlist = curl_slist_append(headerlist, "Content-Type: text/xml");
If someone has already done something with soap-xml or has made several posts within the same curl session, please help!
Does anybody has a working example of more than one soap xml request within the same curl session?

Thank you,
Francis Dagenais

This email is sponsored by: Jabber - The world's fastest growing
real-time communications platform! Don't just IM. Build it in!
Received on 2002-07-16

These mail archives are generated by hypermail.

donate! Page updated November 12, 2010.
web site info

File upload with ASP.NET