node-red-contrib-simple-soap
Version:
Execute SOAP requests and parse XML result
199 lines (166 loc) • 7.76 kB
HTML
<script type="text/x-red" data-template-name="simple-soap">
<div class="form-row">
<label for="node-input-host"><i class="fa fa-globe"></i> Base URL</label>
<input type="text" id="node-input-host" style="width:70%;"/>
<input type="hidden" id="node-input-hostType">
</div>
<div class="form-row">
<label for="node-input-path"><i class="fa fa-folder-o"></i> Path</label>
<input type="text" id="node-input-path" style="width:70%;"/>
<input type="hidden" id="node-input-pathType">
</div>
<div class="form-row">
<label for="node-input-action"><i class="fa fa-cogs"></i> Action</label>
<input type="text" id="node-input-action" style="width:70%;"/>
<input type="hidden" id="node-input-actionType">
</div>
<div class="form-row">
<label for="node-input-body"><i class="fa fa-code"></i> Body</label>
<input type="text" id="node-input-body" style="width:70%;"/>
<input type="hidden" id="node-input-bodyType">
</div>
<div class="form-row">
<label></label>
<label for="node-input-mustache" style="width:70%">
<input type="checkbox" id="node-input-mustache" style="display:inline-block; width:22px; vertical-align:baseline;"> Body is mustache template
</label>
</div>
<div class="form-row">
<label><i class="fa fa-sliders"></i> Response</label>
Attribute prefix: <input type="text" id="node-input-attrkey" style="width:50px;" />
</div>
<div class="form-row">
<label></label>
Content prefix: <input type="text" id="node-input-charkey" style="width:50px;" />
</div>
<div class="form-row">
<label></label>
<label for="node-input-stripPrefix" style="width:70%">
<input type="checkbox" id="node-input-stripPrefix" style="display:inline-block; width:22px; vertical-align:baseline;"> Remove namespaces
</label>
</div>
<div class="form-row">
<label></label>
<label for="node-input-simplify" style="width:70%">
<input type="checkbox" id="node-input-simplify" style="display:inline-block; width:22px; vertical-align:baseline;"> Handle child nodes as arrays
</label>
</div>
<div class="form-row">
<label></label>
<label for="node-input-normalizeTags" style="width:70%">
<input type="checkbox" id="node-input-normalizeTags" style="display:inline-block; width:22px; vertical-align:baseline;"> Normalize all tag names to lowercase
</label>
</div>
<div class="form-row">
<label></label>
<label for="node-input-normalize" style="width:70%">
<input type="checkbox" id="node-input-normalize" style="display:inline-block; width:22px; vertical-align:baseline;"> Trim whitespaces inside text nodes
</label>
</div>
<div class="form-row">
<label for="node-input-useAuth"><i class="fa fa-lock"></i> Auth</label>
<input type="checkbox" id="node-input-useAuth" style="width: auto !important;">
<div style="margin-left: 125px" class="node-input-useAuth-row hide">
<div class="form-row">
<input type="text" id="node-input-user" placeholder="User">
</div>
<div class="form-row">
<input type="password" id="node-input-password" placeholder="Password">
</div>
</div>
</div>
<div class="form-row">
<label for="node-input-topic"><i class="fa fa-tags"></i> Topic</label>
<input type="text" id="node-input-topic" placeholder="" style="width: 70%;">
</div>
<div class="form-row">
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="" style="width: 70%;">
</div>
</script>
<script type="text/javascript">
RED.nodes.registerType('simple-soap', {
category: 'network',
color: '#cc66ff',
defaults: {
host: { value: "", required: true, validate: RED.validators.typedInput("hostType") },
hostType: { value: "str" },
path: { value: "/", required: false, validate: RED.validators.typedInput("pathType") },
pathType: { value: "str" },
action: { value: "", required: true, validate: RED.validators.typedInput("actionType") },
actionType: { value: "str" },
body: { value: "payload", required: true, validate: RED.validators.typedInput("bodyType") },
bodyType: { value: "msg" },
mustache: { value: false },
attrkey: { value: "$" },
charkey: { value: "_" },
stripPrefix: { value: false },
simplify: { value: false },
normalizeTags: { value: false },
normalize: { value: false },
topic: { value: "" },
name: { value: "" },
useAuth: { value: false }
},
credentials: {
user: { type: "text" },
password: {type: "password" }
},
inputs: 1,
outputs: 1,
icon: "white-globe.png",
label: function () {
return this.name || "SOAP";
},
oneditprepare: function () {
$("#node-input-useAuth").on("change", function() {
if ($(this).is(":checked")) {
$(".node-input-useAuth-row").show();
} else {
$(".node-input-useAuth-row").hide();
$('#node-input-user').val('');
$('#node-input-password').val('');
}
});
if (this.hostType == null || this.hostType === 'string' || this.hostType === 'none') {
this.hostType = "str";
}
$("#node-input-hostType").val(this.hostType);
$("#node-input-host").typedInput({
default: 'str',
typeField: $("#node-input-hostType"),
types: ['str', 'msg', 'flow', 'global', 'env']
});
if (this.pathType == null || this.pathType === 'string' || this.pathType === 'none') {
this.pathType = "str";
}
$("#node-input-pathType").val(this.pathType);
$("#node-input-path").typedInput({
default: 'str',
typeField: $("#node-input-pathType"),
types: ['str', 'msg', 'flow', 'global', 'env']
});
if (this.actionType == null || this.actionType === 'string' || this.actionType === 'none') {
this.actionType = "str";
}
$("#node-input-actionType").val(this.actionType);
$("#node-input-action").typedInput({
default: 'str',
typeField: $("#node-input-actionType"),
types: ['str', 'msg', 'flow', 'global', 'env']
});
if (this.bodyType == null || this.bodyType === 'string' || this.bodyType === 'none') {
this.bodyType = "msg";
}
if (this.body === undefined) {
$("#node-input-body").val("payload");
}
$("#node-input-bodyType").val(this.bodyType);
$("#node-input-body").typedInput({
default: 'msg',
typeField: $("#node-input-bodyType"),
types: ['str', 'msg', 'flow', 'global', 'env']
});
}
});
</script>