留言板

Lifeary web service URL with db view

Traolly Xiong,修改在7 年前。

Lifeary web service URL with db view

Regular Member 帖子: 195 加入日期: 11-12-30 最近的帖子
Hello All,
I have a current issue using a web service URL to retrieve a record data from a db view.

ex) http://localhost:8080/api/jsonws/qad-request-portal-portlet.altiris/get-a-record/id/1259

Error: 18:44:05,910 ERROR [http-bio-8080-exec-137][JSONWebServiceServiceAction:97] No JSON web service action associated with path /altiris/get-a-record and method GET for //qad-request-portal-portlet

My setup:
1) "service.xml":

<entity name="Altiris" table="vwAltirisSoftwareRecords" session-factory="myAppSessionFactory" tx-manager="myAppTransactionManager" local-service="true" human-name="Altiris_view">
<column name="ID" type="String" primary="true" />
<column name="Manufacturer" type="String" />
<column name="Product_Name" type="String" />
<column name="Version" type="String" />
<column name="Edition" type="String" />
<column name="CostPerLicense" type="String" />
<column name="Product_URL" type="String" />
</entity>

2) "AltirisLocalServiceUtil" - tested jsp / java to be working.

//*******************************************************************
// Get Record by Id
//*******************************************************************
public Altiris getARecord(String Id) {
Altiris result = null;
try {
result = AltirisLocalServiceUtil.fetchAltiris(Id);

} catch (SystemException ex) {
logger.error(ex.getMessage());
}
return result;
}

3) "AltirisServiceImpl" - tested to be working in jsp / java and "localhost:8080/api/jsonws/"

//*******************************************************************
// REST API for Altiris record by Id
//*******************************************************************
public Altiris getARecord(String Id) {
System.out.println("Id: "+Id);
return AltirisLocalServiceUtil.getARecord(Id);
}

4) Query from browser api UI: http://localhost:8080/api/jsonws?contextPath=/qad-request-portal-portlet&signature=%2Fqad-request-portal-portlet%2Faltiris%2Fget-a-record-1-Id#serviceResults

I get the results of when passing the Id value of "1259" string format

{
"ID": "1259",
"costPerLicense": "0.0000",
"edition": "-",
"manufacturer": "CutePDF",
"product_Name": "CutePDF Writer [Access Product URL to Self Install]",
"product_URL": "http://www.acrosoftware.com/products/cutepdf/Writer.asp",
"version": "Current"
}

5) When I copy the URL example into a browser, it does NOT work and the error at top is thrown.

http://localhost:8080/api/jsonws/qad-request-portal-portlet.altiris/get-a-record/id/1259

So that's the issue, but what confuses me is, if I use a different column "Product_Name" to be the primary, and passed in a product name
value, #5) works just fine in a browser.

Hope this make sense.

Thoughts anyone?

Thanks in advance.
Traolly Xiong,修改在7 年前。

RE: Lifeary web service URL with db view

Regular Member 帖子: 195 加入日期: 11-12-30 最近的帖子
I found that since the new column was added later to the db view, the local db table was not updated with the new column.
I deleted all the related local db tables, rebuilt the service, war, and deploy. T

That resolved the issue.

Hope this helps.