?
Solved

How to maintain a session whilst using Web Reference from a VB app.

Posted on 2008-10-18
2
Medium Priority
?
266 Views
Last Modified: 2013-11-07
We are using VB.net to consume a WSRP web service on a J Boss Java Application Server.

We have loaded the web service as a Web Reference in Visual Studio 2005 and all of the objects are exposed and works well. Until we pass through a second request or return data, this then seems to activate a new session for every Web Page.

However WSRP requires that the user session is maintained that is passed back in the response

Cookie: JSESSIONID=8B38B5A866EB5413A816A70AC7D4AA01

How can I tie the SOAP session to the users web session?

How can I configure the web reference to maintain the session state?
'Registration This can be reused
                Dim oqReg As New JbossWSRP.WSRP_v1_Registration_Binding_SOAP
 
 
                Dim oqRegCtx As JbossWSRP.RegistrationContext
                If MyBase.goApp("JbossReg") Is Nothing Then
                    Dim oqRegD As JbossWSRP.RegistrationData = New JbossWSRP.RegistrationData
                    oqRegD.consumerName = "EonicConsumer13"
                    oqRegD.consumerAgent = "EonicWeb.4.1"
                    oqRegD.methodGetSupported = False
 
                    oqRegCtx = oqReg.register(oqRegD)
 
                    MyBase.goApp("JbossReg") = oqRegCtx
 
                Else
                    oqRegCtx = MyBase.goApp("JbossReg")
                End If
 
                'getMarkup
                Dim oqMarkup As New JbossWSRP.WSRP_v1_Markup_Binding_SOAP
 
 
 
                Dim oqPortCtx As JbossWSRP.PortletContext = New JbossWSRP.PortletContext
                oqPortCtx.portletHandle = "quotation.ShippingPlusQuotationPortlet"
 
 
                Dim oqRunCtx As JbossWSRP.RuntimeContext = New JbossWSRP.RuntimeContext
                oqRunCtx.userAuthentication = "wsrp:none"
                oqRunCtx.portletInstanceKey = "shipinstance"
                oqRunCtx.namespacePrefix = "ship_namespace"
 
 
                Dim oqUserCtx As JbossWSRP.UserContext = New JbossWSRP.UserContext
                oqUserCtx.userContextKey = "1"
 
 
                Dim oMarkParams As JbossWSRP.MarkupParams = New JbossWSRP.MarkupParams
 
                oMarkParams.secureClientCommunication = False
                Dim aLocale(0) As String
                aLocale(0) = "en-GB"
                oMarkParams.locales = aLocale
                Dim aMimeTypes(0) As String
                aMimeTypes(0) = "text/html"
                oMarkParams.mimeTypes = aMimeTypes
                oMarkParams.mode = "wsrp:view"
                oMarkParams.windowState = "wsrp:normal"
                Dim oClientData As JbossWSRP.ClientData = New JbossWSRP.ClientData
                oClientData.userAgent = "Mozilla/5.0 (Macintosh; U; PPC Mac OS X 10.5; en-GB; rv:1.9.0.3) Gecko/2008092414 Firefox/3.0.3"
                oMarkParams.clientData = oClientData
 
 
 
 
 
                'Interaction Params
                If moRequest.Form.Count > 0 Then
                    'if we have a form submit the values
 
                    Dim oqInteract As JbossWSRP.InteractionParams = New JbossWSRP.InteractionParams
                    oqInteract.portletStateChange = JbossWSRP.StateChange.cloneBeforeWrite
 
                    Dim oqNamedString(moRequest.Form.Count) As JbossWSRP.NamedString
                    Dim item As Object
                    Dim i As Long = 0
                    For Each item In moRequest.Form
                        oqNamedString(i) = New JbossWSRP.NamedString
                        oqNamedString(i).name = CStr(item)
                        oqNamedString(i).value = moRequest.Form(CStr(item))
                        i = i + 1
                    Next
 
                    oqInteract.formParameters = oqNamedString
 
                    Dim oqBLKResponse As JbossWSRP.BlockingInteractionResponse
                    Dim oqBlkInt As JbossWSRP.performBlockingInteraction = New JbossWSRP.performBlockingInteraction
                    oqBlkInt.portletContext = oqPortCtx
                    oqBlkInt.registrationContext = oqRegCtx
                    oqBlkInt.markupParams = oMarkParams
                    oqBlkInt.userContext = oqUserCtx
                    oqBlkInt.runtimeContext = oqRunCtx
                    oqBlkInt.interactionParams = oqInteract
                    oqBLKResponse = oqMarkup.performBlockingInteraction(oqBlkInt)
 
                End If
 
                Dim oqResponse As JbossWSRP.MarkupResponse
                Dim oqGetMarkup As JbossWSRP.getMarkup = New JbossWSRP.getMarkup()
                oqGetMarkup.portletContext = oqPortCtx
                oqGetMarkup.registrationContext = oqRegCtx
                oqGetMarkup.markupParams = oMarkParams
                oqGetMarkup.userContext = oqUserCtx
                oqGetMarkup.runtimeContext = oqRunCtx
 
                oqResponse = oqMarkup.getMarkup(oqGetMarkup)
                sResponse = oqResponse.markupContext.markupString
                oCNode.InnerXml = sResponse
                'Strip out the form Submission URL
                Dim oFormElmt As XmlElement
                oFormElmt = oCNode.SelectSingleNode("form")
                If Not (oFormElmt Is Nothing) Then
                    oFormElmt.SetAttribute("action", "")
                End If

Open in new window

0
Comment
Question by:eonic
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 1

Accepted Solution

by:
eonic earned 0 total points
ID: 22975147
We have now written our own native SOAP handler to deal with this specific issue.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
Suggested Courses

770 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question