[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: WSDL2RPG and cookies



Kjartan,

I agree with you that most likely all your programs run in the same activation group. But perhaps you may use DSPSRVPGM to double check that the service programs are created with activation group *CALLER and not for a named activation group.

I also did some research on web services using cookies and I ended up with my own brand new web service with cookies.

The service is configured to use transport session scope and it worked out of the box. I just had to add "http_use_cookies(*ON);" to the stub module right after "g_pRespSoapHeader = *NULL;". I did not try it without http_use_cookies() but as Scott said, *ON is the default since 1.16 and hence it should work without it. I did not yet try that because I saw Scott's email too late.

Scott mentioned that it should be possible to persist cookies by calling http_cookie_file(). I am not sure whether or not that may help, because at least my web service did not specify an expiration date and as far as I understood HEADERR4, cookies are only written to the file if:

a) a path name had been specified
b) the expiration date is present and valid

I attached a zip file with my test programs and debug logs. Hopefully it helps you to analyze the problem.

Please notice that I cannot answer any emails for the next 7 days.

Regards,

Thomas.


Am 09.09.2011 17:36, schrieb Kjartan Þór Guðmundsson:
The program VEC010 is a RPGLE program, it calls VEC001 which is a service program for the login, if the login succeeds, VEC010 calls VEC002 which is also service program.  If I understand correctly, that to use activationgroup, the program must be created with the CRTBNDPGM, and the only program that is created with the CRTBNDPGM is VEC010.  So I assume all the programs should be in same activation group.

Kjartan


-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Thomas Raddatz
Sent: 9. september 2011 13:40
To: HTTPAPI and FTPAPI Projects
Subject: Re: WSDL2RPG and cookies

Kjartan,

I am sorry but I cannot help you with this issue. I did not yet do anything with cookies and hence I do not know what do do with them. Especially I do not know how to send the cookie back to the server or how the server can "read" a cookie that is located on your System i.

Maybe that Scott knows what to do.

But there is one thing that you should check: Does your program run in activation group *NEW? Or do you reclaim the activation group after having logged on to the web service? In these cases you should try to call
http_cookie_file() to supply an IFS file where the cookies will be stored as stated in "Cookie Testers Wanted!":

"To test cookie support you must:

a) call http_use_cookies(*ON) to turn the cookie support on. (I'm planning to default it to on, but not until it's been tested better)

b) call http_cookie_file() to supply an IFS file where the cookies will be stored. This is ONLY necessary if you want them saved between sessions. For example, if you load HTTPAPI and use it a bunch of times in the same actgrp of the same job, you don't need to save the cookies to a file. If, on the other hand, you want cookies to persist across signoff/endjob/rclactgrp calls, then you need to specify a filename and it'll save the cookies into that file."


Regards,

Thomas.



