Hi,

I'm getting weird results while running tests with REST service on IWS
Integrated Web Services, version 2.6 running on V7R3.
The webservice returns with the message below when I do a POST or PUT
method action.

Error 500: javax.servlet.ServletException:
org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized
field "Quantity_Ordered" (Class
iseries.wsbeans.gradings03.GradingHdrRec_t), not marked as ignorable at
[Source: com.ibm.ws.webcontainer.srt.SRTInputStream@536e153c; line: 2,
column: 23] (through reference chain:
iseries.wsbeans.gradings03.GradingHdrRec_t["Quantity_Ordered"])

There are also two GET methods which works fine.
The strange thing is, that when I remove the two GET methods from the
application, the POST and PUT methods do work.

Anybody experienced this kind of behavior?

Thanks in advance,

Regards,
-Arco


The specs are as follows:

Methods:

Procedure name: GETBYIDHDR
HTTP request method: GET
URI path template for method: {id:\d+}
HTTP response code output parameter: peHttpStatus
HTTP header array output parameter: peHttpHeaders
Allowed input media types: *ALL
Returned output media types: *JSON
Input parameter mappings:
Parameter name Data type Input source Identifier Default Value
peGradingID int *PATH_PARAM id *NONE

Procedure name: GETALLHDR
HTTP request method: GET
URI path template for method: *NONE
HTTP response code output parameter: peHttpStatus
HTTP header array output parameter: peHttpHeaders
Allowed input media types: *ALL
Returned output media types: *JSON

Procedure name: UPDATEHDR
HTTP request method: PUT
URI path template for method: {id:\d+}
HTTP response code output parameter: peHttpStatus
HTTP header array output parameter: peHttpHeaders
Allowed input media types: *JSON
Returned output media types: *JSON
Input parameter mappings:
Parameter name Data type Input source Identifier Default Value
peGradingID int *PATH_PARAM id *NONE
peGradingHdrRec struct *NONE

Procedure name: CREATEHDR
HTTP request method: POST
URI path template for method: *NONE
HTTP response code output parameter: peHttpStatus
HTTP header array output parameter: peHttpHeaders
Allowed input media types: *JSON
Returned output media types: *JSON
Input parameter mappings:
Parameter name Data type Input source Identifier Default Value
peGradingHdrRec struct *NONE


RPG source:

**FREE

// Build instruction:
//
// *> IGN: DLTSRVPGM SRVPGM(&O/&ON)
// *> CRTSQLRPGI OBJ(QTEMP/&N) -
// *> SRCFILE(&L/&F) -
// *> COMMIT(*NONE) -
// *> OBJTYPE(*MODULE) -
// *> DBGVIEW(&DV)
// *> CRTSRVPGM SRVPGM(&O/&ON) -
// *> MODULE(QTEMP/&N) -
// *> EXPORT(*ALL) -
// *> ACTGRP(*CALLER) -
// *> TEXT(&X)
// *> DLTMOD MODULE(QTEMP/&N)

ctl-opt alwnull(*usrctl)
nomain
pgminfo(*pcml:*module:*dclcase) ;

dcl-ds GradingHdrRec_t qualified template ;
Quantity_Ordered packed(12: 3) ;
DummyFld char(3) ;
end-ds ;

dcl-ds GradingFullHdrRec_t qualified template ;
Grading_ID int(10) ;
Quantity_Ordered packed(12: 3) ;
end-ds ;

dcl-c H_OK 200 ;
dcl-c H_CREATED 201 ;
dcl-c H_NOCONTENT 204 ;
dcl-c H_BADREQUEST 400 ;
dcl-c H_NOTFOUND 404 ;
dcl-c H_CONFLICT 409 ;
dcl-c H_GONE 410 ;
dcl-c H_SERVERERROR 500 ;

dcl-c WEB_LOCATION 'http://power01.mg.local:10032/web/services/gradings03/'
;

// public vars for for sql precompiler
dcl-s wwGradingID int(10) ;
dcl-s wwQuantityOrdered packed(12: 3) ;
dcl-s wwIDval packed(31: 0) ;
dcl-ds wwGradingHdrRec likeds( GradingHdrRec_t ) ;
dcl-ds wwGradingFullHdrRec likeds( GradingFullHdrRec_t ) ;


//------------------------------------------------------------------//
// createHdr() : Create header record
//------------------------------------------------------------------//

dcl-proc createHdr export ;
dcl-pi *n ;
peGradingHdrRec likeds( GradingHdrRec_t ) const ;
peHttpStatus int(10) ;
peHttpHeaders char(100) dim(10) ;
end-pi ;

clear peHttpHeaders ;

wwQuantityOrdered = peGradingHdrRec.Quantity_Ordered ;

EXEC SQL
INSERT INTO Webservice_Sample_Header
(
Quantity_Ordered
)
VALUES
(
:wwQuantityOrdered
) ;


if sqlstt <> '00000' ;
peHttpStatus = H_SERVERERROR ;
endif ;

