You are here: Version Information > getWebServiceVersion

Obtain Web Service Version

Description

Retrieves the Web services version. You need to specify the version obtained with getWebServiceVersion in all Web service calls.

Default Protocol Method Type URI
HTTPS GET getWebServiceVersion.xml

Query Parameters

None

Sample Code

 
import java.io.IOException;
import java.net.URLDecoder;

//..............................
//..............................
//..............................
import org.apache.http.params.HttpParams;
public class EMSSample {
	private static DefaultHttpClient httpclient = new DefaultHttpClient();
	private static Principal principal = null;
	private static StringBuffer query;
	//..............................
	//..............................
	//..............................
	public static String getWebServiceVersion.xml()throws Exception  {
		if(!verifyLogin()){
			return "login failed";
		}
		HttpContext context = new BasicHttpContext();
		context.setAttribute(ClientContext.USER_TOKEN, principal);
		HttpGet get = new HttpGet("https://localhost:8443/ems/3.6/getWebServiceVersion.xml");
		query = new StringBuffer();
		get.setURI(new URI(URLDecoder.decode(get.getURI() + query.toString(),"UTF-8")));
		HttpResponse response = httpclient.execute(get, context);
		HttpEntity entity = response.getEntity();
		byte[] b = null;
		if (entity != null) {
			long l = entity.getContentLength();
			b = new byte[(int) l];
			entity.getContent().read(b);
			entity.consumeContent();
		}
		return new String(b);
	}
	static void setParameter(String key, String value) {
		if (query.toString().equals("")) {
			query.append("?" + key + "=" + value + "&");
		} else {
			query.append(key + "=" + value + "&");
		}
	}
}

Sample Response

<?xml version="1.0" encoding="utf-8"?>
<emsResponse>
  <stat>ok</stat>
  <webServiceVersion>3.6</webServiceVersion>
</emsResponse>
  
See Also:

Output Format for Failure

Error Codes

Error Code Description
100 Invalid request parameter.
107 An internal error occurred! Please report the error to System administrator.
128 You should log on first.
1081 Invalid Web service version provided
1088 The EMS system is running on HTTPS. Please provide the correct Web service URL.