String concatenate Jmeter + BeanShell -


i trying concatenate string in jmeter beanshell postprocessor somehow not working, seems way java handles multiple line string doesn't work here:

string poxml="<s:envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:header/><s:body><ns7:newporequest " +    "xmlns:ns2=\"http://services.portal.com/pro/common\" xmlns:ns5=\"http://services.portal.com/pro/po\" + "xmlns:ns7=\"http://services.portal.com/proc/ws\">" + "<ns7:tracinglevel>off</ns7:tracinglevel><ns7:userid>testutil</ns7:userid><ns7:applicationid>rf</ns7:applicationid>" + "<ns7:usertype>buyer</ns7:usertype><ns5:purchaseorder><ns5:poexternalid>xxx-930220</ns5:poexternalid>" + "<ns5:repairordernumber>vars.get("ordernumber")</ns5:repairordernumber>"; 

i can concatenate simple 1 line when comes multiple line not working.
single line:

print("po xml="+"<ns5:repairordernumber>"+vars.get("ordernumber")+"</ns5:repairordernumber>"); 

nothing special but:

  1. missing closing quotes near ...xmlns:ns5=\"http://services.portal.com/pro/po\" + "xmlns... - should ...xmlns:ns5=\"http://services.portal.com/pro/po\"" + "xmlns...;
  2. missing escape character in repairordernumber>vars.get("ordernumber")</ns5: - use >vars.get(\"ordernumber\")< if want have string in result (i.e. vars.get("ordernumber")) or concatenate separately + vars.get("ordernumber") + resolve expression variable's value (as in second sample).

    string poxml="<s:envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:header/><s:body><ns7:newporequest"+" xmlns:ns2=\"http://services.portal.com/pro/common\""+" xmlns:ns5=\"http://services.portal.com/pro/po\""+" xmlns:ns7=\"http://services.portal.com/proc/ws\">"+"<ns7:tracinglevel>off</ns7:tracinglevel><ns7:userid>testutil</ns7:userid><ns7:applicationid>rf</ns7:applicationid>"+"<ns7:usertype>buyer</ns7:usertype><ns5:purchaseorder><ns5:poexternalid>xxx-930220</ns5:poexternalid>"+"<ns5:repairordernumber>"+vars.get("ordernumber")+"</ns5:repairordernumber>"; 

as looks usage of stringbuilder.append() bit better way.


Comments

Popular posts from this blog

php - Calling a template part from a post -

Firefox SVG shape not printing when it has stroke -

How to mention the localhost in android -