File: omsgpr.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 (301 lines) | stat: -rw-r--r-- 11,513 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
<?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="incoming_msg" decor="bpel_decor.vspx" style="bpel_style.xsl">
  <v:on-init>
    set isolation='committed';
    for select bs_id, bdm_text, bdm_sender_inst, bdm_plink, bdm_recipient,
    	bdm_activity, bdm_oper, bdm_script, bdm_action
    	from BPEL..dbg_message, BPEL..script where bdm_id = self.mid do
      {
        self.inst := bdm_sender_inst;
	self.node := bdm_activity;
	self.endp := concat('http://localhost:',server_http_port (),'/BPELGUI/bpel.vsp?script=',bdm_recipient);
	self.imsg := xml_tree_doc (blob_to_string (bdm_text));
	self.pl := bdm_plink;
	self.scp := bdm_script;
	self.act := trim (bdm_action, '"');
	self.oper := bdm_oper;
     }
     for select bw_message_type, bw_correlation_exp,
        blob_to_string (bw_expected_value) as bw_expected_value
     	from BPEL..wait where bw_instance = self.inst and bw_node = self.node do
      {
        self.expxp := bw_correlation_exp;
        if (strstr (bw_correlation_exp, 'encode_base64'))
	  {
	    declare ar, r any;
	    ar := split_and_decode (bw_expected_value, 0, '\0\0|');
	    r := 'composite (';
	    foreach (any elm in ar) do
	      {
	      r := r || decode_base64 (elm) || ',';
	      }
	    self.exphdr := rtrim (r, ',') || ')' ;
	  }
	else
          self.exphdr := bw_expected_value;
	self.expty := bw_message_type;
      }

    for select bo_input, bo_style from BPEL..operation
      where bo_name = self.oper and bo_script = self.scp and bo_partner_link = self.pl do
     {
       self.omsgname := BPEL..get_nc_name (bo_input);
       self.sty := bo_style;
     }
    --dbg_obj_print ('self.omsgname', self.omsgname, ' scp=', self.scp, ' pl=',self.pl);
    if (length (self.msg) = 0)
        {
	  self.msg := null;
	  for select bsrc_text from BPEL..script_source
		where bsrc_role = self.pl and bsrc_script_id = self.scp do
	   {
	     self.msg := xslt (BPEL.BPEL.res_base_uri() || 'bpel4ws/1.0/bpelmsgen.xsl', bsrc_text,
	   	vector ('msg', self.omsgname));
	   }
	  if (self.msg is null)
           {
	      for select bsrc_text from BPEL..script_source
		    where bsrc_role = 'wsdl' and bsrc_script_id = self.scp do
	       {
		 self.msg := xslt (BPEL.BPEL.res_base_uri() || 'bpel4ws/1.0/bpelmsgen.xsl', bsrc_text,
		    vector ('msg', self.omsgname));
	       }
           }
        }
    else
      self.msg := xml_tree_doc (self.msg);
    --dbg_obj_print ('self.msg', self.msg);
  </v:on-init>
  <vm:pagewrapper>
    <v:variable name="mid" type="int" default="null" param-name="mid"/>
    <v:variable name="inst" type="int" default="null"/>
    <v:variable name="node" type="int" default="null"/>
    <v:variable name="scp" type="int" default="null"/>
    <v:variable name="sty" type="int" default="1"/>
    <v:variable name="endp" type="varchar" default="null"/>
    <v:variable name="imsg" type="xml" default="null" persist="temp"/>
    <v:variable name="pl" type="varchar" default="null"/>
    <v:variable name="act" type="any" default="null"/>
    <v:variable name="msg" type="any" default="null"/>
    <v:variable name="oper" type="any" default="null"/>
    <v:variable name="omsgname" type="varchar" default="null"/>
    <v:variable name="exphdr" type="varchar" default="null"/>
    <v:variable name="expxp" type="varchar" default="null"/>
    <v:variable name="expty" type="int" default="null"/>
    <vm:pagetitle>OpenLink BPEL Process Manager Debugger Console Waiting messages</vm:pagetitle>
    <vm:pagebody>
      <v:method name="msg_root_node" arglist="in path any">
	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">
	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);
	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.tn_position+1), path);
	  }
	return path;
      </v:method>
      <v:form name="f1" type="simple" method="POST">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" id="content">
          <tr>
            <th class="info" colspan="4">Incoming message</th>
	  </tr>
          <tr>
            <td colspan="4">
              <?vsp http(sprintf('<a target="_blank" href="help.vspx?id=omsgpr&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=omsgpr&sid=%s&realm=%s\r\n"> Help</a>', self.sid ,self.realm));?>
            </td>
          </tr>
	  <tr>
	    <td width="10%" align="right"><b>Instance</b></td><td colspan="3"> <v:label value="--self.inst" format="%d"/></td>
	  </tr>
	  <tr>
	    <td width="10%" align="right"><b>Partner</b></td><td colspan="3">  <v:label value="--self.pl" format="%s"/></td>
	  </tr>
	  <tr>
	    <td width="10%" align="right"><b>Endpoint</b></td><td colspan="3"> <v:label value="--self.endp" format="%s"/></td>
	  </tr>
	  <tr>
	    <td width="10%" align="right"><b>Node ID</b></td><td colspan="3">  <v:label value="--self.node" format="%d"/></td>
	  </tr>
	  <tr>
	    <td width="10%" align="right"><b>Correlation</b></td><td colspan="3">  <v:label value="--self.expxp" format="%s"/></td>
	  </tr>
	  <tr>
	    <td width="10%" align="right"><b>Value</b></td><td colspan="3">  <v:label value="--cast(self.exphdr as varchar)" format="%s"/></td>
	  </tr>
	  <tr>
	    <td style="font-weight:bold" colspan="4">
	      Manually enter the reply:
	    </td>
	  </tr>
	  <tr>
	    <td colspan="4">
	      <table>
		<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="t1_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"/>
                      <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>
		         declare xt, xp any;
		         xt := (control.vc_parent as vspx_tree_node).tn_element;
		         xp := BPEL..get_nc_name (cast (xpath_eval ('@type',xt) as varchar));
		         control.ufl_value := xp;
		       </v:after-data-bind>
		     </v:label></td><td width="25%">
		       <v:text name="var_val" value="">
			 <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 any;
			   path := self.get_path (control);
			   --dbg_obj_print (path, control.ufl_value);
			   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>
                    <!--</div>-->
                     </td>
                  </tr>
                  </table>
                  </v:leaf-template>
                </v:tree>
              </table>
            </td>
	  </tr>
	  <tr>
	    <td colspan="2">
              <v:button action="simple" name="back" value="Back" xhtml_class="m_e">
                <v:on-post><v:script><![CDATA[
                  http_request_status ('HTTP/1.1 302 Found');
                  http_header (sprintf('Location: incoming.vspx?sid=%s&realm=%s\r\n',self.sid ,self.realm));
                ]]></v:script></v:on-post>
              </v:button>
	      <v:button action="simple" name="inv" value="Send Reply" xhtml_class="m_e">
		<v:on-post><![CDATA[
		  declare ret, xt, xp, pars, flag any;
		  declare l int;
		  declare wsa_rel, hdrs  any;

		  hdrs := null;
		  if (self.expty = 1)
		    {
		      wsa_rel := vector (composite (), '', self.exphdr);
		      hdrs := vector (vector (
		       'RelatesTo', 'http://schemas.xmlsoap.org/ws/2003/03/addressing:RelatesTo'), wsa_rel);
		    }

		  if (self.omsgname is null)
		    {
		      -- XXX:must be a error
		      return;
		    }

		  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]);
		     }

		  commit work;
		  ret := db..soap_client (
		  	url=>self.endp,
			operation=>self.oper,
			soap_action=>self.act,
			style=>self.sty,
			parameters => pars,
			headers=>hdrs,
			direction=>1
			);
		  --dbg_obj_print ('OUT MSG', ret);
		  delete from BPEL..dbg_message where bdm_id = self.mid;
		  self.vc_redirect ('incoming.vspx');
		  ]]>
		</v:on-post>
	      </v:button>
	    </td>
	  </tr>
        </table>
      </v:form>
    </vm:pagebody>
  </vm:pagewrapper>
</v:page>