on 03-31-2016 11:09 AM
Hi experts,
I need your help to figure out know how to get a specific value from a tag coming from an XML WebService response.
This is a part of the response I get after calling w web service,
The value which I need are the serverUrl and the sessionId.
The first thing came to my mind is to use a Content Modifier with the following header parameters
but unfortunately I receive empty values.
Although it makes no sense I tried also with /result/serverUrl/@Value, /serverUrl/@Value.
I need these values to use them as input values to another web service and pass an SQL query to get data from it.
Thanks in advance.
BR.
Hello Mohammed Amine,
Apart from what Eng Swee has mentioned, what I have noticed is that the SFDCresponse xml contains the namespace prefix: xmlns="urn:partner.soap.sforce.com" and this seems to cause an issue in HCI. This seems to be a bug but I am not too sure.
I had to write a XSLT Mapping to remove XML Namespace prefix post which the same works.
Below is the XSLT Mapping before my Content Modifier step to remove the XML Namespaces.
<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output indent="yes" method="xml" encoding="utf-8" omit-xml-declaration="yes"/>
<!-- Stylesheet to remove all namespaces from a document -->
<!-- NOTE: this will lead to attribute name clash, if an element contains
two attributes with same local name but different namespace prefix -->
<!-- Nodes that cannot have a namespace are copied as such -->
<!-- template to copy elements -->
<xsl:template match="*">
<xsl:element name="{local-name()}">
<xsl:apply-templates select="@* | node()"/>
</xsl:element>
</xsl:template>
<!-- template to copy attributes -->
<xsl:template match="@*">
<xsl:attribute name="{local-name()}">
<xsl:value-of select="."/>
</xsl:attribute>
</xsl:template>
<!-- template to copy the rest of the nodes -->
<xsl:template match="comment() | text() | processing-instruction()">
<xsl:copy/>
</xsl:template>
</xsl:stylesheet>
Regards,
Bhavesh
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello,
This is a request that comes with an xml, How can I get the value of <ubiNum> when it has a namespace assigned? If I remove the "NumberToWords" namespace and put in value //ubiNum it works. In the image, it returns an empty value. Can someone tell me what is the correct way to access a value that is assigned a namespace?
Thank you!
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<NumberToWords xmlns="http://www.dataaccess.com/webservicesserver/">
<ubiNum>10257</ubiNum>
</NumberToWords>
</soap:Body>
</soap:Envelope>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank you all for your quick answers both of them were helpful, the problem is resolved, as there was a problem with the XML Namespace prefix as Bhavesh Kantilal said and using the script I was able to remove it and I got the results without using @Value.
Thanks again.
BR.
Mohammed Amine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
11 | |
11 | |
10 | |
10 | |
8 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.