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

Option 1: “get” task Ant’s get task can be used to invoke web services, but it restricted to GET operations. Only works for very simple web services Option 2: curl Invoke the unix curl command to call the webservice (See this post for examples) <target name=”invoke-webservice”> <exec executable=”curl”> <arg line=”-d ‘param1=value1&param2=value2’ http://example.com/resource.cgi”/> </exec> </target> Note: … Read more

Jersey client exception: A message body writer was not found

Register the MultiPartWriter provider when creating the Client: ClientConfig cc = new DefaultClientConfig(); Client client; cc.getClasses().add(MultiPartWriter.class); client = Client.create(cc); If using Maven, these are the dependencies you need in your pom.xml: <dependency> <groupId>com.sun.jersey</groupId> <artifactId>jersey-client</artifactId> <version>1.17.1</version> </dependency> <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>1.17.1</version> </dependency>

Web Service without adding a reference?

You can use this class. I didn’t remember where i found the basic code, i added some methods and convert to class before. public class WebService { public string Url { get; set; } public string MethodName { get; set; } public Dictionary<string, string> Params = new Dictionary<string, string>(); public XDocument ResultXML; public string ResultString; … Read more

Sending JSONP vs. JSON data?

JSONP is simply a hack to allow web apps to retrieve data across domains. It could be said that it violates the Same Origin Policy (SOP). The way it works is by using Javascript to insert a “script” element into your page. Therefore, you need a callback function. If you didn’t have one, your Javascript … Read more

Unique key generation

There are only 3 ways to generate unique values, rather they be passwords, user IDs, etc.: Use an effective GUID generator – these are long and cannot be shrunk. If you only use part you FAIL. At least part of the number is sequentially generated off of a single sequence. You can add fluff or … Read more