Need code for the web_custom_request.

Hi All,

I request your help for the below.


My script has XML message in web_custom_request. I am saving this XML content alone in lr_save_string and substituting this string value in web_custom_request.


My XML message contains message ID followed by body of the message ,this makes one request with one message. My question here is how can I make this for multiple messages by changing the message ID and the content of the body with different parameters.


For example.


web_custom_request (“My soap”,


“Body=message ID=1000,\r\nContent–Disp"

"position: form–data=1234; name=\"entry\"\r\n\r\nText\r\n”,



The above request sends one request. If I want multiple messages, for example if I specify my message count = 5 in my script then the custom request should look like below with different msg ID.


web_custom_request (“My soap”,


“Body=message ID=1000,\r\nContent–Disp"

"position: form–data=1234; name=\"entry\"\r\n\r\nText\r\n”,

message ID=1001,\r\nContent–Disp"

"position: form–data=2345; name=\"entry\"\r\n\r\nText\r\n”

message ID=1002,\r\nContent–Disp"

"position: form–data=6789; name=\"entry\"\r\n\r\nText\r\n”

message ID=1003,\r\nContent–Disp"

"position: form–data=9807; name=\"entry\"\r\n\r\nText\r\n”

message ID=1004,\r\nContent–Disp"

"position: form–data=3456; name=\"entry\"\r\n\r\nText\r\n”



I just need to know how can I write the code for this. This would be highly appreciable.


Kind Regards


  • Hi,


    I am not sure if this is gone work, try it first:

    1. Put a part of the request in a parameter called 'MultipleMessages'

    2. Put the parameter '{MultipleMessages}in the WEB_CUSTOM_REQUEST.


    Step 1. lr_save_string("position: form–data=1234; name=\"entry\"\r\n\r\nText\r\n","MultipleMessages");


    Step 2.

    web_custom_request (“My soap”,
    “Body=message ID=1000,\r\nContent–Disp"


    If this works then you should think about using STRCPY, STRCAT and a FOR loop to do the trick.





  • Hi Dennis,


    This is working for me .But how do i proceed to loop it for multiple meaagses with different meg ID and other parameters.




  • Verified Answer

    Hi Shankar,


    That should be something like this:


    char prmMessage[1024]; // buffer 1024 bytes, adjust if needed
    char prmNextLine[64]; // buffer 64 bytes
    char prmMessageID[16]; // buffer 16 bytes
    char prmFormdata[16]; // buffer 16 bytes
    int i; // integer value
    // Create empty string
    strcpy(prmMessage, "");
    // loop 5 times
    for(i=0; i<5; i  ){
    	// insert your Formdata logic here
    	sprintf(prmFormdata, "d", i*1000);
    	// insert your MessagID logic here
    	sprintf(prmMessageID, "1d", i);
    	// Create line to add to MultipleMessage request
    	// Data will be replaced with %s in sprintf-statement
    	sprintf(prmNextLine, "position: form–data=%s; name=\"entry\"\r\n\r\nText\r\nmessage ID=%s,\r\nContent–Disp", prmFormdata, prmMessageID);
    	// Add new line to MultipleMessage
    	strcat(prmMessage, prmNextLine);
    // Copy created message to variable MultipleMessages
    lr_save_string(prmMessage, "MultipleMessages");


    Output will be something like:

    Notify: Saving Parameter "MultipleMessages = position: form–data=0000; name="entry"\r\n\r\nText\r\nmessage ID=1000,\r\nContent–Dispposition: form–data=1000; name="entry"\r\n\r\nText\r\nmessage ID=1001,\r\nContent–Dispposition: form–data=2000; name="entry"\r\n\r\nText\r\nmessage ID=1002,\r\nContent–Dispposition: form–data=3000; name="entry"\r\n\r\nText\r\nmessage ID=1003,\r\nContent–Dispposition: form–data=4000; name="entry"\r\n\r\nText\r\nmessage ID=1004,\r\nContent–Disp".


    Further coding you have to do by yourself.

    Hopefully I pushed you in the right direction.



  • Hi, 

    Even I have the same requirement. Can you please tell me how did you resolve this.

    My requirement is : I have a soap request in which few tags in the request should be repeated multiple times (Eg : 1000 times). If I split the soap request into different actions and try to use blocks, it is throwing errors. How to use for loop and repeat few tags in the soap request. Please help me with this.