How to call a web service from Ant script or from within Jenkins? -


i using ant script in jenkins handle deployment of files. want trigger call url has web service. question is, how can ant script or within jenkins?

thanks in advance, monte

option 1: "get" task

ant's get task can used invoke web services, restricted operations. works simple web services

option 2: curl

invoke unix curl command call webservice (see post examples)

<target name="invoke-webservice">     <exec executable="curl">         <arg line="-d 'param1=value1&param2=value2' http://example.com/resource.cgi"/>     </exec> </target> 

note:

the curl command invoked post build action in jenkins

option 3: groovy ant task

if need cross platform , flexible solution embed groovy script within build invoke web service.

<target name="invoke-webservice">     <taskdef name="groovy" classname="org.codehaus.groovy.ant.groovy" classpathref="build.path"/>      <groovy>         import static groovyx.net.http.contenttype.json         import groovyx.net.http.restclient          def client = new restclient("http://localhost:5498/")         def response = client.put(path: "parking_tickets",                                   requestcontenttype: json,                                    contenttype: json)          log.info "response status: ${response.status}"     </groovy> </target> 

option 4: groovy jenkins post build

use groovy postbuild plugin invoke web service.

option 5: ant http task

the ant http task alternative groovy task above


Comments

Popular posts from this blog

powershell Start-Process exit code -1073741502 when used with Credential from a windows service environment -

twig - Using Twigbridge in a Laravel 5.1 Package -

c# - LINQ join Entities from HashSet's, Join vs Dictionary vs HashSet performance -