RESTful Web Service Jot Down

RESTful Web Service

  • Representational State Transfer (REST) an architectural style that data and functionality are considered resources and are accessed using Uniform Resource Identifiers (URIs)
  • Using stateless communication protocol: HTTP (GET, POST, PUT, DELETE)/JSON/XML/YAML…
  • Stateful interactions using cookie, URI rewriting, hidden form fields to achieve

Continue reading RESTful Web Service Jot Down

Advertisements

HTTPS WebService Client (Skip Certificate Validation)

Using Axis2

Refer to Eclipse + Apache AXIS2 Tips

Code Snippet

SSLContext sslCtx = SSLContext.getInstance("TLSv1");
sslCtx.init(null, new TrustManager[] { new TrustAllTrustManager() }, null);

XXXStub stub = new XXXStub("https://IP:Port/...");

stub._getServiceClient()
 .getOptions()
 .setProperty(
 HTTPConstants.CUSTOM_PROTOCOL_HANDLER,
 new Protocol("https",
 (ProtocolSocketFactory) new SSLProtocolSocketFactory(sslCtx), 8443));


[response] result = stub.operator([request]);
......

Continue reading HTTPS WebService Client (Skip Certificate Validation)