0
votes

web service consumer is returning value when am using transformer message. but it is not working when am using xslt component. it returns null.

Here is my flow.

Http->byte array to string->xslt->webservice consumer.

can anyone help me?

here is my input

<?xml version="1.0" encoding="UTF-8"?>

<PayLoad>
 <RoutingHeader>
    <SourceID>1234</SourceID>
    <SourceName>ISGN</SourceName>
    <SourceRefNum>167309</SourceRefNum>
    <SourceRoutingRef />
    <DestinationID>999</DestinationID>
    <DestinationRefNum />
    <DestinationRoutingRef />
    <TransDate>2017-04-17T09:04:24.702000-04:00</TransDate>
  </RoutingHeader>
<PayLoad>

am converting this xml into soap using xslt component

here is my xsl xode

<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:s="URI_SOAP_WS">
<xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="/">
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:header/>
    <soap:Body>
        <xsl:apply-templates/>
    </soap:Body>
</soap:Envelope>
</xsl:template>
<xsl:template match="*">
 <xsl:element name="s:{local-name()}" namespace="http://spring.io/guides/s-
  producing-web-service">
    <xsl:apply-templates select="node()|@*" />
</xsl:element>
</xsl:template>
</xsl:stylesheet>

when i send this soap file to webservice consumer component, getting null

2
Please add your input and xsl code - it will be easier to help you. - Alex Fomin
i have added my input file and xsl file. can you help me? - Karthick Ricky

2 Answers

0
votes

Do you mean web service provider is returning different value?

Can you check the input being sent in both the cases. Dataweave's operation on XML is different compared to json or java object.

Try to access the webservice via browser and find the correct input structure and achieve it in flow.

0
votes

When I transformed XML with your XSL, I have below result:

<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:s="URI_SOAP_WS" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:header/>
<soap:Body>
<s:PayLoad xmlns:s="http://spring.io/guides/s-producing-web-service">
<s:RoutingHeader>
<s:SourceID>1234</s:SourceID>
<s:SourceName>ISGN</s:SourceName>
<s:SourceRefNum>167309</s:SourceRefNum>
<s:SourceRoutingRef/>
<s:DestinationID>999</s:DestinationID>
<s:DestinationRefNum/>
<s:DestinationRoutingRef/>
<s:TransDate>2017-04-17T09:04:24.702000-04:00</s:TransDate>
</s:RoutingHeader>
</s:PayLoad>
</soap:Body>
</soap:Envelope>

When you will check this transformed code with schema http://schemas.xmlsoap.org/soap/envelope/
you will have below error:

Validation of current file using XML schema:

ERROR: Element '{http://schemas.xmlsoap.org/soap/envelope/}header': This element is not expected. Expected is one of ( {http://schemas.xmlsoap.org/soap/envelope/}Header, {http://schemas.xmlsoap.org/soap/envelope/}Body ).

It means only that block <soap:header/> should be from upper case as <soap:Header/>, change it in XSL and try again.

If there is still problem try to check below:

How to use Web-Service-Consumer connector in Mule Community Edition

mule - web service consumer (soap) always returns null