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

Encoder: Support for XML namespaces #54

Open
mickeyl opened this issue Sep 5, 2020 · 1 comment
Open

Encoder: Support for XML namespaces #54

mickeyl opened this issue Sep 5, 2020 · 1 comment

Comments

@mickeyl
Copy link

mickeyl commented Sep 5, 2020

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).

@MaxDesiatov
Copy link

Hi @mickeyl, thank you for creating this issue. As far as I understand, XMLParsing is no longer maintained. I maintain a fork of this library, it's called XMLCoder and contains bugfixes and feature improvements. One of those is a namespaces flag that you could find helpful. If it doesn't work for your case, please let me know either here, or by opening an issue in the XMLCoder repository, I would be happy to improve the library so that it better serves all users.

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

No branches or pull requests

2 participants