Reputation: 9
I'm using a software that imports an XML file into a workflow then exports it to a web service using workflow tasks. The XML file is like:
<?xml version="1.0"?>
<NostroEvent>
<Id>1</Id>
<AccountNumber>123</AccountNumber>
<Debit>100</Debit>
</NostroEvent>
The file is imported and I'm writing the following SOAP request of the ExportWS task that would select all the tags of the xml and sends them to the web service: (the configuration of the connection to the web service is also entered in that task in another section)
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<!--xsl:variable name="nostro">
<xsl:copy-of select="NostroEvent"></xsl:copy-of>
</xsl:variable-->
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bmt="http://bmt">
<soapenv:Header/>
<soapenv:Body>
<bmt:insertNostro>
<bmt:Xml><xsl:copy-of select="NostroEvent"/></bmt:Xml>
</bmt:insertNostro>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
</xsl:stylesheet>
Note that insertNostro is the web method and Xml is the parameter, to which I'm passing the set of tags and text starting from NostroEvent. But it's not working. I keep getting a null pointer exception meaning that the web service received a null string. I tried to use an xsl variable at the top but it was also useless.
Upvotes: 0
Views: 749
Reputation: 463
If the problem is that it is XML and not a string, Try doing something like this:
<xsl:template match="/">
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:bmt="http://bmt">
<soapenv:Header/>
<soapenv:Body>
<bmt:insertNostro>
<bmt:Xml>
<xsl:apply-templates select="NostroEvent" mode="toString"/>
</bmt:Xml>
</bmt:insertNostro>
</soapenv:Body>
</soapenv:Envelope>
</xsl:template>
<xsl:template match="*" mode="toString">
<<xsl:value-of select="local-name()"/>><xsl:apply-templates select="child::node()" mode="toString"></xsl:apply-templates><<xsl:value-of select="local-name()"/> />
</xsl:template>
Upvotes: 1