Search in sources :

Example 1 with MWebServiceType

use of org.compiere.model.MWebServiceType in project adempiere by adempiere.

the class ModelADServiceImpl method authenticate.

private String authenticate(String webServiceValue, String methodValue, String serviceTypeValue) throws XFireFault {
    m_webservice = MWebService.get(m_cs.getM_ctx(), webServiceValue);
    if (m_webservice == null || !m_webservice.isActive())
        return "Web Service " + webServiceValue + " not registered";
    m_webservicemethod = m_webservice.getMethod(methodValue);
    if (m_webservicemethod == null || !m_webservicemethod.isActive())
        return "Method " + methodValue + " not registered";
    m_webservicetype = null;
    final String sql = "SELECT * FROM WS_WebServiceType " + //"AND WS_WebService_ID=? " +
    "WHERE WS_WebService_ID=? " + /** End Carlos Parada */
    "AND WS_WebServiceMethod_ID=? " + "AND Value=? " + "AND IsActive='Y'";
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
        pstmt = DB.prepareStatement(sql, null);
        /** 2014-11-05 Carlos Parada Remove Client Filter */
        /*pstmt.setInt(1, m_cs.getM_AD_Client_ID());
			pstmt.setInt(2, m_webservice.getWS_WebService_ID());
			pstmt.setInt(3, m_webservicemethod.getWS_WebServiceMethod_ID());
			pstmt.setString(4, serviceTypeValue);*/
        pstmt.setInt(1, m_webservice.getWS_WebService_ID());
        pstmt.setInt(2, m_webservicemethod.getWS_WebServiceMethod_ID());
        pstmt.setString(3, serviceTypeValue);
        /** End Carlos Parada */
        System.out.println("m_webservice.getWS_WebService_ID()" + m_webservice.getWS_WebService_ID());
        System.out.println("m_webservicemethod.getWS_WebServiceMethod_ID()" + m_webservicemethod.getWS_WebServiceMethod_ID());
        System.out.println("serviceTypeValue" + serviceTypeValue);
        rs = pstmt.executeQuery();
        if (rs.next())
            m_webservicetype = new MWebServiceType(m_cs.getM_ctx(), rs, null);
    } catch (Exception e) {
        throw new XFireFault(e.getClass().toString() + " " + e.getMessage() + " sql=" + sql, e.getCause(), new QName("authenticate"));
    } finally {
        DB.close(rs, pstmt);
        rs = null;
        pstmt = null;
    }
    if (m_webservicetype == null)
        return "Service type " + serviceTypeValue + " not configured";
    return null;
}
Also used : MWebServiceType(org.compiere.model.MWebServiceType) QName(javax.xml.namespace.QName) ResultSet(java.sql.ResultSet) PreparedStatement(java.sql.PreparedStatement) XFireFault(org.codehaus.xfire.fault.XFireFault) SQLException(java.sql.SQLException)

Aggregations

PreparedStatement (java.sql.PreparedStatement)1 ResultSet (java.sql.ResultSet)1 SQLException (java.sql.SQLException)1 QName (javax.xml.namespace.QName)1 XFireFault (org.codehaus.xfire.fault.XFireFault)1 MWebServiceType (org.compiere.model.MWebServiceType)1