as400 web services

1400 pts.
Tags:
AS/400
how to send value in another program through as400 webservices

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Discuss This Question: 9  Replies

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • TomLiotta
    The question is vague. For some technical background, try these two sites:   Tutorial - Building a Web service from an RPG program using iSeries Web services tools   Consuming Web services from RPG or COBOL programs on System i   One or the other of those should get you started. You should learn enough to try a few tests, and then see what problems you might run into.   Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    See the 'IT Discussions' page for my response. It might show up in this thread eventually, but it's never certain.   Tom
    125,585 pointsBadges:
    report
  • 9783444184
    my calling program code is: DQtmhWrStout pr extproc('QtmhWrStout') DDtaVar 32767a options(*varsize) const DDtaVarLen 10i 0 const DErrorCode 8000a options(*varsize) DErrCode ds qualified DBytesProv 10i 0 inz(0) DBytesAvail 10i 0 DQtmhGetEnv pr extproc('QtmhGetEnv') D EnvRec 1024 D EnvLen 10I 0 D EnvRecLen 10I 0 D EnvName 12 D EnvNameLen 10I 0 D ErrorCode 8000A Options(*varsize) D EnvVal S 1024A D EnvBufLen S 10I 0 Inz(%size(EnvVal)) D EnvValLen S 10I 0 D EnvName S 30A D EnvNameLen S 10I 0 D*WPError DS D* EBytesP 1 4B 0 INZ(40) D* EBytesA 5 8B 0 D* EMsgID 9 15 D* EReserverd 16 16 D* EData 17 56 Dcrlf c x'0d25' Ddata s 1000a varying D Str S 200A varying F*SRCHMSGD cf e workstn sfile(msgsfl:rrn) F*RTVAOBJD1 cf e workstn sfile(msgsfl:rrn) f* infds(infds) d infds ds d currec 378 379b 0 Dmsg S 10a varying dpgm sds dpgmq *proc d@wrkstn 244 253 * Input parameteres D*MSGFTOPF PR EXTPGM('SRCHMSG') D* #STRNG 15a D* QualMsg 20a const D*MSGFTOPF PI D* #STRNG 15a D QualMsg 20a * Define RTVMSG API Drtvmsg PR extpgm('QMHRTVM') D rtvVariable 2096 D rtvVarLen 10I 0 CONST D rtvFormat 8 CONST D rtvID 7 CONST D rtvMsgQ 20 CONST D rtvMsgDta 100 CONST D rtvMsgDtaLen 10I 0 CONST D rtvReplaceVar 10 CONST D rtvReturnCtl 10 CONST D apiErr 272 D rtvOption 10 D rtvCCSIDCnvT 10I 0 CONST D rtvCCSIDRplD 10I 0 CONST * Define API error structure D apiErr DS D ErrBytesProv 10I 0 inz(272) D ErrBytesAvai 10I 0 D ErrMsgId 7 D ErrMsgSev 1 D ErrMsgDta 256 * Define RTVMSG API receiver area D RTVM0300 DS D rtvbytesRet 10I 0 D rtvbytesAvl 10I 0 D rtvMsgSev 10I 0 D rtvAlertIdx 10I 0 D rtvAlertOpt 9 D rtvLogInd 1 D rtvMsgID 7 D rtvReserve1 3 D rtvSubVar# 10I 0 D rtvCCSIDText 10I 0 D rtvCCSIDRplT 10I 0 D rtvCCSIDRetT 10I 0 D rtvDftRpyOff 10I 0 D rtvDftRpyLen 10I 0 D rtvMsgOff 10I 0 D rtvMsgLenRet 10I 0 D rtvMsgLenAvl 10I 0 D rtvMsgHOff 10I 0 D rtvMsgHLnRet 10I 0 D rtvMsgHLnAvl 10I 0 D rtvSubVarRet 10I 0 D rtvSubVarAvl 10I 0 D rtvSubVarElm 10I 0 D rtvData 2000 * Program variables D msgFileLib s 20 D msgData s 100 D rcvID s 7 D rtvOption s 10 D rtvCCSIDCnvT s 10I 0 inz(0) D rtvCCSIDRplD s 10I 0 inz(0) dRtvObj pr extpgm('QUSROBJD') d ObjInfo 65535a options(*varsize) d LenObjInfo 10i 0 const d Format 8a const d QualObjN 20a const d ObjType 10a const d QUSEC likeds(QUSEC) options(*nopass) d ASPCtl 65535a const options(*nopass) /copy qsysinc/qrpglesrc,qmhrtvm /copy qsysinc/qrpglesrc,qusrobjd /copy qsysinc/qrpglesrc,qusec dObjInfo ds qualified d API likeds(QUSD0100) D rtvMsgQ ds D #msgFile 10 D #msgFileLib 10 d istrng s 100a D#POS s 3 0 D#LEN s 3 0 D#fstr s 10 D#nxt s 1 D#prv s 1 D#STRNG s 10 D$msg s 135 c* *entry plist c* parm strNG 10 c* c* eval strng=%trim(strng) * Read all messages until the end c c exsr $GetQSr c exsr $Header c exsr main c eval *inlr=*on c main begsr c* eval $STR=#strng C EVAL QualMsg='SSAZ01 NRAO ' C eval rtvMsgQ =QualMsg C IF %SUBST(#msgFileLib:1:1)='*' C C callP rtvOBJ(ObjInfo: C %len(ObjInfo): C 'OBJD0100': C rtvMsgQ: C '*MSGF': C QUSEC) C EVAL #msgFileLib=ObjInfo.API.QUSRL01 C ENDIF C Eval msgFileLib = #msgFile C Eval %subst(msgFileLib:11) = #msgFileLib c* eval DWRKSTN=@wrkstn c* eval DPRGN=pgmq c* eval $libl=#msgFileLib c* eval $MSGF1=#msgFile c exsr loadsr c endsr c loadsr begsr C Eval rtvOption = '*FIRST' C Dou (rtvMsgID = *blanks or ErrMsgID <> c *blanks) C callP rtvmsg(RTVM0300: C %len(RTVM0300): C 'RTVM0300': C rcvID: C msgFileLib: C msgData: C %len(msgData): C '*NO ': C '*NO ': C apiErr: C rtvOption: C rtvCCSIDCnvT: C rtvCCSIDRplD) C If rtvMsgID <> *blanks and C ErrMsgID = *Blanks C Eval $msg =%subst(rtvData:9:rtvMsgLenAvl) c EVAL #pos=%scan(%trim(#STRNG):$msg) c if #pos>0 /free data = '<tr>' +crlf + ' <TD>' + rtvMsgID + '</td>' +crlf + ' <td>' + $msg + '</td>' +crlf + '</tr>' +crlf; QtmhWrStout(data: %len(data): ErrCode); /end-free c endif C Eval rcvID = rtvMsgID C Eval rtvOption = '*NEXT' C Endif C EndDo /free data = ' </table>' + CRLF + ' </body>' + CRLF + '</html>' + CRLF; QtmhWrStout(data: %len(data): ErrCode); /end-free c endsr ************************************************************************** C $Header BEGSR * /free data = 'content-type: text/html' +crlf +CRLF +'<html><head> ' +crlf +'<title>Srchmsg</title> ' +crlf +'</head> '+CRLF +'<table border="0">'+CRLF +'<tr><td>'+crlf +'<img alt="" src="/itti/amit/ITTI Logos/JPG'+crlf +'/ITTI-NewLogo-150x.jpg"/></td>'+crlf +'<table style="width:100%;" border="0">'+CRLF +'<tr><TD align="center">' +crlf +'<big><big>SRCHMSG</big></big></TD></TR>'+crlf +'</TABLE> '+CRLF +'<table style="width:100%;" border="1">'+CRLF; QtmhWrStout(data: %len(data): ErrCode); /end-free C ENDSR C $GetQSr BEGSR /FREE EnvName = 'QUERY_STRING'; EnvNameLen = %Len(%Trim(EnvName)); QtmhGetEnv(EnvVal : EnvBufLen : EnvValLen : EnvName : EnvNameLen : ErrCode); STR = %SubSt(EnvVal : 1 : EnvValLen); If %Len(STR) >= 10 and %SubSt(Str : 1 : 9) ='STRNG='; #STRNG = %SubSt(STR: 10); Else; #STRNG=''; EndIf; /end-free C ENDSR
    1,400 pointsBadges:
    report
  • 9783444184
    where DQtmhWrStout pr extproc('QtmhWrStout') DDtaVar 32767a options(*varsize) const DDtaVarLen 10i 0 const DErrorCode 8000a options(*varsize) DErrCode ds qualified DBytesProv 10i 0 inz(0) DBytesAvail 10i 0 Dcrlf c x'0d25' Ddata s 1000a varying c c exsr $Header c eval *inlr=*on ************************************************************************** C $Header BEGSR * /free data = 'content-type: text/html' +crlf +CRLF +'<html><head> ' +crlf +'<title>Srchmsg</title> ' +crlf +'</head> '+CRLF +'<body><table border="0">'+CRLF +'<tr><td>'+crlf +'<img alt="" src="/itti/amit/ITTI Logos/JPG'+crlf +'/ITTI-NewLogo-150x.jpg"/></td>'+crlf +'<table style="width:100%;" border="0">'+CRLF +'<tr><TD align="center">' +crlf +'<big><big>SRCHMSG</big></big></TD></TR></TABLE>'+crlf +'<form action="/amit/SRCHMSG.PGM"method="GET">'+crlf +'<input type=text name=strng size=10>'+crlf +'<input type=submit value="Search!">'+crlf +'</form>'+crlf +'</body>'+crlf +'</html>'+crlf; QtmhWrStout(data: %len(data): ErrCode); /end-free C ENDSR to call is this
    1,400 pointsBadges:
    report
  • 9783444184
    now my problem is this how to get value in my call program "srchmsg" when i call this from web browser its goes in server jobs shoing"waiting for reply to message"
    1,400 pointsBadges:
    report
  • TomLiotta
    It will probably be a day or two before I can format that code to make it all readable. I'll see how much time I can find to look at it. -- Tom
    125,585 pointsBadges:
    report
  • TomLiotta
    ”waiting for reply to message”   First, what message is it waiting on? Most likely, the QSYSOPR message queue is showing that an error has shown up and it needs a response. The server joblog also probably shows more data on what happens.   Also, can you explain what you expect the code to do? For example, why are you calling the QMHRTVM API? Are you planning on working with message descriptions in a browser?   I have a fairly clean version of the code you pasted. Now I need an explanation of its purpose since it seems to be missing small pieces.   Tom
    125,585 pointsBadges:
    report
  • 9783444184
    Hi tom,sorry actually i am busy with my same program i have solved it and its run in web browser .
    1,400 pointsBadges:
    report
  • 9783444184
    For run as400 program in web browser you have to use QtmhWrStout QtmhGetEnv,and html get or post request method or you can use java fro send query string variable in one page to other page ,for read query string variable use QtmhGetEnv api.
    1,400 pointsBadges:
    report

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy

Thanks! We'll email you when relevant content is added and updated.

Following