Posts

Showing posts with the label Web service

Cosuming Liferay JSON Web Services

In liferay you can write json web service  easily. You can also consume those web service from other client such in java httpclient, javascript(like ajax jquery), dukescript and other client . For example you have a portlet name test-portlet and you write a json webservice as below:     @JSONWebService(value = "testService", method = "POST")     public JSONObject testService(String test) throws SystemException {         JSONObject result = JSONFactoryUtil.createJSONObject();         result.put("test", test);         return result;     } For consuming this service from several clients you can follow below steps: 1. In java client Here you can use jersy.  Client code given below:        Client    client = ClientBuilder.newClient();         ...

Create waraper to process ofbiz soap service response

How to call soap service is describe in my previous post. http://tariqliferay.blogspot.com/2015/09/how-to-create-soap-client-for-ofbiz.html Here you get response as OMElement. Then you need to process this. Now i show how can you make pojo/dto class from response for further need. Think you get campaign list in response as key="campaignList" and  value list a list of campaign. First create dto/pojo class as your requirement. Here below a sample dto: import java.io.Serializable; /**  * @author tariq  *  */ public class Campaign implements Serializable{     public String campaignName = null;     public String campaignType = null;     public String contentId = null;     public String createdStamp = null;     public String createdTxStamp = null;     public String emailSubscription = null;     public String lastUpdatedStamp = null;  ...

How to create soap client for ofbiz service or ofbiz service invocation from another application.

Sometimes ofbiz developer need to integrate ofbiz with 3rd party or another web application. This is very simple to create soap service in ofbiz.In ofbiz here soap engine to mail soap service. To create soap service or make service exportable follow the bellow steps: 1. Set export="true" in service definition for example   <service name="createColleague" engine="java" auth="true"         location="org.ofbiz.crm.colleague.ColleagueService" invoke="createColleague" export="true" > </service> You find all exportable service or soap service wsdl under webtools component. Open a your browser new tab and below url, http://localhost:8080/webtools/control/SOAPService?wsdl  Here you find all soap or exportable service. 2. Create java client to all this as below, /**  *  */ import java.util.Map; import java.util.logging.Logger; import org.apache.axiom.om.OMAbstractFactory; import org.apache.axio...