-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Bug] XPath filter returns no results #2050
Comments
I think I've seen this reported before somewhere. It looks like the XPath library we're using doesn't like the Perhaps we should look at updating our XPath dependency or finding a more-complete one. |
yeah, the hard part is not being able to control the TOKEN API call that adds the xmlns. And .... I don't think there's another way to do this, correct? If I want to chain together commands and grab the token value, this is really the only method. |
Not quite. You could write your own fork of the Response Tag plugin or maybe make use of this one https://insomnia.rest/plugins/insomnia-plugin-response-eval |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
I'm also facing this problem! My XML response: <?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
xmlns="urn:enterprise.soap.sforce.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Body>
<loginResponse>
<result>
<metadataServerUrl>invalidurl.com/metadata</metadataServerUrl>
<passwordExpired>false</passwordExpired>
<sandbox>false</sandbox>
<serverUrl>https://invalidurl.com</serverUrl>
<sessionId>COMPLETELYINVALIDVALUE</sessionId>
<userId>redacted</userId>
<userInfo>
<accessibilityMode>false</accessibilityMode>
<currencySymbol xsi:nil="true"/>
<orgAttachmentFileSizeLimit>5242880</orgAttachmentFileSizeLimit>
<orgDefaultCurrencyIsoCode xsi:nil="true"/>
<orgDefaultCurrencyLocale xsi:nil="true"/>
<orgDisallowHtmlAttachments>false</orgDisallowHtmlAttachments>
<orgHasPersonAccounts>false</orgHasPersonAccounts>
<organizationId>redacted</organizationId>
<organizationMultiCurrency>true</organizationMultiCurrency>
<organizationName>redacted</organizationName>
<profileId>redacted</profileId>
<roleId>redacted</roleId>
<sessionSecondsValid>7200</sessionSecondsValid>
<userDefaultCurrencyIsoCode>USD</userDefaultCurrencyIsoCode>
<userEmail>redacted</userEmail>
<userFullName>redacted</userFullName>
<userId>redacted</userId>
<userLanguage>redacted</userLanguage>
<userLocale>redacted</userLocale>
<userName>redacted</userName>
<userTimeZone>redacted</userTimeZone>
<userType>Standard</userType>
<userUiSkin>Theme3</userUiSkin>
</userInfo>
</result>
</loginResponse>
</soapenv:Body>
</soapenv:Envelope> And I want to get the value under The same XPath works when testing it elsewhere. |
There appears to be an issue with XPath if namespaces are used. For instance, if It appears that the XPath library we use requires the namespaces to be sent in code. 🤔 These seem to be the same findings as the previous comments where namespace attributes cause issues. @ppazos, is the XPath query you are using by chance, operating on a response that contains namespaces? The error you found where a result is shown when the filter is empty is a valid edge case for sure - I have raised a PR to fix that: #4012. |
@develohpanda the xml I'm querying has ns declared in the root element:
This uses the default ns http://schemas.openehr.org/v1, so the element names don't include any ns information. For instance if you have xmlns:xxx="http://schemas.openehr.org/v1", then all tags will be xxx:tag This is the full XML:
And I'm trying to access this value: c8a0a6ef-a006-497a-b674-c1e595c30303::CABOLABS_EHR_SERVER::1 |
Thanks @ppazos, that'll be very helpful to debug, alongside the other examples in this issue. Unfortunately I don't have any timeframe for when this might be fixed (right now), on looking through https://github.com/goto100/xpath there doesn't appear to be a straightforward solution using this, so we might need to explore other libraries. I am certainly available and happy to assist in case anybody wants to pick this up! 🙌🏽 |
I'm ignorant about libraries for JS development specially for desktop apps. Though if there is a DOM implemented somewhere, it might have XPath https://developer.mozilla.org/en-US/docs/Web/XPath/Introduction_to_using_XPath_in_JavaScript |
I ran into this issue but to help others, the XML API returns this. In my case I need to get the To get you can use the following xPath, HTH someone who hits this issue
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Header>
<TicketHeader
xmlns="http://www.webcrm.com/">
<Guid>2f6931c2-f2f6-4780-99bd-XXXXXXX</Guid>
</TicketHeader>
</soap:Header>
<soap:Body>
<AuthenticateResponse
xmlns="http://www.webcrm.com/">
<AuthenticateResult>
<Message />
<Code>0</Code>
</AuthenticateResult>
</AuthenticateResponse>
</soap:Body>
</soap:Envelope> |
Ran into this issue and spent many more hours than I would have liked to try to authenticate with Tableau on further requests. Following @rippo example.
|
Describe the bug
I am trying to chain together a few API calls. Step #1, get a TOKEN, Step #2, use the token in subsequent calls.
Here is the sample response from the TOKEN API call:
Then in my "next" API call, I am using the Insomnia RESPONSE functionality, by grabbing the TOKEN from the body.
Using the following XPath filter:
However, the UI in the modal window says "Returned no results".
The example does work in https://extendsclass.com/xpath-tester.html
It appears to be the xmlns value
Screenshots
attached
Desktop (please complete the following information):
The text was updated successfully, but these errors were encountered: