Skip to content

Encoder: Support for XML namespaces #54

@mickeyl

Description

@mickeyl

I'd like to use this library for communicating with SOAP web-services. For those, you often encounter namespaces in SOAP requests, e.g.:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:typ="http://xxxx.com/ipcp/services/v2/common/types" xmlns:par="http://xxxx.com/ipcp/services/v2/reservationWebService/parameters" xmlns:typ1="http://xxxx.com/ipcp/services/v2/reservationWebService/types">
    <soapenv:Header>
        <typ:IpcpHeader>
            <typ:tenantKey>FOO</typ:tenantKey>
            <typ:userName>BAR</typ:userName>
            <typ:password>BAZ</typ:password>
        </typ:IpcpHeader>
    </soapenv:Header>
    <soapenv:Body>
        <par:CreateReservation>
            <par:areaId>302</par:areaId>
            <par:productId>654</par:productId>
            <par:customerId>2852</par:customerId>
            <par:accessInformations>
                <typ:accessTypeId>1</typ:accessTypeId>
                <typ:accessTypeKey></typ:accessTypeKey>
                <typ:accessInformationId></typ:accessInformationId>
                <typ:encodedValue>newnew08234</typ:encodedValue>
                <typ:displayedValue>newnew08234</typ:displayedValue>
            </par:accessInformations>
            <par:accessInformations>
                <typ:accessTypeId>51</typ:accessTypeId>
                <typ:accessInformationId>6004</typ:accessInformationId>
                <typ:encodedValue>830394</typ:encodedValue>
                <typ:displayedValue>830394</typ:displayedValue>
            </par:accessInformations>
            <par:startTime>2019-11-06T12:41:00.000+01:00</par:startTime>
            <par:endTime>2019-12-06T12:41:00.000+01:00</par:endTime>
        </par:CreateReservation>
    </soapenv:Body>
</soapenv:Envelope>

What's the best way to create an XML-document like this one with XMLParsing? It would be nice if we could enhance a struct to feature an optional qualifiedNamespace field that contains the namespace prefix (which would then be automatically inserted by the encoder) and the local name (URI, which could either be automatically scanned and inserted into the envelope, or manually).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions