×

Good News Everybody!

The new search engine is LIVE!

Please report any problems to david (at) midrange.com.




Yippee, all is working now. Thanks for all the help.

One last question. In your example when you specify the parameters as
*PATH_PARAM you also have the ability to specify a regex expression {store:
{1,3}}. I couldn't see anywhere to specify this for *QUERY_PARAMs. Is
there a way to do this?

Thanks,

Rob

On Mon, Aug 3, 2020 at 1:57 PM Robert Rogerson <rogersonra@xxxxxxxxx> wrote:

Thanks again Nadir. I have some higher priority work today but hopefully
I'll be able to attempt to reproduce your tests tomorrow.

Thanks,

Rob

On Mon, Aug 3, 2020 at 12:37 PM Nadir Amra <amra@xxxxxxxxxx> wrote:

Update urls so that they would be visible....


"WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx> wrote on 08/03/2020
11:31:34
AM:

From: "Nadir Amra" <amra@xxxxxxxxxx>
To: "Web Enabling the IBM i \(AS/400 and iSeries\)"
<web400@xxxxxxxxxxxxxxxxxx>
Date: 08/03/2020 11:31 AM
Subject: [EXTERNAL] Re: [WEB400] IWS, REST and retrieving variables
from QUERY_STRING
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx>

I created a simple procedure as follows:

**free
CTL-OPT NOMAIN PGMINFO(*PCML:*MODULE:*DCLCASE);

dcl-proc GetAllClaims export;
dcl-pi *n extproc(*dclcase);
store ZONED(8 : 0) const;
warehouse ZONED(8 : 0) const;
status varchar(100) const;

outBuffer varchar(1000);
end-pi;

outBuffer = 'store=' + %CHAR(store) + '; warehouse=' +
%CHAR(warehouse)
+ '; status=' + status;

return;
end-proc GetAllClaims;


I deployed with following attributes:

Procedure name: GetAllClaims
HTTP request method: GET
URI path template for method: {store: \d{1,3}}
HTTP response code output parameter: *NONE
HTTP header array output parameter: *NONE
HTTP header information: *NONE
Error response output parameter:
Allowed input media types: *ALL
Returned output media types: *JSON
Identifier for input wrapper element: GetAllClaimsInput
Identifier for input wrapper element: GetAllClaimsResult

Input parameter mappings:
Parameter name Data type Input source Identifier Default
Value
store zoned *PATH_PARAM store *NONE
warehouse zoned *QUERY_PARAM warehouse 0
status varchar *QUERY_PARAM status *NONE

And I did not have any problems. When I used URL:
http://host.ibm.com:10010/web/services/INJECT/123/?warehouse=444&status=up
https://urldefense.proofpoint.com/v2/url?
, I got:

{"outBuffer":"store=123; warehouse=0; status="}

When I used
http://host.ibm.com:10010/web/services/INJECT/123/?warehouse=444 , I
got:

{"outBuffer":"store=123; warehouse=444; status="}

When I used
http://host.ibm.com:10010/web/services/INJECT/123/?warehouse=444&status=up
, I got:

{"outBuffer":"store=123; warehouse=444; status=up"}

If you are still having problems, then you should load latest IWS
PTF[1]
and it would be a good idea to load latest HTTP group PTF[2].

[1] https://www.ibm.com/support/pages/node/1138612

[2] https://www.ibm.com/support/pages/node/6211843


"WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx> wrote on 08/03/2020
09:29:56
AM:


From: Robert Rogerson <rogersonra@xxxxxxxxx>
To: "Web Enabling the IBM i (AS/400 and iSeries)"
<web400@xxxxxxxxxxxxxxxxxx>
Date: 08/02/2020 08:12 PM
Subject: [EXTERNAL] Re: [WEB400] IWS, REST and retrieving
variables
from QUERY_STRING
Sent by: "WEB400" <web400-bounces@xxxxxxxxxxxxxxxxxx>

I was unsuccessful in what I was trying so let me post what I'm
trying
to
do so someone can comment on if I'm taking the correct approach.
As
stated
earlier I am using IWS.

I have an API /web/services/claims If I call this I ant return
all
claims. If I want all claims for an individual store I would call
/web/services/claims/188 which would return all claims for store
188.
But
I also want to be able to filter the results by warehouse and/or
status
so
I'm thinking these would be injected(?) into the query string
/web/services/claims/188/?whid=95&stat=C.
My prototype looks like this

dcl-proc GetAllClaims export;
dcl-pi *n extproc(*dclcase);
store like(ossushpTmp.o1cus#) const;
warehouse like(ossushpTmp.o1whid) const;
stat like(ossushpTmp.o1stat) const;
claimsHdrDs_length int(10);
claimsHdrDs likeds(claimsHdrDsTmp) dim(1000)
options(*varsize);
httpStatus int(10);
httpHeaders char(100) dim(10);
end-pi;

When I enter this in the wizard on Deploy New Service (step 9 of
9),
on
the
Methods tab I see
*Procedure name*:GetAllClaims
*HTTP **request method*:GET
*URI path template for method*:{store: \d{1,3}}
*HTTP response code output parameter*:httpStatus
*HTTP header array output parameter*:httpHeaders
*Allowed input media types*:*ALL
*Returned output media types*:*JSON
*Input parameter mappings:*
Parameter nameData typeInput sourceIdentifierDefault Value
store zoned *PATH_PARAM store *NONE
warehouse zoned *QUERY_PARAM warehouse 0
status char *QUERY_PARAM status '*NONE

This looks like what I think I'm trying to achieve.

i deploy the webservice and then call.

/web/services/claims HTTP ERROR 405 (is this because of the
path
template?)
/web/services/claims/0 All claims are returned for all
stores.

(In
the
code if the store = 0 then store is not added to the prepared
statement)
/web/services/claims/188 Only claims for store 188 are
returned
which
is correct.
/web/services/claims/188/?warehouse=93 and
/web/services/claims/188/?warehouse=93&stat=C Both filters do
not

work.



--
This is the Web Enabling the IBM i (AS/400 and iSeries) (WEB400) mailing
list
To post a message email: WEB400@xxxxxxxxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: https://lists.midrange.com/mailman/listinfo/web400
or email: WEB400-request@xxxxxxxxxxxxxxxxxx
Before posting, please take a moment to review the archives
at https://archive.midrange.com/web400.



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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

This mailing list archive is Copyright 1997-2026 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].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.