Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

read measures in application/soap+xml content-type #771

Merged
merged 15 commits into from
Nov 16, 2023

Conversation

AlvaroVega
Copy link
Member

@AlvaroVega AlvaroVega commented Oct 19, 2023

Issue: #759
solution adopted: Parse the XML into a JSON as the value of the measure (then rely un JEXL for further parsing)

For example:

curl -i -X POST 'http://localhost:7897/iot/json/attrs/data?i=disp4&k=izc9cokegoy7kyfgdd6etipt6' -d '<soap:Envelope
	xmlns:soap="http://www.w3.org/2003/05/soap-envelope">
	<soapenv:Header
		xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"/>
		<soapenv:Body
			xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope">
			<ns21:notificationEventRequest
				xmlns:ns21="http://myurl.com">
				<ns21:Param1>ABC12345</ns21:Param1>
				<ns21:Param2/>
				<ns21:Date>28/09/2023 11:48:15 +0000</ns21:Date>
				<ns21:NestedAttr>
					<ns21:SubAttr>This is a description</ns21:SubAttr>
				</ns21:NestedAttr>
				<ns21:Status>Assigned</ns21:Status>
				<ns21:OriginSystem/>
			</ns21:notificationEventRequest>
		</soapenv:Body>
	</soap:Envelope>' -H 'content-type: application/soap+xml'

Produces:

rom=n/a | srv=smartcity | subsrv=/ | msg=Options: {
    "url": "http://iot-orion:1026/v2/entities?options=upsert",
    "method": "POST",
    "headers": {
        "fiware-service": "smartcity",
        "fiware-servicepath": "/"
    },
    "json": {
        "id": "thing:disp4",
        "type": "thing",
        "data": {
            "type": "None",
            "value": {
                "Envelope": {
                    "$": {
                        "xmlns:soap": "http://www.w3.org/2003/05/soap-envelope"
                    },
                    "Header": [
                        {
                            "$": {
                                "xmlns:soapenv": "http://www.w3.org/2003/05/soap-envelope"
                            }
                        }
                    ],
                    "Body": [
                        {
                            "$": {
                                "xmlns:soapenv": "http://www.w3.org/2003/05/soap-envelope"
                            },
                            "notificationEventRequest": [
                                {
                                    "$": {
                                        "xmlns:ns21": "http://myurl.com"
                                    },
                                    "Param1": [
                                        "ABC12345"
                                    ],
                                    "Param2": [
                                        ""
                                    ],
                                    "Date": [
                                        "28/09/2023 11:48:15 +0000"
                                    ],
                                    "NestedAttr": [
                                        {
                                            "SubAttr": [
                                                "This is a description"
                                            ]
                                        }
                                    ],
                                    "Status": [
                                        "Assigned"
                                    ],
                                    "OriginSystem": [
                                        ""
                                    ]
                                }
                            ]
                        }
                    ]
                }
            }
        }
    }
} | comp=IoTAgent

@AlvaroVega AlvaroVega marked this pull request as ready for review October 25, 2023 13:29
@AlvaroVega AlvaroVega changed the title [WIP] Task/add body parser xml Task/add body parser xml Oct 25, 2023
@AlvaroVega AlvaroVega changed the title Task/add body parser xml read measures in application/soap+xml content-type Oct 31, 2023
lib/bindings/HTTPBinding.js Outdated Show resolved Hide resolved
docs/usermanual.md Outdated Show resolved Hide resolved
docs/usermanual.md Outdated Show resolved Hide resolved
AlvaroVega and others added 5 commits November 13, 2023 13:25
received in the payload (in this case, the value `0x68` corresponds to `h` in ASCII). You can use one of the multiple
tools available online like [this one](https://string-functions.com/string-hex.aspx)

In case of using `application/soap+xml` a measure like:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this could be included in an specific subsection?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Useful if we need to provide support to send the link to the exact subsection)

Copy link
Member

@fgalan fgalan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@rg2011 rg2011 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Collaborator

@mapedraza mapedraza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@mapedraza mapedraza merged commit 25e82b8 into master Nov 16, 2023
7 checks passed
@mapedraza mapedraza deleted the task/add_body_parser_xml branch November 16, 2023 16:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants