how to create a POST request, which should submit an xml data with url.

1,164 views
Skip to first unread message

srikant

unread,
Sep 19, 2011, 12:53:14 PM9/19/11
to LoadRunner
Dear All,

I am assigned to conduct Performance testing for an application, which
accepts only POST request. The input is an xml data, which we need to
submit, but we have to submit by POST request. I used
web_custom_request, but still am getting the error that the
application only accepts POST request, no GET requests. Please find
the web_custom_request below, which is the one i used:-

web_custom_request("url",
"URL=url?<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE
PreAuthMaintDetailRequest SYSTEM \"PreAuthMaintDetailPOARequest.dtd
\"><PreAuthMaintDetailRequest><XMLVersion>xmlVersion</XMLVersion></
Generator></PreAuthMaintDetailRequest>", // Due to
"Method=POST",
"TargetFrame=_SELF",
"Resource=1",
"Referer=",
"Mode=HTTP",
"EncType=text/xml,multipart/related",
"Body=",
EXTRARES,
"URL=url", ENDITEM,
LAST);

Is there any that we can submit the xml data by POST request. Could
you please help me out in solving the same?
Thanks for the support...

chaitanya bhatt

unread,
Sep 19, 2011, 1:15:57 PM9/19/11
to lr-loa...@googlegroups.com
Why are you sending the XML payload in the URL? Use the "Body" attribute in the web_custom_request to send the payload...
 
-Chaitanya M Bhatt

--
You received this message because you are subscribed to the Google "LoadRunner" group.
To post to this group, send email to LR-Loa...@googlegroups.com
To unsubscribe from this group, send email to
LR-LoadRunne...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/LR-LoadRunner?hl=en

James Pulley

unread,
Sep 19, 2011, 1:52:47 PM9/19/11
to lr-loa...@googlegroups.com
You have a post request. But your likely missing a SOAP header, would be
my guess.

Next question: Did you record the web_cusutom_request() or build it by
hand?

James Pulley, http://www.loadrunnerbythehour.com/PricingMatrix

Dear All,

--

Venkat P

unread,
Sep 19, 2011, 1:55:51 PM9/19/11
to LoadRunner
look up the following in the docs

HP LoadRunner Virtual User Generator User's Guide > Information for
Advanced Users > Programming with the XML API

It has many sample code examples that you can use.

-Venkat

André Luyer

