Skip to content

SOAP request fails #34

Description

@tosbaha

For the following XML document(SOAP service), XPath can't find the elements.

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <ServiceResponse xmlns="http://sub.domain.com">
            <ServiceReturn>
                <a>US</a>
                <b>
                    <b>
                        <e>Herrod</e>
                        <f>molestie@necmetus.edu</f>
                        <g>Et Commodo LLC</g>
                        <i>07/14/2014</i>
                    </b>
                    <b>
                        <e>Armand</e>
                        <f>est@vitae.org</f>
                        <g>Vel Convallis In Consulting</g>
                        <i>04/18/2015</i>
                    </b>
                    <b>
                        <e>Bernard</e>
                        <f>nulla@blandit.net</f>
                        <g>Cursus Nunc Mauris PC</g>
                        <i>11/12/2015</i>
                    </b>
                    <b>
                        <e>Dante</e>
                        <f>lorem@acmi.org</f>
                        <g>Sit Amet Ltd</g>
                        <i>01/19/2016</i>
                    </b>
                </b>
                <c>0</c>
                <k>12345678</k>
            </ServiceReturn>
        </ServiceResponse>
    </soapenv:Body>
</soapenv:Envelope>

Here are the result of some functions

document.rootElement.firstChildWithTag("Body", inNamespace: "soapenv") //some
document.rootElement.firstChildWithTag("//soapenv:Body/ServiceResponse") //nil
document.rootElement.firstChildWithTag("//Body//b", inNamespace: "soapenv") //nil
document.firstChildWithXPath("//ServiceResponse") //nil
document.firstChildWithXPath("//ServiceReturn") //nil
document.firstChildWithXPath("//*/ServiceReturn/b/b") //nil
document.firstChildWithXPath("//ServiceReturn/b/b") //nil
document.firstChildWithXPath("//b/b") //nil

Another example

<?xml version="1.0" encoding="UTF-8"?>
<S:Envelope xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
   <S:Body>
      <ns2:OperationHistoryData xmlns:ns2="http://www.domain.org/operation" xmlns:ns3="http://www.domain.org/info" xmlns:ns5="http://www.domain.org/data">
         <ns2:historyRecord>
            <ns2:DestinationAddress>
               <ns2:Index>190000</ns2:Index>
               <ns2:Description>Info 1</ns2:Description>
            </ns2:DestinationAddress>
         </ns2:historyRecord>
      </ns2:OperationHistoryData>
   </S:Body>
</S:Envelope>

Whenever there is nested namespaces, ono can't parse it. I don't know maybe it is limitation of libxml. Only workaround I found is to strip name spaces and other attributes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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