Escaping ampersand with HttpClient ant task while triggering a custom build

Per this : , I am trying to 'Triggering a Custom Build' with HttpClient ant task by taskdef to it.

Since specifying '&' complains in url string within ant-target http task tried escaping with '%26M', but no-luck
But it is not triggering the build :


but where as if I put the url in the browser it triggers the build by passing required parameters set in url. How to handle '&' escaping within ant-task http call?.

Comment actions Permalink

Using &amp; for encoding/escaping ampersand withing the URL resolved my problem partially - where it is passing the the parameter value to build triggered on teamcity.

But I see a limiation where it is only passing last name=value pair to TC & ignoring the first two. No errors in log, but just ignores. Any idea on this?.

Comment actions Permalink


On our side we are using a workaround.
We put a £ instead of & and we susbstitute it in a perl command line program. This works on windows, mac and linux.
Problem, the login and password are visible

use LWP::Simple;

print "Call build configuration BTxx\n";
my $url="http://login:pass\@teamcity:8111/httpAuth/action.html?add2Queue=btxx£name=param1£value=%build.vcs.number%£name=param2£value=%xx%";
$url =~ s/£/&/g ;

# useful if you want to run again the configuration
print $url."\n";
my $content = get $url;

Comment actions Permalink

Unfortunately this approach can't be used in my current problem, as we are setting auth-cookie as part of http taskdef & it does not seem to allow options of passing multiple name=value pairs as part of url. Still unsure on underlying problem, as just pasting the url in browser just works fine!

Comment actions Permalink

After using <query> & setting <parameter> name=value pairs, it has worked as per this doc :

Comment actions Permalink

resolved - as added in latest comment above


Please sign in to leave a comment.