I have written simple message flow where HTTPInput node takes in a
JSON message and sends back a SOAP message. I have added a HTTPInput,
Compute and HTTPReply nodes. Compute node has the below ESQL.
BEGIN
SET OutputRoot.SOAP.users[] =
(SELECT I.id AS id,
I.name AS name,
I.userName AS username,
I.email AS email
FROM InputRoot.JSON.Data[]
AS I);
RETURN TRUE;
END;
When I make a service call, with the below JSON
{
"id": 1,
"name": "lalala Graham",
"username": "Bret",
"email": "Sincere#april.biz",
"address": {
"street": "Kulas Light",
"suite": "Apt. 556",
"city": "Gwenborough",
"zipcode": "92998-3874",
"geo": {
"lat": "-37.3159",
"lng": "81.1496"
}
}
}
the XML response I get is
<SOAP_Domain_Msg>
<users>
<id>1</id>
<name>lalala Graham</name>
<email>Sincere#april.biz</email>
</users>
</SOAP_Domain_Msg>
My issue is I want this response in a SOAP envelop.
I tried adding a SOAP Envelop node before the HTTPReply node
but I'm getting the below error.
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<SOAP-ENV:Body>
<SOAP-ENV:Fault>
<faultcode>SOAP-ENV:Server</faultcode>
<faultstring>BIP3113E: Exception detected in message flow MFSamplej2s (integration node integration_server)</faultstring>
<faultactor>http://localhost:7800/users</faultactor>
<detail>
<text>Exception. BIP2230E: Error detected whilst processing a message in node 'MFSamplej2s.SOAP Envelope'. : C:\ci\product-build\WMB\src\WebServices\WSLibrary\ImbSOAPEnvelopeNode.cpp: 280: ImbSOAPEnvelopeNode::evaluate: ComIbmSOAPEnvelopeNode: MFSamplej2s#FCMComposite_1_1
BIP3171E: A message using an incorrect parser ('SOAP') was detected in node: 'SOAP Envelope' : C:\ci\product-build\WMB\src\WebServices\WSLibrary\ImbSOAPEnvelopeNode.cpp: 613: ImbSOAPEnvelopeNode::getMessageBody: :</text>
</detail>
</SOAP-ENV:Fault>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
Any help would be very much helpful.
This worked with the following code.
SET OutputRoot.XMLNSC.ns1:citizen.ns1[] =
(SELECT I.username AS username,
I.personID AS personID,
I.familyName AS familyName,
I.title AS title,
I.dob AS dob
FROM InputRoot.JSON.Data[] AS I);
The SOAP had to be replaced by XMLNSC, then the SOAP response came. Actually this was in the link #Supun shared.
I think the following thread explains several options.
https://www.ibm.com/mysupport/s/question/0D50z00005q4M4UCAU/example-for-converting-incoming-json-to-soap-message-in-esql-iib?language=en_US
Related
I am using the VMWare vCenter REST API to deploy new Virtual Machines from OVF library items. Part of the API allows for additional_paramaters but I am unable to get it to function properly. Specifically, I would like to set the PropertyParams for custom OVF template properties.
When deploying VM from OVF, I am using the following REST API:
POST https://{server}/rest/com/vmware/vcenter/ovf/library-item/id:{ovf_library_item_id}?~action=deploy
I have tried many structures and either end up with the POST succeeding but the parameters completely ignored, or with a 500 Internal Server error with a message about failing to convert the properties structure:
Could not convert field 'properties' of structure 'com.vmware.vcenter.ovf.property_params'
The payload that seems correct from the documentation (but fails with the error above):
deployment_spec : {
/* ... */
additional_parameters : [
{
type : 'PropertyParams',
properties : [
{
id : 'my_property_name',
value : 'foo',
}
]
}
]
}
Given an OVF that contains the following:
<ProductSection>
<Info>Information about the installed software</Info>
<Product>MyProduct</Product>
<Vendor>MyCompany</Vendor>
<Version>1.0</Version>
<Category>Config</Category>
<Property ovf:userConfigurable="true" ovf:type="string" ovf:key="my_property_name" ovf:value="">
<Label>My Property</Label>
<Description>A custom property</Description>
</Property>
</ProductSection>
This also fails for other property types such as boolean.
Note that I have posted on the vCenter forums as well.
I had the same issue, i success to solve it by browsing the vapi structure /com/vmware/vapi/metadata/metamodel/structure/id:<idstructure>
Here is my finding :
firstly, get your properties structure by using the filter api :
https://{{vc}}/rest/com/vmware/vcenter/ovf/library-item/id:300401a5-4561-4c3d-ac67-67bc7a1a6
Then, to deploy, use the class com.vmware.vcenter.ovh.property_params. It will be more clear with the exemple :
{
"deployment_spec": {
"accept_all_EULA": true,
"name": "clientok",
"default_datastore_id": "datastore-10",
"additional_parameters": [
{
"#class": "com.vmware.vcenter.ovf.property_params",
"properties":
[
{
"instance_id": "",
"class_id": "",
"description": "The gateway IP for this virtual appliance.",
"id": "gateway",
"label": "Default Gateway Address",
"category": "LAN",
"type": "ip",
"value": "10.1.2.1",
"ui_optional": true
}
],
"type": "PropertyParams"
}
]
}
I can't seem to be able to post data using a TableController via postman.
I receive the following error:
{"message":"An error has occurred.","exceptionMessage":"Multiple actions were found that match the request: \r\nPostPerson on type CEVault.Backend.NetStandard.Controllers.Mobile.PersonController\r\nSetDomainManager on type CEVault.Backend.NetStandard.Controllers.Mobile.PersonController\r\nSetContext on type CEVault.Backend.NetStandard.Controllers.Mobile.PersonController\r\nSetContext on type CEVault.Backend.NetStandard.Controllers.Mobile.PersonController","exceptionType":"System.InvalidOperationException","stackTrace":" at System.Web.Http.Controllers.ApiControllerActionSelector.ActionSelectorCacheItem.SelectAction(HttpControllerContext controllerContext)\r\n at System.Web.Http.Controllers.ApiControllerActionSelector.SelectAction(HttpControllerContext controllerContext)\r\n at System.Web.Http.ApiController.ExecuteAsync(HttpControllerContext controllerContext, CancellationToken cancellationToken)\r\n at System.Web.Http.Dispatcher.HttpControllerDispatcher.d__1.MoveNext()"}
Looks like the server can't find the route. However all other actions/verbs work just fine (Patch, delete, get).
IN postman this is the code:
POST /tables/person HTTP/1.1
Host: localhost:43689
ZUMO-API-VERSION: 2.0.0
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 62bb9475-2b24-024a-b434-c9ddec0bcd9c
{
"deleted": false,
"id": "81FEF95A-2B61-4CE6-B9F7-FEBD572DADD1",
"avatar": "",
"notes": null,
"lastName": "Trumpet",
"middleName": "Ignacio",
"firstName": "Donald",
"userId": "81FEF95A-2B61-4CE6-B9F7-FEBD572DA876"
}
Any help is appreciated.
{"message":"An error has occurred.","exceptionMessage":"Multiple actions were found that match the request: \r\nPostPerson on type CEVault.Backend.NetStandard.Controllers.Mobile.PersonController\r\nSetDomainManager on type CEVault.Backend.NetStandard.Controllers.Mobile.PersonController\r\nSetContext on type CEVault.Backend.NetStandard.Controllers.Mobile.PersonController\r\nSetContext on type CEVault.Backend.NetStandard.Controllers.Mobile.PersonController","exceptionType":"System.InvalidOperationException",
According to your error message, I assumed that there are some actions (PostPerson, SetDomainManager,SetContext) in your PersonController.cs which could both match your posted request.
Per my understanding, if you have some internal methods which are used to handle your business logic, you could mark them as protected or private instead of public. Or you could leverage RouteAttribute (e.g. [Route("tables/TodoItem")]) to mark your actions for attribute-based routing. When using RouteAttribute, you need to enable it by adding the following code in the ConfigureMobileApp method of your Startup.MobileApp.cs:
config.MapHttpAttributeRoutes();
For more details, you could follow Adrian Hall's blog.
There is an M2M Application which wants to talk to the temperature sensors on the field, i.e. send/receive messages using MQTT pub/sub protocol.
I have setup both IOTDM as well as one with eclipse OneM2M using Mosquito. But, I am looking for some sample APIs/commands through which a M2M application can send a message to the MQTT client and vice versa.
Or if any of you could point me to the appropriate call flows that would be helpful.
Any help would be highly appreciated.
Here is a GET MQTT message example:
topic: /oneM2M/req/{{origin}}/{{cse-id}}/json
message:
{
"m2m:rqp": {
"op": "2",
"to": "{{resource_uri}}",
"fr": "{{origin}}",
"rqi": 12345,
"pc": ""
}
}
{{resource_uri}} is the relative path of a resource existing on the
oneM2M server (e.g. /my_cse_base/my_ae)
{{origin}} is the origin enabled (by ACP) to retrieve the resource
{{cse-id}} is the CSEbase ID
The message received could be similar to:
topic: /oneM2M/resp/{{origin}}/{{cse-id}}/json
message:
{
"m2m:rsp": {
"rsc": 2000,
"rqi": 12345,
"pc": {
"m2m:ae": {
"pi": "Sy2XMSpbb",
"ty": 2,
"ct": "20170706T085259",
"ri": "r1NX_cOiVZ",
"rn": "my_ae",
"lt": "20170706T085259",
"et": "20270706T085259",
"acpi": ["/my_cse_base/acp_my_ae"],
"aei": "my_ae_id",
"rr": true
}
}
}
}
A POST example:
topic: /oneM2M/req/{{origin}}/{{cse-id}}/json
message:
{
"m2m:rqp": {
"op": "1",
"to": "{{resource_uri}}",
"fr": "{{origin}}",
"rqi": 12345,
"ty": "4",
"pc": {
"m2m:cin": {
"cnf": "text/plain:0",
"con": "123",
"lbl": ["test"]
}
}
}
}
{{resource_uri}} is the relative path of a resource existing on the
oneM2M server (e.g. /my_cse_base/my_ae)
{{origin}} is the origin enabled (by ACP) to create a new resource
{{cse-id}} is the CSEbase ID
For an JS speach i made an app for mesure the soil moisture. I used MQTT for send information from my Arduino to server written in NodeJS. I don't know if you have some skills on JS. You can see the cond on my github repo . I hope this solution can help you.
I try to:
curl -v -u j123:j321 -X POST "http://localhost:8088/ari/channels/1421226074.4874/snoop?spy=SIP/695"
In response to receiving:
"message": "Invalid direction specified for spy"
I try to:
SIP/695; SIP:695, SIP#695, localhost#695, channel, channelName
It's all not working.
Call comes into the queue from sip-416 to queue_1 and distribute to 694. I need to connect 695 for wiretapping channel 1421226074.4874.
I only need to listen and not to whisper.
Help me please)
The error message is telling you what the problem is:
"message": "Invalid direction specified for spy"
The spy parameter is a direction for spying, not the channel to spy on (see reference documentation here). You've already specified the channel to snoop on in the URI path - you need to specify the direction of the media in the spy parameter.
As an aside, apparently the auto generated wiki isn't display enum values, which is unfortunate. We'll have to fix that.
For reference, here's the parameter in the Swagger JSON:
"name": "spy",
"description": "Direction of audio to spy on",
"paramType": "query",
"required": false,
"allowMultiple": false,
"dataType": "string",
"defaultValue": "none",
"allowableValues": {
"valueType": "LIST",
"values": [
"none",
"both",
"out",
"in"
]
}
Given the ID of a Way in OSM, I'd like to get a list of (lat, lon) pairs.
If I request the way via the standard API, I get a list of Node IDs:
$ curl 'http://www.openstreetmap.org/api/0.6/way/158602261'
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" ...>
<way id="158602261" visible="true" ...>
<nd ref="295505187"/>
<nd ref="1736599935"/>
<nd ref="295505112"/>
...
</osm>
I can then do follow-up queries for each of these nodes:
$ curl 'http://www.openstreetmap.org/api/0.6/node/295505187'
<?xml version="1.0" encoding="UTF-8"?>
<osm version="0.6" ...>
<node id="295505187" visible="true" ... lat="37.7702484" lon="-122.5107188"/>
</osm>
But this will require many API requests, one per node in the path.
Is it possible to get the list of lat/lons using fewer API calls? Just one call would be ideal.
Just append /full to the URL, e.g. http://www.openstreetmap.org/api/0.6/way/158602261/full.
I'm not sure if this can be done with the plain-old OSM API, but it can be done using the Overpass API's recurse down statement:
$ curl 'http://overpass.osm.rambler.ru/cgi/interpreter?data=%5Bout:json%5D;(way(158602261);%3E;);out;'
{
"version": 0.6,
"generator": "Overpass API",
...
"elements": [
{
"type": "node",
"id": 30677708,
"lat": 37.7712040,
"lon": -122.5108280
},
{
"type": "node",
"id": 30677709,
"lat": 37.7730278,
"lon": -122.4715596
},
...
{
"type": "way",
"id": 158602261,
"nodes": [
295505187,
1736599935,
295505112,
295505186,
...
]
}
]
}
Since you explicitly asked for a list of lat/lon pairs for a single way id, you could use the Overpass API CSV output mode.
[out:csv(::lat,::lon;false)];
way(158602261);>;out;
(Headerline is suppressed by "false")
Result:
37.7712040 -122.5108280
37.7730278 -122.4715596
37.7733457 -122.4652858
37.7746245 -122.4547306
37.7664503 -122.4531098
...
Overpass Turbo Link: http://overpass-turbo.eu/s/6NG