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

RE: WSDL2RPG and cookies



Hi Scott,
	Thank you very much for your reply.  And I agree with you regarding the problem, why isn't the HTTPAPI sending the cookies back.  I have no idea where to look.  Following is the debuglist.
	When I debugged the program, all programs are running in the same actgrp, but can the actgrp not be active between calls?  

Here is the debug when I login to the webservice.
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/users.asmx HTTP/1.1                                          
Host: www.ss.is                                                                   
User-Agent: http-api/1.24                                                         
Content-Length: 323                                                                                                      
Content-Type: text/xml                                                                                                   
SOAPAction: http://tempuri.org/Login                                                                                     
sendraw(): entered  
                                                                                                     
HERE COMES THE XML STRING AND IS NOT DISPLAYED
recvresp(): entered                                                                                                      
HTTP/1.1 200 OK                                                                                                          
Cache-Control: private, max-age=0                                                                                        
Content-Length: 1107                                                                                                     
Content-Type: text/xml; charset=utf-8                                                                                    
Server: Microsoft-IIS/7.0                                                                                                
X-AspNet-Version: 2.0.50727                                                                                              
Set-Cookie: ecusername411d=ss_admin; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/                                       
Set-Cookie: eclogintime411d=634514302015957123; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/                            
Set-Cookie: ecsessionid411d=65998bd88a634d08bb4a41d775b583f1; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/              
Set-Cookie: ecsession411d=634514302015957123W2Z2vwUux81zeqMi1pgbYV3Nx3LcZ; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/
Set-Cookie: ecsession411d=634514302015957123W2Z2vwUux81zeqMi1pgbYV3Nx3LcZ; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/
Set-Cookie: eclangid411d=354; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/                                             
Set-Cookie: ecuserid411d=4776; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/                                            
X-Powered-By: ASP.NET                                                                                                   
Date: Mon, 12 Sep 2011 13:16:41 GMT                                                                                     
SetError() #13: HTTP/1.1 200 OK                                                                                         
recvresp(): end with 200                                                                                                
recvdoc parms: identity 1107                                                                                            
header_load_cookies() entered                                                                                           
cookie_parse() entered                                                                                                  
cookie =  ecusername411d=ss_admin; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/                                        
cookie attr ecusername411d=ss_admin                                                                                     
cookie attr expires=Tue, 06-Aug-2013 23:55:41 GMT                                                                       
cookie attr path=/                                                                                                      
cookie_parse() entered                                                                                                  
cookie =  eclogintime411d=634514302015957123; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/                             
cookie attr eclogintime411d=634514302015957123                                                                          
cookie attr expires=Tue, 06-Aug-2013 23:55:41 GMT                                                                       
cookie attr path=/                                                                                                      
cookie_parse() entered                                                                                                  
cookie =  ecsessionid411d=65998bd88a634d08bb4a41d775b583f1; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/               
cookie attr ecsessionid411d=65998bd88a634d08bb4a41d775b583f1                                                            
cookie attr expires=Tue, 06-Aug-2013 23:55:41 GMT                                                                       
cookie attr path=/                                                                                                      
cookie_parse() entered                                                                                                  
cookie =  ecsession411d=634514302015957123W2Z2vwUux81zeqMi1pgbYV3Nx3LcZ; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/  
cookie attr ecsession411d=634514302015957123W2Z2vwUux81zeqMi1pgbYV3Nx3LcZ                                               
cookie attr expires=Tue, 06-Aug-2013 23:55:41 GMT                                                                       
cookie attr path=/                                                                                                      
cookie_parse() entered                                                                                                  
cookie =  eclangid411d=354; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/                                               
cookie attr eclangid411d=354                                                                                            
cookie attr expires=Tue, 06-Aug-2013 23:55:41 GMT                                                                       
cookie attr path=/                                                                                                      
cookie_parse() entered                                                                                                  
cookie_parse() entered                                                         
cookie =  ecuserid411d=4776; expires=Tue, 06-Aug-2013 23:55:41 GMT; path=/     
cookie attr ecuserid411d=4776                                                  
cookie attr expires=Tue, 06-Aug-2013 23:55:41 GMT                              
cookie attr path=/                                                             
recvdoc(): entered                                                             
SetError() #0:                                                                 
HERE COMES THE XML WHICH IS RECEIVED FROM THE WEBSERVICE AND IS NOT DISPLAYED.
WSDL2RPG Ver 1.13 released 2011-01-21                                              
                                                                                   
Warning: Received unexpected Soap header: <Action>                                 
Warning: Received unexpected Soap header: http://tempuri.org/LoginResponse         
Warning: Received unexpected Soap header: </Action>                                
Warning: Received unexpected Soap header: <MessageID>                              
Warning: Received unexpected Soap header: uuid:92434d90-5116-4bdc-9751-1d421ad9740a
Warning: Received unexpected Soap header: </MessageID>                             
Warning: Received unexpected Soap header: <RelatesTo>                              
Warning: Received unexpected Soap header: uuid:11362ffd-5f3a-42a3-bbed-a97f09138a3b
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-12T13:16:41Z                                              
Warning: Received unexpected Soap header: </Created>                                                        
Warning: Received unexpected Soap header: <Expires>                                                         
Warning: Received unexpected Soap header: 2011-09-12T13:21:41Z                                              
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>                                                       
http_close(): entered                                                                                       

AND HERE IS THE DEBUGLIST AFTER I CALLED THE LOGON AND CALLED THE WEBSERVICE FOR THE ITEMMASTER.
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 IS THE XML WHICH IS SENT TO THE WEBSERVICE AND IS NOT DISPLAYED.                                                       
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: Mon, 12 Sep 2011 13:38:54 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="http://schemas.xmlsoap.org/soap/envelope/"; xml
   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> 

I don't know how to send the cookies back to the webservice.  As you said Scott, the http_use_cookies(*ON) is default, so I thought that would be enough to send the cookes, but I'm missing something.

Thank you very much for every help.

Kjartan

                                                                                                               
WSDL2RPG Ver 1.13 released 2011-01-21                                                                          

Date: Mon, 12 Sep 2011 13:38:54 GMT              
-----Original Message-----
From: ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx [mailto:ftpapi-bounces@xxxxxxxxxxxxxxxxxxxxxx] On Behalf Of Scott Klement
Sent: 9. september 2011 17:58
To: HTTPAPI and FTPAPI Projects
Subject: Re: WSDL2RPG and cookies

Hello Kjartan,

My comments are in-line:

> 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).

Actually, http_use_cookies() has defaulted to *ON since version 1.16 of HTTPAPI.

> 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

Can you tell us more about this program?   I assume it also uses 
HTTPAPI?  If so, you should be able to create a debug log, or look at the variables in debug to see the cookies being received, parsed, and stored in the cookie array.  Does all look okay with them?

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

Okay.  Can you see it sending the cookie back (again, by looking at a debug log?)  This is really what you are trying to troubleshoot... why isn't a cookie being sent back?  If the cookie is still in memory, and not sent, you probably have to step through the code to determine why.

Also (Thomas already pointed this out) by default, Cookies are kept in the HTTPAPI *SRVPGM's memory. That means that both of your programs need to run in the same actgrp, and that actgrp needs to remain active between calls...  otherwise the cookies will be lost.

You can circumvent this by calling http_cookie_file() and asking HTTPAPI to store it's cookies on disk where they can be re-retrieved.  (Make sure you do this in both programs, and specify the same file.)

Your debug file doesn't show any cookies being transmitted...
-----------------------------------------------------------------------
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
-----------------------------------------------------------------------