AGS call from .net to Lawson 9.0

 49 Replies
 0 Subscribed to this topic
 12 Subscribed to this forum
Sort:
Page 2 of 2 << < 12
Author
Messages
PaulW
New Member
Posts: 1
New Member
    Hi I'm wondering if any of you guys could post or email me the .NET source code the work?



    The code posted on the previous page doesn't copy/paste well.

    Paul
    John Henley
    Posts: 3353
      Re: AGS call from .net to Lawson 9.0 <!-- Converted from text/plain format -->

      John Polito is emailing me the code and I will post it as an attachment.

      Thanks for using the LawsonGuru.com forums!
      John
      John Polito
      Advanced Member
      Posts: 24
      Advanced Member
        Here are the attachments that John was looking for.

        There are 2 files;
        1). Lawson Connect for VBNet.vb - has the code to connect to Lawson.

        2). PA52_4_HireAnApplicant.vb - is the code I had to write to get a PA52.4 to post and make it through a PA100.

        Let me know if you need anything else!
        Attachments
        adefunke
        New Member
        Posts: 1
        New Member
          Does anyone have the code to connect to Lawson 8.0.3 from .NET?
          vb
          Basic Member
          Posts: 12
          Basic Member
            Hi, does this approach works as well to query data out of Lawson? What would be the adjustment if so?
            Thanks.
            vb
            Basic Member
            Posts: 12
            Basic Member

              If I follow the suggestion of this topic, the url http://server.domain.com:####/lawson/portal/ I don't get any cookie at all.

              After I trace the http traffic from Internet Explorer what I found is http://server.domain.com:...ig/SSOCfgInfoServlet
               does return the JSESSIONID cookie.

              I'm still unable to get the C.LWSN cookie which is given after successful authentication.

              It's weird it work for you and It doesn't to me, Lawson is on AS400 environment, I don't know if that makes a difference, I wouldn't expect it.

              Any Ideas?

              vb
              Basic Member
              Posts: 12
              Basic Member

                adefunke, this is how it was done in an interface we have for Lawson 8:

                Dim http As String = "http://mccaina:10101/cgi-lawson/dme.exe?PROD=L80PDSAF&FILE=GLSYSTEM&FIELD=ACCT-PERIOD;Fiscal-Year&SELECT=COMPANY=220&OUT=CSV&DELIM=|&NOHEADER"

                Dim webrequest As System.Net.HttpWebRequest = CType(System.Net.WebRequest.Create(http), HttpWebRequest)
                            Dim myCred As NetworkCredential = New NetworkCredential(My.Resources.USER, My.Resources.PASSWORD, "")
                            webrequest.Credentials = myCred

                            Dim webresponse As System.Net.HttpWebResponse = CType(webrequest.GetResponse(), HttpWebResponse)

                vb
                Basic Member
                Posts: 12
                Basic Member
                  Finaly is working, thanks to all of you for your useful posts, basicaly .net was putting an additional header which we have to get ride off, the header is '100-continue', after that the code suggested works just fine.
                  Posted By vb on 10/05/2009 01:32 PM

                  If I follow the suggestion of this topic, the url http://server.domain.com:####/lawson/portal/ I don't get any cookie at all.

                  After I trace the http traffic from Internet Explorer what I found is http://server.domain.com:...ig/SSOCfgInfoServlet
                   does return the JSESSIONID cookie.

                  I'm still unable to get the C.LWSN cookie which is given after successful authentication.

                  It's weird it work for you and It doesn't to me, Lawson is on AS400 environment, I don't know if that makes a difference, I wouldn't expect it.

                  Any Ideas?



                  PaulJ
                  Basic Member
                  Posts: 9
                  Basic Member
                    @vb,

                    I'm trying to do something similar, in that from asp.net vb.net i'm trying to simply see if a user is already logged in to Lawson, so that when they link to our vb.net site, it'll bypass our login form. Could you email me the vb.net code you're using to query data out of lawson? I'm also not able to find the C.LWSN cookie. I know I'm close, just not sure what exactly i'm doing wrong. passing on your code to me would be a HUGE help. Thanks.
                    PaulJ
                    Basic Member
                    Posts: 9
                    Basic Member

                      @vb,

                      sorry, double posted. site's moving slow today.


                      vb
                      Basic Member
                      Posts: 12
                      Basic Member
                        Posted By PaulJ on 10/08/2009 08:20 AM
                        @vb,

                        I'm trying to do something similar, in that from asp.net vb.net i'm trying to simply see if a user is already logged in to Lawson, so that when they link to our vb.net site, it'll bypass our login form. Could you email me the vb.net code you're using to query data out of lawson? I'm also not able to find the C.LWSN cookie. I know I'm close, just not sure what exactly i'm doing wrong. passing on your code to me would be a HUGE help. Thanks.

                        I'm not quite sure what you are looking for but I attached the code, it may give you some ideas. Let me know how that goes.
                         

                        I have adjust the code to get ride of private information within the code. Keep in mind the error handling because it can be very fuzzy.

                        *The example code is not closing propperly the response object which should, so keep it in mind if you were not aware.

                        Attachments
                        PaulJ
                        Basic Member
                        Posts: 9
                        Basic Member

                          Thanks. Haven't had a chance to try it quite yet. What I am meaning is, say I have a user, John Doe.

                          John Doe logs into Lawson through the Lawson portal page. Once logged in, he clicks on a shortcut link that opens a new browser window and navigates to our .NET application website. I want the .NET application site to ask Lawson whether the user has already logged in to Lawson or not. Basically, we want to make it so if the user is in fact already logged into Lawson, that it will take them straight into our application without making the user have to relogin through the .NET application's login form.

                           

                          In your example, it looks like you're taking what a user types in as a username and password and actually authenticating with it to Lawson through the Http web request via POST. I don't want to do this; instead I simply want to ask Lawson, via an http web request, if the user who is navigating to our .NET page has already authenticated with Lawson.

                           

                          Does this make more sense?

                          vb
                          Basic Member
                          Posts: 12
                          Basic Member
                            Posted By PaulJ on 10/09/2009 01:58 PM

                            Thanks. Haven't had a chance to try it quite yet. What I am meaning is, say I have a user, John Doe.

                            John Doe logs into Lawson through the Lawson portal page. Once logged in, he clicks on a shortcut link that opens a new browser window and navigates to our .NET application website. I want the .NET application site to ask Lawson whether the user has already logged in to Lawson or not. Basically, we want to make it so if the user is in fact already logged into Lawson, that it will take them straight into our application without making the user have to relogin through the .NET application's login form.

                             

                            In your example, it looks like you're taking what a user types in as a username and password and actually authenticating with it to Lawson through the Http web request via POST. I don't want to do this; instead I simply want to ask Lawson, via an http web request, if the user who is navigating to our .NET page has already authenticated with Lawson.

                             

                            Does this make more sense?


                            Sure it does, what you are looking for is called 'single sign on' which I know for a fact Lawson fully support, my suggestion to you is find out if the other web app you refer to is 'single sign on' capable and then turn both on, in such case you wouldn't have to do more than actually put the 'link' you mentioned before.
                             

                            Single sign on is a configuration matter rather than a coding thing unless your other application doesn't support it. I hope this helps you a little bit more.

                            PaulJ
                            Basic Member
                            Posts: 9
                            Basic Member
                              Posted By vb on 10/09/2009 02:23 PM


                              Sure it does, what you are looking for is called 'single sign on' which I know for a fact Lawson fully support, my suggestion to you is find out if the other web app you refer to is 'single sign on' capable and then turn both on, in such case you wouldn't have to do more than actually put the 'link' you mentioned before.
                               

                              Single sign on is a configuration matter rather than a coding thing unless your other application doesn't support it. I hope this helps you a little bit more.

                               

                              This sounds alot easiser, however, again an example would help. My "other web app" is a vb.net app. From what I've read about single sign on in ASP.NET, it seems that both website applications would need the "same machine keys". These seems more specific to allowing single sign on between 2 .NET applications.

                               

                              Could you provide a code example of how to get Single Sign On to work between the Lawson portal application (JSP) and a .NET application? Thanks.

                              vb
                              Basic Member
                              Posts: 12
                              Basic Member
                                Posted By PaulJ on 10/13/2009 08:51 AM
                                Posted By vb on 10/09/2009 02:23 PM


                                Sure it does, what you are looking for is called 'single sign on' which I know for a fact Lawson fully support, my suggestion to you is find out if the other web app you refer to is 'single sign on' capable and then turn both on, in such case you wouldn't have to do more than actually put the 'link' you mentioned before.
                                 

                                Single sign on is a configuration matter rather than a coding thing unless your other application doesn't support it. I hope this helps you a little bit more.

                                 

                                This sounds alot easiser, however, again an example would help. My "other web app" is a vb.net app. From what I've read about single sign on in ASP.NET, it seems that both website applications would need the "same machine keys". These seems more specific to allowing single sign on between 2 .NET applications.

                                 

                                Could you provide a code example of how to get Single Sign On to work between the Lawson portal application (JSP) and a .NET application? Thanks.


                                This may give you some ideas:
                                 

                                http://publib.boulder.ibm...ng/iiyva_ldapd02.htm

                                http://www.codeproject.co.../dotnet/LDAPSSO.aspx

                                http://www.c-sharpcorner....mAuthentication.aspx

                                 

                                vb
                                Basic Member
                                Posts: 12
                                Basic Member

                                  By the way, for the code I have shown which allows you to query data out of Lawson, I think makes sense to add this lines at the end of the code,It is the logout.

                                  request = CType(WebRequest.Create("http://server.mccain.com:...son/portal/index.htm"), HttpWebRequest)
                                  request.Method = _GET
                                  request.UserAgent = userAgent
                                  request.CookieContainer = cookies
                                  request.Timeout = _timeout
                                   
                                  'Look for the answer
                                   
                                   response = CType(request.GetResponse, HttpWebResponse)

                                   

                                  BigD
                                  New Member
                                  Posts: 1
                                  New Member

                                    I'm using .NET as well. Can you post the code that worked?

                                    Thanks!

                                    Ragu Raghavan
                                    Veteran Member
                                    Posts: 476
                                    Veteran Member
                                      So glad to have found this posting. I had to do an AGS call to PA52.4. Had no truble populating fields in Tab 1 and Tab2. Tab3 just would not work. One of the examples aboive showed how fields in TAB1 and TAB2 are referred to as NEW-VALUE-1r0, NEW-VALUE-2r0 etc.
                                      Howevere fields in TAB3 are referred to as NEW-VALUE-31, NEW-VALUE-32 etc.

                                      Never would have figured this out. Thanks everybody.

                                      Ragu
                                      vb
                                      Basic Member
                                      Posts: 12
                                      Basic Member

                                        You can find two dummy source code in the page number 2 of this topic, the second one is which I was able to use.

                                        mikeP
                                        Veteran Member
                                        Posts: 151
                                        Veteran Member
                                          I'm hoping this thread is still alive...

                                          I'm working with the code in 1102191951571.zip, module "Lawson Connect for VBNet.vb". The compiler (VS2008) barfs on "http" in this line:

                                          postData = "_ssoUser=" & LAWSON_UID & "&_ssoPass=" & LAWSON_PWD & "&_action=LOGIN&_fromLoginPage=FALSE&_language=en-us&_ssoOrigUrl=" & _
                                          System.Web.HttpUtility.UrlEncode(http)

                                          There's no such variable anywhere else in the code. Anyone know the proper argument to pass here?

                                          Thanks,

                                          Mike
                                          .
                                          mikeP
                                          Veteran Member
                                          Posts: 151
                                          Veteran Member
                                            Oops... I guess I should have read the comments more closely. I thought the sample code would help me but maybe not. Here's what I'm trying to do in a "satelite application" written in asp.net:

                                            Determine if user currently has an active portal session.
                                            If so, retrieve their employee number and exit.

                                            If not, accept their name and password, and authenticate against Lawson, and get their employee number.

                                            Keep their portal session alive for as long as they are in my application as if they were continuing to use portal, so they won't have to authenticate in portal when they return to it.

                                            If anyone has done something like this, I would be very appreciative of an example.

                                            Thanks,

                                            Mike
                                            .
                                            vb
                                            Basic Member
                                            Posts: 12
                                            Basic Member
                                              I'd say you can try using the example you found in this topic and based on it keep up to date the cookie in users machine, I mean do the loging and be sure the user has the cookies on his machine.

                                              I have an SSIS downloading the data out of Lawson using this approach, I do no need user interaction for it.

                                              I'm not an web expert but you may have a module responsible of keeping you application's cookies refreshed on client's side, you may be able to extend it and make the same but also to dowload and keep the Lawsons cookies on the Clients computer.

                                              As long you have the user/password and employee id handy you should be ok.
                                              vb
                                              Basic Member
                                              Posts: 12
                                              Basic Member
                                                Hi,
                                                I made an small improvement to the code due the fact when the task was failing was forcing the finishing of the ssis, righ now my task fails and allows the ssis to deal with the error.

                                                Attachments
                                                adam
                                                Posts: 3
                                                  How did you end up removed the '100-continue' portion of the header?
                                                  I'm working in .NET 2.0 (converted the code provided in this topic to C#), and having no luck. I assume my issue is tied to the same problem you were having as I cannot parse out the cookies, even though I see a JSESSIONID in the response.

                                                  Thanks.
                                                  vb
                                                  Basic Member
                                                  Posts: 12
                                                  Basic Member
                                                    Just modify this flag:

                                                    System.Net.ServicePointManager.Expect100Continue = False

                                                    and in case I'm showing the full example code in the following link if someone needs to check it.

                                                    http://vascorriendo.blogs...on-9-using-ssis.html
                                                    Page 2 of 2 << < 12