| Author |
Message |
Ellen Deak
Guest
|
Posted:
Thu Jun 09, 2005 4:53 pm Post subject:
How do you use ClientContext properly? |
|
|
I've been looking at the CedarBank example in the SDK to try to figure out
what I need to do for Windows Initiated Processing to an RPG program on an
AS400. I was able to successfully add an additional method to the
OS400_DPC_TCP_CedarBank_NET.DLL TI component. This method calls an RPG
program we wrote in house. I then modified the CedarBank example to call
this new method. That all worked okay.
Next, I created a new VB.NET project so I could try calling that same TI
component from a progam I wrote myself. This is where I ran into problems.
The following is the code from my program.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim s1 As String
Dim s2 As String
Dim s3 As String
s1 = "one"
s2 = "two"
s3 = ""
Dim o() As Object
Dim _cc As New Microsoft.HostIntegration.TI.ClientContext
_cc.WriteContext("USERID", "*****", o)
_cc.WriteContext("PASSWORD", "*****", o)
Dim objBPCS As New OS400_DPC_NET.CedarBank
objBPCS.BTC001(s1, s2, s3, o)
End Sub
When I run it, I get the following error.
"An unhandled exception of type System.Net.WebException occurred in
mscorlib.dll"
"Additional Information: The underlying connection was closed: The request
was canceled."
I've stepped through the CedarBank program in the debugger. I see one thing
really weird. In the CedarBank example, when this code "_cc = new
Microsoft.HostIntegration.TI.ClientContext()" executes and you examine the
contents of _cc in the debugger, it is populated with a lot of values. When
the equivalent line in my program executes, _cc remains almost empty. I've
had a couple of people with more VB.NET and C# experience than I, take a
look. But, they were stumped too.
Any suggestions or guidance would be appreciated.
Thanks,
--
Ellen Deak
HIS 2004 |
|
| Back to top |
|
 |
Rob Beardsworth [MSFT]
Guest
|
Posted:
Fri Jun 10, 2005 10:15 pm Post subject:
RE: How do you use ClientContext properly? |
|
|
Hi Ellen,
admittedly I am using Visual Studio 2005 Beta, but I see all of the static
contents of _cc when I do the "new". The only difference between what I see
in c# and in vb.net debugging is the distinction in the c# debugger between
public and non public members as shown in the "Local" window. Your usage
seems to be correct when I look at your code below. Could you use the TI
Manager to turn on WIP Tracing and see what happens when you make your
call? I am working on the assumption that once you changed your TI Assembly
in Designer (to add your new method), you re-administered it to the
appropriate Virtual Directory and then in your VB Code you re-referenced
the new "_proxy.dll" that was generated???
Rob Beardsworth
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
From: "=?Utf-8?B?RWxsZW4gRGVhaw==?=" <EllenDeak@discussions.microsoft.com>
Subject: How do you use ClientContext properly?
Date: Thu, 9 Jun 2005 06:51:04 -0700
Lines: 53
I've been looking at the CedarBank example in the SDK to try to figure out
what I need to do for Windows Initiated Processing to an RPG program on an
AS400. I was able to successfully add an additional method to the
OS400_DPC_TCP_CedarBank_NET.DLL TI component. This method calls an RPG
program we wrote in house. I then modified the CedarBank example to call
this new method. That all worked okay.
Next, I created a new VB.NET project so I could try calling that same TI
component from a progam I wrote myself. This is where I ran into problems.
The following is the code from my program.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim s1 As String
Dim s2 As String
Dim s3 As String
s1 = "one"
s2 = "two"
s3 = ""
Dim o() As Object
Dim _cc As New Microsoft.HostIntegration.TI.ClientContext
_cc.WriteContext("USERID", "*****", o)
_cc.WriteContext("PASSWORD", "*****", o)
Dim objBPCS As New OS400_DPC_NET.CedarBank
objBPCS.BTC001(s1, s2, s3, o)
End Sub
When I run it, I get the following error.
"An unhandled exception of type System.Net.WebException occurred in
mscorlib.dll"
"Additional Information: The underlying connection was closed: The request
was canceled."
I've stepped through the CedarBank program in the debugger. I see one thing
really weird. In the CedarBank example, when this code "_cc = new
Microsoft.HostIntegration.TI.ClientContext()" executes and you examine the
contents of _cc in the debugger, it is populated with a lot of values. When
the equivalent line in my program executes, _cc remains almost empty. I've
had a couple of people with more VB.NET and C# experience than I, take a
look. But, they were stumped too.
Any suggestions or guidance would be appreciated.
Thanks,
--
Ellen Deak
HIS 2004 |
|
| Back to top |
|
 |
