diff --git a/org.idempiere.webservices/.classpath b/org.idempiere.webservices/.classpath
index f1fd5394e4..60efa061eb 100644
--- a/org.idempiere.webservices/.classpath
+++ b/org.idempiere.webservices/.classpath
@@ -22,5 +22,6 @@
+
diff --git a/org.idempiere.webservices/META-INF/MANIFEST.MF b/org.idempiere.webservices/META-INF/MANIFEST.MF
index e5a655aa2a..c90ddf514c 100644
--- a/org.idempiere.webservices/META-INF/MANIFEST.MF
+++ b/org.idempiere.webservices/META-INF/MANIFEST.MF
@@ -78,8 +78,12 @@ Bundle-ClassPath: .,
WEB-INF/lib/aopalliance-1.0.jar,
WEB-INF/lib/idempiere-xmlbeans-1.0.jar,
WEB-INF/lib/axis.jar,
- WEB-INF/lib/commons-discovery-0.5.jar
-Export-Package: javax.wsdl,
+ WEB-INF/lib/commons-discovery-0.5.jar,
+ WEB-INF/lib/jsr311-api-1.1.jar
+Export-Package: javax.ws.rs,
+ javax.ws.rs.core,
+ javax.ws.rs.ext,
+ javax.wsdl,
javax.wsdl.extensions,
javax.wsdl.extensions.http,
javax.wsdl.extensions.mime,
diff --git a/org.idempiere.webservices/META-INF/cxf/rest-context.xml b/org.idempiere.webservices/META-INF/cxf/rest-context.xml
new file mode 100644
index 0000000000..6d22ac05f4
--- /dev/null
+++ b/org.idempiere.webservices/META-INF/cxf/rest-context.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeService.java b/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeService.java
index 1e20b11360..aad7d61f1d 100644
--- a/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeService.java
+++ b/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeService.java
@@ -5,10 +5,17 @@ import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
import org.idempiere.adInterface.x10.CompositeRequestDocument;
import org.idempiere.adInterface.x10.CompositeResponsesDocument;
+@Path("/composite_service/")
+@Consumes("application/xml")
+@Produces("application/xml")
@WebService(targetNamespace="http://idempiere.org/ADInterface/1_0")
@SOAPBinding(style=Style.RPC,use=Use.LITERAL,parameterStyle=ParameterStyle.WRAPPED)
public interface CompositeService {
@@ -18,5 +25,7 @@ public interface CompositeService {
* @param reqs
* @return CompositeResponsesDocument
*/
+ @POST
+ @Path("/composite_operation")
public CompositeResponsesDocument compositeOperation(CompositeRequestDocument reqs);
}
diff --git a/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeServiceImpl.java
index 2ff6ad6624..36cb22cd20 100644
--- a/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeServiceImpl.java
+++ b/org.idempiere.webservices/WEB-INF/src/com/trekglobal/ws/CompositeServiceImpl.java
@@ -87,7 +87,8 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
return ret;
}
- ModelADServiceImpl modelADService = new ModelADServiceImpl(ctx);
+ ModelADServiceImpl modelADService = new ModelADServiceImpl(jaxwsContext, jaxrsContext);
+
String trxName = Trx.createTrxName(webServiceName);
diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADService.java
index c11b4d6e80..1f8f5ccf9a 100644
--- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADService.java
+++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADService.java
@@ -35,6 +35,10 @@ import javax.jws.soap.SOAPBinding;
import javax.jws.soap.SOAPBinding.ParameterStyle;
import javax.jws.soap.SOAPBinding.Style;
import javax.jws.soap.SOAPBinding.Use;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
import org.idempiere.adInterface.x10.ModelCRUDRequestDocument;
import org.idempiere.adInterface.x10.ModelGetListRequestDocument;
@@ -44,28 +48,49 @@ import org.idempiere.adInterface.x10.RunProcessResponseDocument;
import org.idempiere.adInterface.x10.StandardResponseDocument;
import org.idempiere.adInterface.x10.WindowTabDataDocument;
+@Path("/model_adservice/")
+@Consumes("application/xml")
+@Produces("application/xml")
@WebService(targetNamespace="http://idempiere.org/ADInterface/1_0")
@SOAPBinding(style=Style.RPC,use=Use.LITERAL,parameterStyle=ParameterStyle.WRAPPED)
public interface ModelADService {
/* Model oriented web services */
+ @POST
+ @Path("/set_docaction")
public StandardResponseDocument setDocAction(ModelSetDocActionRequestDocument req);
+ @POST
+ @Path("/run_process")
public RunProcessResponseDocument runProcess(ModelRunProcessRequestDocument req);
-
+
+ @POST
+ @Path("/get_list")
public WindowTabDataDocument getList(ModelGetListRequestDocument req);
+ @POST
+ @Path("/create_data")
public StandardResponseDocument createData(ModelCRUDRequestDocument req);
+ @POST
+ @Path("/update_data")
public StandardResponseDocument updateData(ModelCRUDRequestDocument req);
+ @POST
+ @Path("/delete_data")
public StandardResponseDocument deleteData(ModelCRUDRequestDocument req);
+ @POST
+ @Path("/read_data")
public WindowTabDataDocument readData(ModelCRUDRequestDocument req);
-
+
+ @POST
+ @Path("/query_data")
public WindowTabDataDocument queryData(ModelCRUDRequestDocument req);
- public StandardResponseDocument createUpdateData(ModelCRUDRequestDocument req);
+ @POST
+ @Path("/create_update_data")
+ public StandardResponseDocument createUpdateData(ModelCRUDRequestDocument req);
}
diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java
index 32b11a47eb..a319536563 100644
--- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java
+++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/adinterface/ModelADServiceImpl.java
@@ -42,6 +42,7 @@ import javax.jws.WebService;
import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceContext;
+import org.apache.cxf.jaxrs.ext.MessageContext;
import org.apache.xmlbeans.StringEnumAbstractBase.Table;
import org.compiere.model.Lookup;
import org.compiere.model.MColumn;
@@ -147,9 +148,10 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
log.info("Creating session object ADService");
}
- public ModelADServiceImpl(WebServiceContext ctx)
+ public ModelADServiceImpl(WebServiceContext soapContext, MessageContext jaxrsContext)
{
- this.ctx =ctx;
+ this.jaxwsContext = soapContext;
+ this.jaxrsContext = jaxrsContext;
log.info("Creating session object ADService");
}
diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java
index 7febafedd9..63e577d11c 100644
--- a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java
+++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/AbstractService.java
@@ -25,6 +25,7 @@ import java.util.Properties;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.core.Context;
import javax.xml.namespace.QName;
import javax.xml.ws.WebServiceContext;
import javax.xml.ws.handler.MessageContext;
@@ -68,7 +69,10 @@ public class AbstractService {
+ "AND WS_WebServiceType_ID=?";
private static final String COMPIERE_SERVICE = "CompiereService";
@Resource
- protected WebServiceContext ctx;
+ protected WebServiceContext jaxwsContext; //soap context
+
+ @Context
+ protected org.apache.cxf.jaxrs.ext.MessageContext jaxrsContext ; //rest context
/**
* Login to web Services
@@ -193,8 +197,6 @@ public class AbstractService {
*/
protected String authenticate(String webServiceValue, String methodValue, String serviceTypeValue, CompiereService m_cs) {
- HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
-
MWebService m_webservice = MWebService.get(m_cs.getCtx(), webServiceValue);
if (m_webservice == null || !m_webservice.isActive())
return "Web Service " + webServiceValue + " not registered";
@@ -229,7 +231,7 @@ public class AbstractService {
if (m_webservicetype == null)
return "Service type " + serviceTypeValue + " not configured";
- req.setAttribute("MWebServiceType", m_webservicetype);
+ getHttpServletRequest().setAttribute("MWebServiceType", m_webservicetype);
// Check if role has access on web-service
String hasAccess = DB.getSQLValueStringEx(null, ROLE_ACCESS_SQL,
@@ -271,7 +273,9 @@ public class AbstractService {
* @return Compiere Service object for current request
*/
protected CompiereService getCompiereService() {
- HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
+
+ HttpServletRequest req = getHttpServletRequest();
+
CompiereService m_cs = (CompiereService) req.getAttribute(COMPIERE_SERVICE);
if (m_cs == null) {
m_cs = new CompiereService();
@@ -285,9 +289,8 @@ public class AbstractService {
* @return
*/
protected MWebServiceType getWebServiceType() {
- HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
- return (MWebServiceType) req.getAttribute("MWebServiceType");
+ return (MWebServiceType) getHttpServletRequest().getAttribute("MWebServiceType");
}
@@ -296,7 +299,7 @@ public class AbstractService {
* @return
*/
protected Map getRequestCtx() {
- HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
+ HttpServletRequest req = getHttpServletRequest();
@SuppressWarnings("unchecked")
Map reqCtx= (Map)req.getAttribute("RequestCtx");
@@ -631,5 +634,18 @@ public class AbstractService {
return null;
}
+ /**
+ * Get HttpServletRequest object
+ * @return HttpServletRequest
+ */
+ private HttpServletRequest getHttpServletRequest() {
+ HttpServletRequest req;
+ if (jaxrsContext != null) {
+ req = (HttpServletRequest) jaxrsContext.getHttpServletRequest();
+ } else
+ req = (HttpServletRequest) jaxwsContext.getMessageContext().get(
+ MessageContext.SERVLET_REQUEST);
+ return req;
+ }
}
diff --git a/org.idempiere.webservices/WEB-INF/web.xml b/org.idempiere.webservices/WEB-INF/web.xml
index b3a64b03cd..f83446e40a 100644
--- a/org.idempiere.webservices/WEB-INF/web.xml
+++ b/org.idempiere.webservices/WEB-INF/web.xml
@@ -9,6 +9,7 @@
contextConfigLocation
classpath:/META-INF/cxf/services.xml
+ classpath:/META-INF/cxf/rest-context.xml
diff --git a/org.idempiere.webservices/build.properties b/org.idempiere.webservices/build.properties
index 8e20228574..b5865d5ec4 100644
--- a/org.idempiere.webservices/build.properties
+++ b/org.idempiere.webservices/build.properties
@@ -24,7 +24,8 @@ bin.includes = META-INF/,\
WEB-INF/lib/idempiere-xmlbeans-1.0.jar,\
plugin.xml,\
WEB-INF/lib/axis.jar,\
- WEB-INF/lib/commons-discovery-0.5.jar
+ WEB-INF/lib/commons-discovery-0.5.jar,\
+ WEB-INF/lib/jsr311-api-1.1.jar
src.includes = WEB-INF/classes/,\
WEB-INF/lib/,\
WEB-INF/web.xml,\