I'm using this npm-module: https://github.com/vpulim/node-soap
The webservice I want to consume is only using SOAP 1.2 and returns a server error on using any other SOAP version.
Has someone experienced the same problem and knows how to set the SOAP version?
With latest version of https://github.com/vpulim/node-soap, there is option to set SOAP 1.2 header
var options = {
forceSoap12Headers: true
};
soap.createClient(url,options, function (err, client) {
//Your soap call here
});
IMO, I dont think we should modify the lib, not good for upgrade
I have solved the issue changing as NicolasZ said, my current soap/lib/client.js is:
line 187:
xml = "<soap:Envelope " +
//"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
"xmlns:soap=\"http://www.w3.org/2003/05/soap-envelope\" " +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
encoding +
this.wsdl.xmlnsInEnvelope + '>' +
((self.soapHeaders || self.security) ?
(
"<soap:Header>" +
(self.soapHeaders ? self.soapHeaders.join("\n") : "") +
(self.security ? self.security.toXML() : "") +
"</soap:Header>"
)
:
''
) +
"<soap:Body" +
(self.bodyAttributes ? self.bodyAttributes.join(' ') : '') +
">" +
message +
"</soap:Body>" +
"</soap:Envelope>";
You could go into soap\lib\client.js to the line 186 and modify the envelope syntaxis so it is compliant with soap 1.2:
//modify this with the envelope used by soap1.2:
xml = "<soap:Envelope " +
"xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" " +
'xmlns:xsd="http://www.w3.org/2001/XMLSchema"' +
'xmlns:ns2="http://xml.apache.org/xml-soap"' +
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " +
encoding +
this.wsdl.xmlnsInEnvelope + '>' +
//until here
((self.soapHeaders || self.security) ?
(
"<soap:Header>" +
(self.soapHeaders ? self.soapHeaders.join("\n") : "") +
(self.security ? self.security.toXML() : "") +
"</soap:Header>"
)
:
''
) +
"<soap:Body" +
(self.bodyAttributes ? self.bodyAttributes.join(' ') : '') +
">" +
message +
"</soap:Body>" +
"</soap:Envelope>";
Related
What I have right now is I am authorizing using views. Now, I want to access all the underlying data inside a dataset.
view_dataset: '***'
view_table: '***'
table_dataset: '***'
view_string = "view={'projectId': '" + view_project + "', 'datasetId': '" + view_dataset + "', 'tableId': '" + view_table + "'}"
view_source = bigquery.Table(view_project + '.' + view_dataset + '.' + view_name)
dataset = client.get_dataset(table_project + '.' + table_dataset)
access_entries = dataset.access_entries
table_source = bigquery.Dataset(table_project + '.' + table_dataset)
access_entries.append(bigquery.AccessEntry(None, "view", view_source.reference.to_api_repr()))
table_source.access_entries = access_entries
table_source = client.update_dataset(table_source, ["access_entries"])
How will I be able to authorize view_dataset to access table_dataset programmatically?
To anyone who wants to authorize programatically, here is how I did it:
Create an entity ID for the dataset:
entity_id = {
'dataset': {
'projectId': table_project,
'datasetId': view_dataset,
},
'target_types': 'VIEWS'
}
Then, instead of view, use dataset:
access_entries.append(bigquery.AccessEntry(None, "dataset", entity_id))
I've managed to do this by reading the AccessEntry class on dataset.py of BigQuery.
If the ``entity_type`` is 'dataset', the ``entity_id`` is a ``dict``
that includes a 'dataset' field with a ``dict`` representing the dataset
and a 'target_types' field with a ``str`` value of the dataset's resource type:
{
'dataset': {
'projectId': string,
'datasetId': string,
},
'target_types: 'VIEWS'
}
I created an Azure App Insights with Pulumi and with GetComponnectOutput I received the output like the below:
Sample Code:
app_insights_key = insights.get_component_output(
resource_group_name=temp_resources_group.name,
resource_name=temp_app_insights.name,
)
pulumi.export('the output is:', app_insights_key)
The Output is:
Outputs:
+ the output is:: {
+ app_id : "46470d16-bff3--b6fa8effc890"
+ application_id : "app-insights-temp112-gx"
+ application_type : "web"
+ connection_string : "InstrumentationKey=8418a8ce.com/"
+ creation_date : "2022-05-14T17:40:20.5340124+00:00"
+ disable_ip_masking : true
+ etag : "\"e800edf3-0000-0100-0000-627fe9860000\""
+ flow_type : "Bluefield"
+ id : "/subscriptions/7bb4482f-3343-4b08"
+ ingestion_mode : "LogAnalytics"
+ instrumentation_key : "8418a8cd-5700-7-3138752bd5f6"
I wanna access to instrumentation_key and try to use the below way:
app_key = app_insights_key["instrumentation_key"]
But I received an error.
RuntimeError: Event loop is closed
get_component_output return type is Output[GetComponentResult], so you need to use apply to get its property:
component = insights.get_component_output(
resource_group_name="temp_resources_group.name",
resource_name="temp_app_insights.name",
)
app_insights_key = component.apply(lambda c: c.instrumentation_key)
Read more in Inputs/Outputs, Apply.
I'm using npm package steam-user
I'm stuck on getting steam name from steam id, I tried this:
var name;
client.getPersonas([sid], function(personas) {
var persona = personas[sid];
name = persona ? persona.player_name : ("[" + sid + "]");
});
console.log(config.console_userMessageReceived + "(" + name + " | " + sid + "): " + message);
However when the variable name is printed in console, its printed as undefined. Any help how to solve this, and print the actual steam name?
Seems like you have asynchronous call. Try this:
var name;
client.getPersonas([sid], function(personas) {
var persona = personas[sid];
name = persona ? persona.player_name : ("[" + sid + "]");
console.log(config.console_userMessageReceived + "(" + name + " | " + sid + "): " + message);
});
This doesn't work. Here cl is xmpp-client object of who wants to leave from group.
cl.on('online', function (userData) {
var userJid = userData.jid.user + '#' + userData.jid.domain + "/" + userData.jid.resource,
roomJid = params.typeId + params.service + userData.jid.domain + '/' + params.userName;
pres = new xmpp.Element('presence', {
from : userJid,
to : roomJid, //54d213e000e9e50c4e8e5a2b#conference.domain/nickName
type : 'unavailable',
xmlns : 'jabber:client'
});
status = cl.send(pres);
});
Hi consider this example
// surname_and_name: function(){
// return (this.name_last==null ? '' : this.name_last + ' ') +
// (this.name_middle==null ? '': this.name_middle + ' ') +
// (this.name_first==null ? '' : this.name_first + ' ') +
// (this.name_prefix==null ? '' : this.name_prefix + ' ') +
// (this.name_suffix==null ? '' : this.name_suffix);
// },
toJSON: function() {
var obj = this.toObject();
obj.surname_and_name = (obj.name_last==null ? '' : obj.name_last + ' ') +
(obj.name_middle==null ? '': obj.name_middle + ' ') +
(obj.name_first==null ? '' : obj.name_first + ' ') +
(obj.name_prefix==null ? '' : obj.name_prefix + ' ') +
(obj.name_suffix==null ? '' : obj.name_suffix);
return obj;
}
i am trying to query and sort it by "surname_and_name" computed field.
i tried commented code as well, i get this error, for method
co_user.find(sort : {surname_and_name: 'asc' }).exec(error,res)
Error: ER_BAD_FIELD_ERROR: Unknown column 'co_user.surname_and_name' in 'order clause'
The toJSON method is called when sending model data back from the server, not during queries. Therefore, the surname_and_name property is not available during queries; only real model attributes can be used as query parameters. If this kind of sort is important to you, I'd recommend making an actual surname_and_name attribute for your model which gets automatically calculated every time the model is saved, using the model class's afterCreate() and afterUpdate() lifecycle callbacks.