22
22
using System . Web . Script . Services ;
23
23
using System . ComponentModel ;
24
24
using gov . va . medora . mdws . dto ;
25
+ using System . ServiceModel ;
26
+ using System . ServiceModel . Activation ;
25
27
26
28
namespace gov . va . medora . mdws
27
29
{
@@ -32,19 +34,35 @@ namespace gov.va.medora.mdws
32
34
[ WebServiceBinding ( ConformsTo = WsiProfiles . BasicProfile1_1 ) ]
33
35
[ ToolboxItem ( false ) ]
34
36
[ ScriptService ]
35
- public partial class BaseService : System . Web . Services . WebService
37
+ [ AspNetCompatibilityRequirements ( RequirementsMode = AspNetCompatibilityRequirementsMode . Allowed ) ]
38
+ public partial class BaseService : System . Web . Services . WebService , IBaseService
36
39
{
37
40
public const string VERSION = "1.1.0" ;
38
41
39
42
public BaseService ( )
40
43
{
44
+ //if (!OperationContext.Current
45
+ //OperationContext.Current.IncomingMessageProperties.Add("MySession", new MySession(this.GetType().Name));
46
+ //RequestContext wcfContext = this.
47
+ //if (OperationContext.Current == null || String.IsNullOrEmpty(OperationContext.Current.SessionId))
48
+ //{
49
+ // return;
50
+ //}
41
51
// If not Http request has been made yet Session is null
42
52
// This happens before the Startup page is displayed
43
- if ( HttpContext . Current . Session == null )
53
+
54
+ if ( OperationContext . Current != null )
55
+ {
56
+ System . Console . WriteLine ( "You're sooo cool Joel" ) ;
57
+ }
58
+
59
+ if ( HttpContext . Current == null || HttpContext . Current . Session == null )
44
60
{
45
61
return ;
46
62
}
47
63
64
+
65
+
48
66
// At this point a request has been made to a web service page
49
67
if ( HttpContext . Current . Session [ "MySession" ] == null )
50
68
{
@@ -86,7 +104,7 @@ public TextTO getFacadeVersion()
86
104
}
87
105
catch ( Exception )
88
106
{
89
- result . fault = new FaultTO ( "This facade does not contain any version information" ) ;
107
+ result . fault = new FaultTO ( "This facade does not contain any version information" ) ;
90
108
}
91
109
return result ;
92
110
}
@@ -102,5 +120,64 @@ public TextArray getRpcs()
102
120
{
103
121
return ( TextArray ) MySession . execute ( "ConnectionLib" , "getRpcs" , new object [ ] { } ) ;
104
122
}
123
+
124
+ [ WebMethod ( EnableSession = true , Description = "Get all VHA sites" ) ]
125
+ public RegionArray getVHA ( )
126
+ {
127
+ return ( RegionArray ) MySession . execute ( "SitesLib" , "getVHA" , new object [ ] { } ) ;
128
+ }
129
+
130
+ [ OperationContract ]
131
+ [ WebMethod ( EnableSession = true , Description = "Connect to a single VistA system" ) ]
132
+ public DataSourceArray connect ( string sitelist )
133
+ {
134
+ return ( DataSourceArray ) MySession . execute ( "ConnectionLib" , "connectToLoginSite" , new object [ ] { sitelist } ) ;
135
+ }
136
+
137
+ [ OperationContract ]
138
+ [ WebMethod ( EnableSession = true , Description = "Log onto a single VistA system" ) ]
139
+ public UserTO login ( string username , string pwd , string context )
140
+ {
141
+ return ( UserTO ) MySession . execute ( "AccountLib" , "login" , new object [ ] { username , pwd , context } ) ;
142
+ }
143
+
144
+ [ OperationContract ]
145
+ [ WebMethod ( EnableSession = true , Description = "Disconnect all Vista systems" ) ]
146
+ public TaggedTextArray disconnect ( )
147
+ {
148
+ return ( TaggedTextArray ) MySession . execute ( "ConnectionLib" , "disconnectAll" , new object [ ] { } ) ;
149
+ }
150
+
151
+ }
152
+
153
+ [ ServiceContract ]
154
+ public interface IBaseService
155
+ {
156
+ [ OperationContract ]
157
+ string getVersion ( ) ;
158
+
159
+ [ OperationContract ]
160
+ SiteTO addDataSource ( string id , string name , string datasource , string port , string modality , string protocol , string region ) ;
161
+
162
+ [ OperationContract ]
163
+ TextTO getFacadeVersion ( ) ;
164
+
165
+ [ OperationContract ]
166
+ SiteArray setVha ( string sitesFileName ) ;
167
+
168
+ [ OperationContract ]
169
+ TextArray getRpcs ( ) ;
170
+
171
+ [ OperationContract ]
172
+ RegionArray getVHA ( ) ;
173
+
174
+ [ OperationContract ]
175
+ DataSourceArray connect ( string sitelist ) ;
176
+
177
+ [ OperationContract ]
178
+ TaggedTextArray disconnect ( ) ;
179
+
180
+ [ OperationContract ]
181
+ UserTO login ( string username , string pwd , string context ) ;
105
182
}
106
183
}
0 commit comments