EXEC SQL
VALUES IDENTITY_VAL_LOCAL() INTO :wwIDval ;

if sqlstt = '00000' ;
peHttpStatus = H_CREATED;
peHttpHeaders(1) = 'LOCATION: '
+ WEB_LOCATION
+ %char(wwIDval) ;
else ;
peHttpStatus = H_SERVERERROR ;
endif ;


end-proc ;


//------------------------------------------------------------------//
// updateHdr() : Update header record
//------------------------------------------------------------------//

dcl-proc updateHdr export ;
dcl-pi *n ;
peGradingID int(10) const ;
peGradingHdrRec likeds( GradingHdrRec_t ) const ;
peHttpStatus int(10) ;
peHttpHeaders char(100) dim(10) ;
end-pi ;

clear peHttpHeaders ;

wwGradingID = peGradingID ;
wwQuantityOrdered = peGradingHdrRec.Quantity_Ordered ;

EXEC SQL
UPDATE Webservice_Sample_Header
SET
(
Quantity_Ordered
)
=
(
:wwQuantityOrdered
)
WHERE Grading_ID = :wwGradingID ;

if sqlstt = '00000' ;
peHttpStatus = H_NOCONTENT ;
else ;
peHttpStatus = H_NOTFOUND ;
endif ;

end-proc ;


//------------------------------------------------------------------//
// getAllHdr() : Get all header records
//------------------------------------------------------------------//

dcl-proc getAllHdr export ;
dcl-pi *n ;
peGradingCount int(10) ;
peGradingFullHdrRec likeds( GradingFullHdrRec_t )
dim(1000) options(*varsize) ;
peHttpStatus int(10) ;
peHttpHeaders char(100) dim(10) ;
end-pi ;

clear peHttpHeaders ;

peGradingCount = 0 ;

EXEC SQL
DECLARE GradingHdrCursor CURSOR FOR
SELECT
Grading_ID,
Quantity_Ordered
FROM Webservice_Sample_Header
ORDER BY Grading_ID ;

EXEC SQL OPEN GradingHdrCursor ;
if sqlstt <> '00000' ;
peHttpStatus = H_NOTFOUND ;
return ;
endif ;

dow '1' ;
clear wwGradingFullHdrRec ;
EXEC SQL
FETCH NEXT
FROM GradingHdrCursor INTO :wwGradingFullHdrRec ;

// eof test
if sqlstt = '02000' ;
leave ;
endif ;
// andere error, dan einde maar eerst cursur sluiten
if sqlstt <> '00000' ;
EXEC SQL CLOSE GradingHdrCursor ;
peHttpStatus = H_NOTFOUND ;
return ;
endif ;
peGradingCount += 1 ;
eval-corr peGradingFullHdrRec(peGradingCount) = wwGradingFullHdrRec ;
enddo ;

EXEC SQL CLOSE GradingHdrCursor ;

peHttpStatus = H_OK;
peHttpHeaders(1) = 'Cache-Control: no-cache, no-store';

end-proc ;


//------------------------------------------------------------------//
// getByIdHdr() : Get header record by Id
//------------------------------------------------------------------//

dcl-proc getByIdHdr export ;
dcl-pi *n ;
peGradingID int(10) const ;
peGradingHdrRec likeds( GradingHdrRec_t ) ;
peHttpStatus int(10) ;
peHttpHeaders char(100) dim(10) ;
end-pi ;

clear peHttpHeaders ;

wwGradingID = peGradingID ;
clear wwGradingHdrRec ;

EXEC SQL
SELECT
Quantity_Ordered,
' ' AS DymmyFld
INTO :wwGradingHdrRec
FROM Webservice_Sample_Header
WHERE Grading_ID = :wwGradingID
ORDER BY Grading_ID
;

if sqlstt <> '00000' ;
peHttpStatus = H_NOTFOUND ;
return ;
endif ;

eval-corr peGradingHdrRec = wwGradingHdrRec ;

EXEC SQL CLOSE GradingHdrCursor ;

peHttpStatus = H_OK;
peHttpHeaders(1) = 'Cache-Control: no-cache, no-store';

end-proc ;


-----------------------------------------------------------
-- Webservice_Sample_Header TABLE CREATION STATEMENTS
-----------------------------------------------------------
CREATE TABLE
Webservice_Sample_Header
(
Grading_ID FOR GRADINGID INTEGER
GENERATED ALWAYS AS IDENTITY
( START WITH 1 INCREMENT BY 1
NO MINVALUE NO MAXVALUE
NO CYCLE ORDER NO CACHE
),
Quantity_Ordered FOR QTYORDER DECIMAL(12, 3),
CONSTRAINT
Webservice_Sample_Header_Key_1
PRIMARY KEY(Grading_ID)
)
RCDFMT WSSAMHDRRF
;

RENAME TABLE Webservice_Sample_Header
TO SYSTEM NAME WSSAMHDR;

LABEL ON TABLE
Webservice_Sample_Header IS
'Webservice_Sample_Header'
;

This thread ...

Follow-Ups:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2019 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].