Ellen Deak
Guest
|
Posted:
Mon Jun 13, 2005 4:54 pm Post subject:
RE: How do you use ClientContext properly? |
|
|
Hi Rob,
Yes, when I modified the TI component, I readded it in TI Manager and then
rereferenced it in the project. I added some code to the CedarBanks program
to call the new method and it worked. Also, in my VB project, I added
references to everything that was referenced in the CedarBanks C# project.
I turned on the tracing, but when I run my solution nothing shows up in the
log. To make sure I really had tracing on, I tried running the CedarBanks
solution and it put lots of things into the log.
It sure seems like I'm missing a really important step in my code.
--
Ellen Deak
"Rob Beardsworth [MSFT]" wrote:
| Quote: | Hi Ellen,
admittedly I am using Visual Studio 2005 Beta, but I see all of the static
contents of _cc when I do the "new". The only difference between what I see
in c# and in vb.net debugging is the distinction in the c# debugger between
public and non public members as shown in the "Local" window. Your usage
seems to be correct when I look at your code below. Could you use the TI
Manager to turn on WIP Tracing and see what happens when you make your
call? I am working on the assumption that once you changed your TI Assembly
in Designer (to add your new method), you re-administered it to the
appropriate Virtual Directory and then in your VB Code you re-referenced
the new "_proxy.dll" that was generated???
Rob Beardsworth
Microsoft
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of any included samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
--------------------
From: "=?Utf-8?B?RWxsZW4gRGVhaw==?=" <EllenDeak@discussions.microsoft.com
Subject: How do you use ClientContext properly?
Date: Thu, 9 Jun 2005 06:51:04 -0700
Lines: 53
I've been looking at the CedarBank example in the SDK to try to figure out
what I need to do for Windows Initiated Processing to an RPG program on an
AS400. I was able to successfully add an additional method to the
OS400_DPC_TCP_CedarBank_NET.DLL TI component. This method calls an RPG
program we wrote in house. I then modified the CedarBank example to call
this new method. That all worked okay.
Next, I created a new VB.NET project so I could try calling that same TI
component from a progam I wrote myself. This is where I ran into problems.
The following is the code from my program.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim s1 As String
Dim s2 As String
Dim s3 As String
s1 = "one"
s2 = "two"
s3 = ""
Dim o() As Object
Dim _cc As New Microsoft.HostIntegration.TI.ClientContext
_cc.WriteContext("USERID", "*****", o)
_cc.WriteContext("PASSWORD", "*****", o)
Dim objBPCS As New OS400_DPC_NET.CedarBank
objBPCS.BTC001(s1, s2, s3, o)
End Sub
When I run it, I get the following error.
"An unhandled exception of type System.Net.WebException occurred in
mscorlib.dll"
"Additional Information: The underlying connection was closed: The request
was canceled."
I've stepped through the CedarBank program in the debugger. I see one thing
really weird. In the CedarBank example, when this code "_cc = new
Microsoft.HostIntegration.TI.ClientContext()" executes and you examine the
contents of _cc in the debugger, it is populated with a lot of values. When
the equivalent line in my program executes, _cc remains almost empty. I've
had a couple of people with more VB.NET and C# experience than I, take a
look. But, they were stumped too.
Any suggestions or guidance would be appreciated.
Thanks,
--
Ellen Deak
HIS 2004
|
|
|
| Back to top |
|
 |
Ellen Deak
Guest
|
Posted:
Thu Jun 16, 2005 11:44 pm Post subject:
RE: How do you use ClientContext properly? |
|
|
I found someone who was able to provide the answer to this question and
thought I would post it. To get my test working, I also needed to add the
following code for establishing credentials to the web site hosting the
proxy. I hope I got the terminology right, because I still don't completely
understand.
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
' set up default credentials, which will send our credentials to the
web site
' this is needed in case Anonymous Access is turned off, and may
then be used
' on the server to impersonate the client
If
(System.Runtime.Remoting.Channels.ChannelServices.GetChannel("http") Is
Nothing) Then
Dim channelProp As New Hashtable(1)
channelProp.Add("useDefaultCredentials", True)
System.Runtime.Remoting.Channels.ChannelServices.RegisterChannel(New
System.Runtime.Remoting.Channels.Http.HttpClientChannel(channelProp, Nothing))
End If
End Sub
--
Ellen Deak
"Ellen Deak" wrote:
| Quote: | I've been looking at the CedarBank example in the SDK to try to figure out
what I need to do for Windows Initiated Processing to an RPG program on an
AS400. I was able to successfully add an additional method to the
OS400_DPC_TCP_CedarBank_NET.DLL TI component. This method calls an RPG
program we wrote in house. I then modified the CedarBank example to call
this new method. That all worked okay.
Next, I created a new VB.NET project so I could try calling that same TI
component from a progam I wrote myself. This is where I ran into problems.
The following is the code from my program.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim s1 As String
Dim s2 As String
Dim s3 As String
s1 = "one"
s2 = "two"
s3 = ""
Dim o() As Object
Dim _cc As New Microsoft.HostIntegration.TI.ClientContext
_cc.WriteContext("USERID", "*****", o)
_cc.WriteContext("PASSWORD", "*****", o)
Dim objBPCS As New OS400_DPC_NET.CedarBank
objBPCS.BTC001(s1, s2, s3, o)
End Sub
When I run it, I get the following error.
"An unhandled exception of type System.Net.WebException occurred in
mscorlib.dll"
"Additional Information: The underlying connection was closed: The request
was canceled."
I've stepped through the CedarBank program in the debugger. I see one thing
really weird. In the CedarBank example, when this code "_cc = new
Microsoft.HostIntegration.TI.ClientContext()" executes and you examine the
contents of _cc in the debugger, it is populated with a lot of values. When
the equivalent line in my program executes, _cc remains almost empty. I've
had a couple of people with more VB.NET and C# experience than I, take a
look. But, they were stumped too.
Any suggestions or guidance would be appreciated.
Thanks,
--
Ellen Deak
HIS 2004 |
|
|
| Back to top |
|
 |
|
|
|
|