File: message.vspx

package info (click to toggle)
virtuoso-opensource 6.1.6+dfsg2-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 260,992 kB
  • ctags: 125,220
  • sloc: ansic: 652,748; sql: 458,419; xml: 282,834; java: 61,031; sh: 40,031; cpp: 36,890; cs: 25,240; php: 12,692; yacc: 9,523; lex: 7,018; makefile: 6,157; jsp: 4,484; awk: 1,643; perl: 1,013; ruby: 1,003; python: 326
file content (437 lines) | stat: -rw-r--r-- 16,093 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
<?xml version="1.0"?>
<!--
 -  
 -  $Id$
 -
 -  This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
 -  project.
 -  
 -  Copyright (C) 1998-2012 OpenLink Software
 -  
 -  This project is free software; you can redistribute it and/or modify it
 -  under the terms of the GNU General Public License as published by the
 -  Free Software Foundation; only version 2 of the License, dated June 1991.
 -  
 -  This program is distributed in the hope that it will be useful, but
 -  WITHOUT ANY WARRANTY; without even the implied warranty of
 -  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 -  General Public License for more details.
 -  
 -  You should have received a copy of the GNU General Public License along
 -  with this program; if not, write to the Free Software Foundation, Inc.,
 -  51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
 -  
 -  
-->
<v:page xmlns:v="http://www.openlinksw.com/vspx/" xmlns:vm="http://www.openlinksw.com/vspx/macro" name="message_page" decor="bpel_decor.vspx" style="bpel_style.xsl">
    <v:on-init>
      --dbg_obj_print ('self.msg', self.msg);
      --self.msg_name := 'echoIn';
      set isolation='committed';
      if (length (self.msg) = 0)
        {
	  for select bsrc_text from BPEL..script_source where bsrc_role = 'wsdl' and bsrc_script_id = self.id do
	   {
	     self.msg := xslt (BPEL.BPEL.res_base_uri() || 'bpel4ws/1.0/bpelmsgen.xsl', bsrc_text,
	   	vector ('msg', self.msg_name));
           }
	}
      else
        self.msg := xml_tree_doc (self.msg);
    </v:on-init>
  <vm:pagetitle>OpenLink BPEL Process Manager Debugger Console Invoke Web Service</vm:pagetitle>
  <vm:pagewrapper>
    <v:variable name="id" type="int" default="0" param-name="id"/>
    <v:variable name="msg_name" type="varchar" default="null" param-name="msg-id"/>
    <v:variable name="endpurl" type="varchar" default="null" />
    <v:variable name="msg" type="any" default="null" />
    <v:variable name="res" type="any" default="null" persist="temp"/>
    <v:variable name="oper" type="varchar" default="null" param-name="oper"/>
    <v:variable name="sty" type="int" default="null" param-name="style"/>
    <v:variable name="act" type="varchar" default="null" param-name="act"/>
    <v:variable name="is_sync" type="int" default="1" param-name="sync"/>
    <vm:pagebody>
      <v:method name="msg_root_node" arglist="in path any">
	--dbg_obj_print ('root:', path, self.msg);
	if (self.msg is null)
	  return vector ();
	return xpath_eval (path, self.msg, 0);
      </v:method>
      <v:method name="msg_chil_node" arglist="in path any, in node any">
	--dbg_obj_print ('chil:', path, node);
	return xpath_eval ('*', node, 0);
      </v:method>
      <v:method name="get_path" arglist="inout ctr vspx_control">
	declare nod vspx_tree_node;
	declare elm vspx_field;
        declare path varchar;

	path := '';
	nod := ctr.vc_parent;
	elm := nod.vc_find_control ('elm');
	path := concat ('/', elm.ufl_value, path);
	--dbg_obj_print (nod.tn_position);
	--dbg_obj_print (nod.vc_parent.vc_name);
	while ((nod := nod.vc_parent) is not null
		and udt_instance_of (nod, fix_identifier_case ('DB.DBA.vspx_tree_node')))
	  {
	    elm := nod.vc_find_control ('pelm');
	    --dbg_obj_print (nod.tn_position);
	    if (elm is not null)
	      path := concat (sprintf ('/*[%d]', nod.tn_position+1), path);
	  }
	return path;
      </v:method>
      <v:method name="get_path2" arglist="inout ctr vspx_control">
	declare nod vspx_control;
	declare elm vspx_field;
        declare path varchar;

	path := '';
	nod := ctr;
	while ((nod := nod.vc_parent) is not null
		and udt_instance_of (nod, fix_identifier_case ('DB.DBA.vspx_tree_node')))
	  {
	    elm := nod.vc_find_control ('pelm');
	    if (elm is not null)
	      path := concat (sprintf ('/*[%d]', (nod as vspx_tree_node).tn_position+1), path);
	  }
	return path;
      </v:method>
      <v:method name="wsa_reply" arglist="in u any"><![CDATA[
	declare wsa_reply any;
	wsa_reply := soap_box_structure ('Address', u);
	return
	vector (
	         vector ('ReplyTo', 'http://schemas.xmlsoap.org/ws/2003/03/addressing:ReplyTo'), wsa_reply
	       );
	       ]]></v:method>
      <v:method name="do_req" arglist="in fl any, inout e vspx_event">
		  <![CDATA[
		  declare ret, xt, xp, pars, flag, conn, reply_to any;
		  declare l, dir, dbg int;

		  dbg := 1;
		 reply_to := null;

		  if (
		     not exists (select 1 from BPEL..script where bs_id = self.id and bs_debug = 1)
		     and
		     not exists (select 1 from BPEL..partner_link_init
		     	where bpl_script = self.id and bpl_debug = 1)
		    )
		    {
		      if (self.is_sync)
		        dbg := 0;
		      else
		       {
			 reply_to := self.wsa_reply (
			      sprintf ('http://localhost:%s/BPELGUI/asyncall.vsp?scp=%d&op=%s',
			      server_http_port (), self.id, self.oper));
		       }

	            }

		  xp := xpath_eval ('/*', self.msg, 0);
		  l := length (xp) * 2;
		  pars := make_array (l, 'any');

		  for (declare i int, i := 0; i < l; i := i + 2)
		     {
		       pars [i] := sprintf ('par%d', i/2);
		       pars [i+1] := xml_cut (xp[i/2]);
		     }

		  flag := 64+128;

		  if (dbg and not fl)
		    dir := 3;
	          else
		    dir := 1;

	          if (fl)
		    flag := 256;


		  conn := null;
		  commit work;
		  ret := db..soap_async_client (
		  	url=>self.endpurl,
			operation=>self.oper,
			soap_action=>self.act,
			style=>self.sty+flag,
			parameters => pars,
			direction=>dir,
			time_out=>10000,
			headers=>reply_to,
			conn => conn
			);
		  if (dbg and not fl)
		    {
		      if (self.is_sync)
		        http_on_message (conn, 'BPEL.BPEL.DEBUG_CALLBACK', vector (self.id, self.oper));
		      self.vc_redirect ('incoming.vspx');
	            }
	          else
                    {
		      self.res := xml_tree_doc (ret);
		      self.result.vc_data_bind (e);
		      --dbg_obj_print (self.res);
		    }
		  ]]>
      </v:method>
      <v:method name="validate_input" arglist="inout tp vspx_field, inout val vspx_field">
	--dbg_obj_print ('VALIDATE', tp.ufl_value, val.ufl_value);
	if (length (val.ufl_value) = 0)
	  return;
      </v:method>
      <v:form name="f1" type="simple" method="POST">
		  <v:before-data-bind>
		    if (self.id = 0)
		      self.vc_redirect ('process.vspx');
		    else if (length (self.endpurl) = 0)
		      {
		        declare url any;
			url := (select bs_name from BPEL..script where bs_id = self.id);
			self.endpurl := 'http://localhost:'||server_http_port ()||
				'/BPELGUI/bpel.vsp?script=' || url;
		      }
		  </v:before-data-bind>
        <table width="100%" border="0" cellpadding="0" cellspacing="0" id="content">
          <tr>
	    <th class="info" colspan="3">Invoke BPEL process</th>
	  </tr>
          <tr>
          <td colspan="3">
            <?vsp http(sprintf('<a target="_blank"  href="help.vspx?id=message&sid=%s&realm=%s\r\n"><img title="Help" alt="Help" src="i/help_24.gif" border="0" /></a>', self.sid ,self.realm));?>
            <?vsp http(sprintf('<a target="_blank"  href="help.vspx?id=message&sid=%s&realm=%s\r\n"> Help</a>', self.sid ,self.realm));?>
          </td>
        </tr>
          <tr>
	    <td colspan="3">
              <v:url name="mENDP" value="Endpoint" url="--sprintf('help.vspx?id=message&name=pu_epoint')" xhtml_target="_blank"/>
	      <v:text name="endp" value="--self.endpurl" xhtml_size="70"/>
	    </td>
          </tr>
          <tr>
            <td width="90%" colspan="3">
              <table width="80%" border="0" cellpadding="0" cellspacing="0" id="contentlist">
		<v:template name="selmsg" type="simple" enabled="--case when self.msg_name is null then 1 else 0 end">
	<v:data-set name="ds" nrows="5" scrollable="1" edit="1" cursor-type="dynamic">
	  <v:sql><![CDATA[select bo_name, bo_action, bo_style, bo_input, bo_output from BPEL..operation
	    where bo_init = 1 and bo_script = :scpid]]></v:sql>
	  <v:param name="scpid" value="--self.id"/>
	  <table cellpadding="0" cellspacing="0" id="subcontent">
	    <th>Operation</th>
	    <th>Action</th>
	    <v:template name="repeater" type="repeat">
	      <v:template name="no_rows" type="if-not-exists"/>
	      <v:template name="template4" type="browse">
		<tr>
		  <td><v:label value="--(control.vc_parent as vspx_row_template).te_rowset[0]"/></td>
		  <td><v:button name="selectmsg" action="simple" xhtml_class="m_e" value="Invoke">
		      <v:on-post><![CDATA[
			declare sty, oper, act, is_sync any;
			sty := (control.vc_parent as vspx_row_template).te_rowset[2];
			oper := (control.vc_parent as vspx_row_template).te_rowset[0];
			act := (control.vc_parent as vspx_row_template).te_rowset[1];
			is_sync := 1;
			if ((control.vc_parent as vspx_row_template).te_rowset[4] is null)
		          is_sync := 0;
			self.msg_name := BPEL..get_nc_name ((control.vc_parent as vspx_row_template).te_rowset[3]);
			self.vc_redirect (sprintf ('message.vspx?id=%d&msg-id=%s&oper=%s&style=%d&act=%U&sync=%d', self.id, self.msg_name, oper, sty, act, is_sync));
			]]>
		      </v:on-post>
		    </v:button>
		  </td>
	      </tr>
	      </v:template>
	    </v:template>
	  </table>
	</v:data-set>
	  </v:template>
	    <v:tab name="msgview" initial-active="tree_templ" style="list" is-input="0" enabled="--case when self.msg_name is not null then 1 else 0 end">
	      <v:template name="tree_templ" type="simple" title="Tree View">
		<div>
		<v:tree name="t1" multi-branch="1" orientation="vertical" start-path="/*" open-at="--'//*'" root="self.msg_root_node" child-function="self.msg_chil_node">
                  <v:node-template name="node_tmpl">
                    <div STYLE="margin-left:1em;">
		      <v:button name="bt1_toggle" action="simple" style="image" value="--case (control.vc_parent as vspx_tree_node).tn_open when 0 then 'plus.gif' else 'minus.gif' end">
			<v:on-post>
			  declare path, xp any;
			  path := self.get_path2 (control);
			  path := path || '/*';
			  while ((xp := xpath_eval (path, self.msg)) is not null)
			    XMLReplace (self.msg, xp, null);
			  self.t1.vc_data_bind (e);
			</v:on-post>
		      </v:button>
                      <b>
                        <v:label name="pelm" value="--null">
                          <v:after-data-bind>
		      declare xt, xp any;
		      xt := (control.vc_parent as vspx_tree_node).tn_element;
		      xp := cast (xpath_eval ('local-name()',xt) as varchar);
		      control.ufl_value := xp;
		    </v:after-data-bind>
                        </v:label>
		      </b>
			<v:node/>
                    </div>
                  </v:node-template>
		  <v:leaf-template name="leaf_tmpl">
                    <!--<div STYLE="margin-left:1em;">-->
                      <table id="subcontent" width="60%" cellpadding="0" cellspacing="0">
                      <tr>
                        <td width="5%"></td>
                        <td width="30%"><v:label name="elm" value="--null">
                        <v:after-data-bind>
		         declare xt, xp any;
		         xt := (control.vc_parent as vspx_tree_node).tn_element;
		         xp := cast (xpath_eval ('local-name()',xt) as varchar);
		         control.ufl_value := xp;
		       </v:after-data-bind>
		       </v:label>
		       <v:label name="tylabel2" value="--null" format="(%s)">
			 <v:after-data-bind><![CDATA[
		         declare xt, xp any;
			 declare tp varchar;
		         xt := (control.vc_parent as vspx_tree_node).tn_element;
			 --dbg_obj_print (xt);
			 tp := cast (xpath_eval ('@type',xt) as varchar);
		         xp := BPEL..get_nc_name (tp);
			 control.ufl_value := coalesce (xp, '');
			 if (tp not like 'http://www.w3.org/2001/XMLSchema:%' and tp <> xp)
			   {
			     declare txt vspx_field;
			     txt := control.vc_parent.vc_find_control ('var_val');
			     txt.vc_enabled := 0;
			   }
			 ]]>
		       </v:after-data-bind>
		     </v:label></td><td width="25%">
		       <v:text name="var_val" value="" xhtml_size="50">
			 <v:after-data-bind>
		         declare xt, xp any;
		         xt := (control.vc_parent as vspx_tree_node).tn_element;
		         xp := cast (xpath_eval ('text()',xt) as varchar);
		         control.ufl_value := xp;
		         </v:after-data-bind>
			 <v:on-post>
			   declare path, xp, tp any;
			   declare txt vspx_field;
			   path := self.get_path (control);
			   --dbg_obj_print (path, control.ufl_value);
			   txt := control.vc_parent.vc_find_control ('tylabel2');
			   if (txt is not null)
			     self.validate_input (txt, control);
			   xp := xpath_eval (path||'/text()', self.msg);
			   if (xp is not null)
			     XMLReplace (self.msg, xp, control.ufl_value);
			   else
			     XMLAppendChildren (xpath_eval (path, self.msg), control.ufl_value);
			   --dbg_obj_print (path, control.ufl_value);
			   --dbg_obj_print (self.msg);
			 </v:on-post>
		       </v:text>
		       <v:button name="addcpx" value="plus.gif" style="image" action="simple">
			 <v:after-data-bind>
			   declare txt vspx_field;
			   txt := control.vc_parent.vc_find_control ('var_val');
			   if (txt.vc_enabled)
			     {
			       control.vc_enabled := 0;
			       return 0;
			     }
			  </v:after-data-bind>
			  <v:on-post>
	  declare frag, nam, stub any;
	  declare xt, xp, path any;
	  xt := (control.vc_parent as vspx_tree_node).tn_element;
	  nam := cast (xpath_eval ('@type',xt) as varchar);
	  for select bsrc_text from BPEL..script_source where bsrc_role = 'wsdl' and bsrc_script_id = self.id do
	   {
	     frag := xslt (BPEL.BPEL.res_base_uri() || 'bpel4ws/1.0/bpelmsgen.xsl', bsrc_text,
	     vector ('typ', nam, 'msg', ' none'));
	     path := self.get_path (control);
	     stub := xpath_eval ('/stub/*', frag, 0);
	     foreach (any elm in stub) do
	       {
	         XMLAppendChildren (xpath_eval (path, self.msg), xml_cut (elm));
	       }
	     self.t1.vc_data_bind (e);
           }
			  </v:on-post>
		       </v:button>
                    <!--</div>-->
                     </td>
                  </tr>
                  </table>
                  </v:leaf-template>
		</v:tree>
	      </div>
	       </v:template>
	       <v:template name="txt_templ" type="simple" title="Source View">
		 <div>
		 <v:textarea name="src_msg" value="--serialize_to_UTF8_xml (self.msg)" xhtml_cols="70" xhtml_rows="15">
		   <v:on-post>
                     <![CDATA[
                       if (control.ufl_value <> '' and control.ufl_value is not null and isentity(control.ufl_value))
		         self.msg := xtree_doc (control.ufl_value);
                     ]]>
		   </v:on-post>
		 </v:textarea>
	       </div>
	       </v:template>
	     </v:tab>
              </table>
            </td>
	  </tr>
	  <v:template name="invt" type="simple"  enabled="--case when self.msg_name is not null then 1 else 0 end">
	  <tr>
	    <td colspan="3">
	      <v:button action="simple" name="inv" value="Invoke" xhtml_class="m_e">
		<v:on-post>
		  self.msgview.tb_active.vc_focus := 1;
		  self.msgview.tb_active.vc_set_childs_focus (1, e);
		  self.msgview.tb_active.vc_post (e);
		  self.msgview.tb_active.vc_user_post (e);
		  self.msgview.tb_active.vc_action (e);
		  self.do_req (0, e);
		</v:on-post>
	      </v:button>
	      <v:button action="simple" name="prw" value="Preview" xhtml_class="m_e">
		<v:on-post>
		  self.msgview.tb_active.vc_focus := 1;
		  self.msgview.tb_active.vc_set_childs_focus (1, e);
		  self.msgview.tb_active.vc_post (e);
		  self.msgview.tb_active.vc_user_post (e);
		  self.msgview.tb_active.vc_action (e);
		  self.do_req (1, e);
		</v:on-post>
	      </v:button>
	    </td>
	  </tr>
	  <tr>
	    <td colspan="3">
	      <v:template name="result" type="simple" enabled="--case when self.res is not null then 1 else 0 end">
      <div>Message</div>
      <div style="background-color:white">
	<?vsp
	  if (self.res is not null)
	    {
	      declare xt any;
	      xt := xslt (BPEL.BPEL.res_base_uri () ||'bpel4ws/1.0/raw.xsl', self.res);
	      http_value (xt, null);
	    }
	?>
      </div>
      </v:template>
    </td>
  </tr>
</v:template>
        </table>
      </v:form>
    </vm:pagebody>
  </vm:pagewrapper>
</v:page>