/[volute]/trunk/projects/grid/vospace/php_endpoint/vospace_service.php
ViewVC logotype

Contents of /trunk/projects/grid/vospace/php_endpoint/vospace_service.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 737 - (show annotations)
Thu Aug 21 19:31:18 2008 UTC (12 years, 2 months ago) by richard.p.wagner
File size: 3568 byte(s)
WS-Security header capturing
1 <?php
2
3 require_once('config.inc');
4
5 require_once(BACKEND.'node.php');
6 require_once(BACKEND.'vospace.php');
7
8
9 class VOSpaceService {
10
11 function GetViews($message){
12 $vospace = new VOSpace();
13 $views = $vospace->getViews();
14 return $views;
15 }
16
17 function GetProtocols($message){
18 $vospace = new VOSpace();
19 $protocols = $vospace->getProtocols();
20 return $protocols;
21 }
22
23 function GetProperties(){
24 $vospace = &new VOSpace();
25 $properties = $vospace->getProperties();
26 return $properties;
27 }
28
29 function CreateNode($message)
30 {
31
32 return $data;
33
34 }
35
36 function DeleteNode($message)
37 {
38
39 return $data;
40
41 }
42
43 function MoveNode($message)
44 {
45
46 return $data;
47
48 }
49
50 function CopyNode($message)
51 {
52
53
54 return $data;
55
56 }
57
58 function GetNode($target)
59 {
60
61 $node = new Node($target->target);
62
63 if(!$node->exists()){
64 $bad_target = $target->target;
65 throw new SoapFault("Server", "Node not found.", " ",
66 array("uri" => $bad_target),
67 "NodeNotFoundFault");
68 }
69
70 $node->populateProperties();
71 return array('node' => $node);
72 }
73
74 function SetNode($message)
75 {
76
77
78 return $data;
79
80 }
81
82 function ListNodes($node_list_req){
83
84 $vospace = &new VOSpace();
85 // error_log(var_export($node_list_req, True), 3, "/var/tmp/my-errors.log");
86 $node_list = $vospace->listNodes($node_list_req->request);
87
88 if($node_list['nodes'] == Null){
89 throw new SoapFault("Server", "Node not found.", " ",
90 array("uri" => $node_list_req->request->nodes->node->uri),
91 "NodeNotFoundFault");
92 }
93
94 return array('response' => $node_list);
95 }
96
97 function FindNodes($message)
98 {
99
100 return $data;
101
102 }
103
104 function PushToVoSpace($message)
105 {
106
107 return $data;
108
109 }
110
111 function PullToVoSpace($message)
112 {
113
114 return $data;
115
116 }
117
118 function PullFromVoSpace($request)
119 {
120 $node = new Node($request->source);
121
122 if(!$node->exists()){
123 $bad_target = $request->source;
124 throw new SoapFault("Server", "Node not found.", " ",
125 array("uri" => $bad_target),
126 "NodeNotFoundFault");
127 }
128
129 $view = $node->getView();
130 $protocols = $node->getProtocols();
131
132 // transfer element, with at least a view and protocol element
133 $response = array('transfer'=>
134 array('view' => $view,
135 'protocol' => $protocols));
136
137 return $response;
138 }
139
140 function PushFromVoSpace($message){
141 throw new SoapFault("Server", "Not implemented.", " ",
142 array(),
143 "InternalFault");
144 }
145
146 function Security( $foo ){
147
148 $p = xml_parser_create();
149 xml_parse_into_struct($p, $foo->any, $vals, $index);
150 xml_parser_free($p);
151 // error_log(var_export($vals, True), 3, "/var/tmp/vospace.err.log");
152 // error_log(var_export($index, True), 3, "/var/tmp/vospace.err.log");
153
154 $username = '';
155 $password = '';
156 foreach( $vals as $element){
157 if( strpos($element['tag'], "USERNAMETOKEN") === FALSE ){
158 if( strpos($element['tag'], "USERNAME") !== FALSE )
159 $username = $element['value'];
160 if( strpos($element['tag'], "PASSWORD") !== FALSE )
161 $password = $element['value'];
162 }
163 }
164 error_log(var_export($username, True), 3, "/var/tmp/vospace.err.log");
165 error_log(var_export($password, True), 3, "/var/tmp/vospace.err.log");
166
167 if( $username == 'joe' && $password == 'doe' ){
168 $this->Authenticated = True;
169 } else {
170 $this->Authenticated = False;
171 throw new SoapFault("Server", "Not authenticated.", " ",
172 array(),
173 "PermissionDeniedFault");
174
175 }
176 }
177 }
178
179 ?>

msdemlei@ari.uni-heidelberg.de
ViewVC Help
Powered by ViewVC 1.1.26