Am 08.09.2011 16:04, schrieb Kjartan Þór Guðmundsson:

     Hi,

                     I`m trying to use WSDL2RPG to generate programs to
     connect to webservices.  I generated one to logon to a webservice and
     I got a response from the webservice that the logon was accepted.  Now
     I generated another program to import an item from the itemmaster.
     And I always get the same error, Authentication failed.  After I
     contacted the programmer from the webservice he found out that the
     program that sends the item needs logon cookies.  So after some
     reading I found out that I have to specifi http_use_cookies(*ON).  I
     put it in my program (tried in the program that does the login and the
     program which sends the item from itemmaster) but I get the same
     error.  The procedure is as follows:

     1)      Run a program which calls the service program to logon to the
     webservice

     2)      Then the same program calls the service program to send the
     item from the itemmaster.


     Here is the debuglist if someone could point me in the right
     direction.


     HTTPAPI Ver 1.24beta11 released
     2010-09-09

     OS/400 Ver
     V5R3M0



     New iconv() objects set, PostRem=1208. PostLoc=0. ProtRem=819.
     ProtLoc=0

     http_persist_open():
     entered

     http_long_ParseURL(): entered

     DNS resolver retrans:
     2

     DNS resolver retry  :
     2

     DNS resolver options: x'00000136'

     DNS default domain:
     hf.local

     DNS server found:
     172.22.2.49

     DNS server found: 172.22.2.49

     http_persist_post():
     entered

     http_long_ParseURL():
     entered

     do_oper(POST): entered

     POST /ss/editor/soap/productsxt.asmx
     HTTP/1.1

     Host:
     www.ss.is

     User-Agent: http-api/1.24

     Content-Length: 1126

     Content-Type: text/xml

     SOAPAction: http://tempuri.org/Import_products

     sendraw(): entered

     Here comes the XML

     recvresp(): entered

     HTTP/1.1 500 Internal Server Error

     Cache-Control: private

     Content-Length: 1516

     Content-Type: text/xml; charset=utf-8

     Server: Microsoft-IIS/7.0

     X-AspNet-Version: 2.0.50727

     X-Powered-By: ASP.NET

     Date: Thu, 08 Sep 2011 13:44:00 GMT

     SetError() #13: HTTP/1.1 500 Internal Server Error

     recvresp(): end with 500

     recvdoc parms: identity 1516

     header_load_cookies() entered

     recvdoc(): entered

     SetError() #0:


     <?xml version="1.0" encoding="utf-8"?>

     <soap:Envelope
     xmlns:soap="[1]http://schemas.xmlsoap.org/soap/envelope/";

     xmlns:xsi="[2]http://www.w3.org/2001/XMLSchema-instance";

     xmlns:xsd="[3]http://www.w3.org/2001/XMLSchema";

     xmlns:wsa="[4]http://schemas.xmlsoap.org/ws/2004/03/addressing";

     xmlns:wsse="[5]http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss
     -wssecurity-secext-1.0.xsd"

     xmlns:wsu="[6]http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-
     wssecurity-utility-1.0.xsd">

     <soap:Header>

     <wsa:Action>[7]http://schemas.xmlsoap.org/ws/2004/03/addressing/fault<
     /wsa:Action>

     <wsa:MessageID>uuid:01acaec7-f450-4a21-a4bc-541e71bba080</wsa:MessageI
     D>

     <wsa:RelatesTo>uuid:37d24b53-06c8-4041-8eef-39b295b4c2ea</wsa:RelatesT
     o>

     <wsa:To>[8]http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anony
     mous</wsa:To>

     <wsse:Security>

     <wsu:Timestamp
     wsu:Id="Timestamp-2c8e7dc0-4b76-44cc-b2fd-b828144b97e5">

     <wsu:Created>2011-08-31T14:04:16Z</wsu:Created>

     <wsu:Expires>2011-08-31T14:09:16Z</wsu:Expires>

     </wsu:Timestamp>

     </wsse:Security>

     </soap:Header>

     <soap:Body>

     <soap:Fault>

     <faultcode>soap:Server</faultcode>

     <faultstring>System.Web.Services.Protocols.SoapException: Server was
     unable to process request. ---&gt;
     ecWeb.Application.Core.Exceptions.ecException: Authentication failed.

        at
     ecWeb.Application.ecApp.checkWebSession()

        at
     ecWeb.Web.SOAP.ProductsXT.checkAuthentication()

        at ecWeb.Web.SOAP.ProductsXT.Import_products(String
     products_xml)

        --- End of inner exception stack trace ---</faultstring><detail
     /></soap:Fault></soap:Body></soap:Envelope>

     WSDL2RPG Ver 1.13 released
     2011-01-21



     Warning: Received unexpected Soap header:
     <Action>

     Warning: Received unexpected Soap header:
     http://schemas.xmlsoap.org/ws/2004/03/addressing/fault

     Warning: Received unexpected Soap header:
     </Action>

     Warning: Received unexpected Soap header:
     <MessageID>

     Warning: Received unexpected Soap header:
     <MessageID>

     Warning: Received unexpected Soap header:
     uuid:9b48f8f5-733e-4cea-a71c-704f2440646a

     Warning: Received unexpected Soap header:
     </MessageID>

     Warning: Received unexpected Soap header:
     <RelatesTo>

     Warning: Received unexpected Soap header:
     uuid:e022913d-1ba0-47ec-9484-ce3b8787e94a

     Warning: Received unexpected Soap header:</RelatesTo>

     Warning: Received unexpected Soap header:
     <To>

     Warning: Received unexpected Soap header:
     http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous

     Warning: Received unexpected Soap header:
     </To>

     Warning: Received unexpected Soap header:
     <Security>

     Warning: Received unexpected Soap header:
     <Timestamp>

     Warning: Received unexpected Soap header:
     <Created>

     Warning: Received unexpected Soap header:
     2011-09-08T13:44:00Z

     Warning: Received unexpected Soap header:
     </Created>

     Warning: Received unexpected Soap header:
     <Expires>

     Warning: Received unexpected Soap header:
     2011-09-08T13:49:00Z

     Warning: Received unexpected Soap header:
     </Expires>

     Warning: Received unexpected Soap header:

     Warning: Received unexpected Soap header:
     </Timestamp>

     Warning: Received unexpected Soap header:

     Warning: Received unexpected Soap header:</Security>

     SetError() #13: HTTP/1.1 500 Internal Server Error

     http_close(): entered



     Kindest regards,


     Kjartan

References

     1. http://schemas.xmlsoap.org/soap/envelope/
     2. http://www.w3.org/2001/XMLSchema-instance
     3. http://www.w3.org/2001/XMLSchema
     4. http://schemas.xmlsoap.org/ws/2004/03/addressing
     5. http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd
     6. http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd
     7. http://schemas.xmlsoap.org/ws/2004/03/addressing/fault
     8. http://schemas.xmlsoap.org/ws/2004/03/addressing/role/anonymous




----------------------------------------------------------------------
- This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
----------------------------------------------------------------------
-
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------
-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------

Attachment: cookies_2011-09-09.ZIP
Description: Zip archive

-----------------------------------------------------------------------
This is the FTPAPI mailing list.  To unsubscribe, please go to:
http://www.scottklement.com/mailman/listinfo/ftpapi
-----------------------------------------------------------------------