unread,
Sep 20, 2011, 4:47:43 AM9/20/11
to LoadRunner
Technically it is allowed to combine a HTTP POST with an url with
parameters (see http://www.w3.org/Protocols/rfc2616/rfc2616.html ).
This one looks very strange...
In your web_custom_request the xml in the url is NOT urlencoded. That
will fail.
But most likely the xml should be moved to the "Body=" section.

If you can't record the required POST, then use Wireshark to figure
out how to build your own.

André

srikant

unread,
Sep 21, 2011, 9:24:12 PM9/21/11
to LoadRunner
Hi James,

Thanks for your reply. Infact, i moved the xml data to body attribute
and ran the script. But still the application gets Get request and is
rejected. I manually created the web_custom_request, didn't recorded
it.I tried a few SOAP headers, but didn't worked out. In this case,
what could be the SOAP header that i can use.
Is it like do we have any other statement in VuGen exclusively for
POST request?

Thanks
Srikant

On Sep 19, 1:52 pm, "James Pulley" <loadrunner-li...@jamespulley.com>
wrote:
> You have a post request.   But your likely missing a SOAP header, would be
> my guess.
>
> Next question:  Did you record the web_cusutom_request() or build it by
> hand?
>
> James Pulley,http://www.loadrunnerbythehour.com/PricingMatrix

srikant

unread,
Sep 21, 2011, 9:31:33 PM9/21/11
to LoadRunner
Sure venkat. I will look check this...thanks

Ashish Tyagi

unread,
Sep 22, 2011, 5:16:56 AM9/22/11
to LoadRunner
Will be good if you can get the correct body and header from one of
the developers of your application/analyze some app logs.

I dont think anyone can Predict" what header your request might be
using.

web_custom_request should be sufficient for this purpose.

James Pulley

unread,
Sep 22, 2011, 9:03:46 AM9/22/11
to LoadRunner
I would suggest you record a few applications with
web_custom_request() only as the recording option. As you are hand
tuning this item I think you need some more samples from actual
applications to see where your hand-tuned example has come off of the
tracks. Use an application you are familiar with which also has
this same post model.

As for me, I would just use VUGEN as a proxy and pass the actual XML
using some other tool through VUGEN and record the interaction rather
than constructing it by hand.

James Pulley, http://www.loadrunnerbythehour.com/PricingMatrix

Manny Yamzon

unread,
Sep 22, 2011, 12:20:41 PM9/22/11
to lr-loa...@googlegroups.com
Srikant, This is how I did it and it is working perfectly fine for me.

char xmlRequest[500];

        strcpy(xmlRequest,lr_eval_string("Body=<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"));
   
        strcat(xmlRequest,lr_eval_string(
                        "<profiles>"
                          "<simpleProfile>"
                            "<customerID>{PE_CustIDs}</customerID>"
                          "</simpleProfile>"
                        "</profiles>" ));

web_add_auto_header("Accept","application/xml");

    web_custom_request("RequestName",
       "URL=http://{UR_ServerNameHere}/WhateveServicePathHere/getwhatever",
       "Method=POST",
       "TargetFrame=",  
       "Resource=0",
       "Referer=",
       "Mode=HTTP",
       xmlRequest,
       LAST);

Prajeesh Nair

unread,
Sep 26, 2011, 3:15:11 AM9/26/11
to LR-Loa...@googlegroups.com
Hey,

You can refer this sample web_custom_request. This will help you understand how to build your own request.

web_custom_request("alertRecipients",
"URL=http://something.something.com",
"Method=POST",
"TargetFrame=",
"Resource=0",
"RecContentType=text/xml",
"Referer=http://something.something.com",
"Snapshot=t58.inf",
"Mode=HTML",
"Body=method=post&httpStatus=F&xml={XML_Data}",
LAST);

 

saurabh munjal

unread,
Dec 13, 2013, 9:48:17 AM12/13/13
to LR-Loa...@googlegroups.com
Hi Experts,

I am also facing the same problem. I have a sample xml request. Which i am trying to simulate through http protocol - Web_custom_request.
But i am getting a 404 not found error.
When i tried to hit the xml using fiddler. It passed successfully. I doubt on the header i am passing. 
Appreciate quick help here. I have attached the received xml file for reference.

Written Load runner code
-------------------------------------
web_add_header("Content-Type", "text/xml; charset=utf-8");

web_custom_request("createlisting",
        "Method=POST",
        "Resource=0",
        "Referer=",
        "Snapshot=t1.inf",
        "Mode=URL",
"Body=<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\">"
"<SOAP-ENV:Body><ns0:createOverriddenDO xmlns:ns0=\"http://service.listing.tesco.com\">"
"<ns0:header><ns1:appName>SellerPortal</ns1:appName>"
"<ns1:timeStamp>2013-12-03T13:25:04.905Z</ns1:timeStamp>"
"<ns1:storeName>Test</ns1:storeName>"
"</ns0:header><ns0:createDoInput><ns1:isDoApiRequest>true</ns1:isDoApiRequest>"
"<ns1:listingId>O0003a399a</ns1:listingId>"
"<ns1:profileId>1000516</ns1:profileId>"
"<ns1:mSkuId>9164190</ns1:mSkuId>"
"<ns1:deliveryServiceCode>MKT_Standard_UKOOA</ns1:deliveryServiceCode>"
"<ns1:overriddenCharges>2.034E1</ns1:overriddenCharges>"
"</ns0:createDoInput></ns0:createOverriddenDO>"
"</SOAP-ENV:Body>"
"</SOAP-ENV:Envelope>",
LAST);
-------------------------------------------------

Received Response from Fiddler

# Result Protocol Host                                            URL                               Body        Caching                                                       Content-Type Process Comments Custom
2 200       HTTP      listing.nft.ukroi.tesco.org /axis2/services/ListingService?wsdl 352 text/xml;charset=UTF-8


Loadrunner Error 
Error -26627: HTTP Status-Code=404 (Not Found) for "http://listing.nft.ukroi.tesco.org/axis2/services/ListingService?wsdl"


Thanks,
Saurabh

Abhishek Banginwar

unread,
Dec 15, 2013, 10:57:03 PM12/15/13
to LR-Loa...@googlegroups.com

First create a new thread. Don't hijack old threads.

-A

--
You received this message because you are subscribed to the Google Groups "LoadRunner" group.
To unsubscribe from this group and stop receiving emails from it, send an email to LR-LoadRunne...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages