synapse-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "indika kumara" <ind...@apache.org>
Subject Fwd: FW: XSLTMediator problem?
Date Tue, 20 Feb 2007 09:34:53 GMT
Hi

I realized that the reply to this mail has not been delivered to the
corresponding lists,therefore I forward it .

thanks
indika

---------- Forwarded message ----------
From: indika kumara <indika.kuma@gmail.com>
Date: Feb 12, 2007 4:40 PM
Subject: Re: FW: XSLTMediator problem?
To: synapse-dev@ws.apache.org

hi Michael

I reproduced the same soap response from the back-end service and it is
transformed using same xslt. I have got expected result as bellow

 <soapenv:Body>

<uosr>

<sc>something</sc>

<msg>something</msg>

</uosr>

</soapenv:Body>


 please recheck the response again from the back -end service. One
possibility of getting the response you have got is to have more than one
child in the soap body. If there are children in the soap body, according to
the current logic in XSLT Mediator, the transformation result will append to
the body as the last child. Therefore incorrect responses like what you have
got can be obtained. It is really an issue of the back-end (SOAP Engine) not
with the synapse.

In XSLT transformation, synapse get the first child of soap body and
transform it and also the transformation result should have one top element.

Your solution should have worked fine even the soap body have
children.(check if the parent is a SOAPBody and then detach first child and
use setFirstOMChild accordingly). Because it replace the first child with
the result.

Therefore if the soap body has only one child(valid soap body) then synapse
should work fine.

thanks

regards

indika




On 2/10/07, Michael Griffin <mgriffin@fsenablers.com> wrote:
>
> Asanka,
>
> Sorry for the delay in getting this posted.  Here is the original response
> from my back-end service.
>
> Regards,
> Griffin
>
> <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:Header>
>       <ns2:state soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next
> "
> soapenv:mustUnderstand="0"
> xmlns:ns2="http://services.fsenablers.com/orderStatus">good</ns2:state>
>    </soapenv:Header>
>    <soapenv:Body>
>       <updateOrderStatusResponse
> xmlns="http://services.fsenablers.com/orderStatus">
>          <updateOrderStatusReturn>
>             <message>The message</message>
>             <statusCode>OK</statusCode>
>          </updateOrderStatusReturn>
>       </updateOrderStatusResponse>
>    </soapenv:Body>
> </soapenv:Envelope>
>
>
> -----Original Message-----
> From: Asankha C. Perera [mailto:asankha@wso2.com]
> Sent: Friday, February 09, 2007 6:40 PM
> To: synapse-dev@ws.apache.org
> Subject: Re: FW: XSLTMediator problem?
>
>
> Hi Griffin
>
> You will need to post a sample response that is sent back to Synapse from
> your back-end service endpoint. This is the message one could simulate
> through Synapse as the response, to check that the XSLT transformation and
> our logic is correct. Indika, could you take a look at this one once
> Griffin
> posts this sample?
>
> thanks
> asankha
>
> Michael Griffin wrote:
>
> -----Original Message-----
> From: Asankha C. Perera [mailto:asankha@wso2.com]
> Sent: Friday, February 09, 2007 3:57 AM
> To: Michael Griffin
> Subject: Re: XSLTMediator problem?
>
>
> Hi Griffin
>
> Could you get me a sample reply from your actual service endpoint as well?
> If these sample messages/transforms are not confidential, I would urge you
> to post this into the synapse-dev list, so that others may also have a
> chance to reply to you as I will be traveling to  the US early morning
> tomorrow my time
>
> asankha
>
> Michael Griffin wrote:
> Asanka,
>
> I am using the 0.91 release.  Here is the contents of synapse.xml
>
> <synapse xmlns="http://ws.apache.org/ns/synapse">
>    <registry provider="org.apache.synapse.registry.url.SimpleURLRegistry">
>       <property name="root"
> value="file:repository/conf/sample/resources/"/>
>       <property name="cachableDuration" value="15000"/>
>    </registry>
>
>    <definitions>
>       <set-property name="OrderStatusUpdateResponse.xslt"
>                     key="transform/updateOrderStatusResponse.xslt"/>
>       <endpoint name="myEndPoint"
>                 address="http://hostname/services/myservice"/>
>    </definitions>
>
>    <rules>
>       <log level="full"/>
>       <in>
>            <send><endpoint ref="myEndPoint"/></send>
>       </in>
>       <out>
>          <xslt key=" OrderStatusUpdateResponse.xslt"/>
>          <send/>
>       </out>
>   </rules>
> </synapse>
>
> Here is my style sheet
>
> <xsl:transform
> xmlns:fse-internal=" http://services.fsenablers.com/orderStatus"
>                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
>                xmlns=" http://www.fsenablers.com/v2"
>                exclude-result-prefixes="fse-internal"
>                version="2.0">
>
>    <xsl:output method="xml" omit-xml-declaration="yes" indent="yes"/>
>    <xsl:template match="text()|@*"/>
>
>    <xsl:template match="fse-internal:updateOrderStatusReturn">
>         <uosr>
>                 <sc><xsl:value-of select="fse-internal:statusCode"/></sc>
>                 <msg><xsl:value-of select="fse-internal:message"/></msg>
>         </uosr>
>    </xsl:template>
>
>    <xsl:template match="fse-internal:updateOrderStatusResponse">
>       <response>
>          <xsl:apply-templates select="*"/>
>       </response>
>    </xsl:template>
>
>    <xsl:template match="/">
>         <xsl:apply-templates
> select="//fse-internal:updateOrderStatusReturn"/>
>    </xsl:template>
>
>
> </xsl:transform>
>
> And here is an actual response recieved by the client code
>
> <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:Header>
>       <ns2:state soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next
> "
> soapenv:mustUnderstand="0"
> xmlns:ns2="http://services.fsenablers.com/orderStatus">good</ns2:state>
>    </soapenv:Header>
>    <soapenv:Body>
>       <updateOrderStatusResponse
> xmlns="http://services.fsenablers.com/orderStatus">
>          <updateOrderStatusReturn>
>             <message>The message</message>
>             <statusCode>OK</statusCode>
>          </updateOrderStatusReturn>
>       </updateOrderStatusResponse>
>       <uosr xmlns=" http://www.fsenablers.com/v2">
>          <sc>OK</sc>
>          <msg>The message</msg>
>       </uosr>
>    </soapenv:Body>
> </soapenv:Envelope>
>
> -----Original Message-----
> From: Asankha C. Perera [mailto:asankha@wso2.com]
> Sent: Thursday, February 08, 2007 9:12 AM
> To: synapse-user@ws.apache.org
> Subject: Re: XSLTMediator problem?
>
>
> Hi Griffin
>
> Can you confirm that you are using 0.91 release? also, is it possible
> for you to share your XSLT and configuration with us? I will look into
> this and get back to you.. but if the above is available, it would be
> quicker for me to try and reproduce this.
>
> asankha
>
> Michael Griffin wrote:
>
> Hi,
>
> I'm new to Synapse but it seems like a great project.  After working
>
> through
>
> some of the samples, I tried to transform the response from an existing
>
> web
>
> service.  The problem I ran into was that my SOAP body on the return
> contained both the original contents plus the transformed contents.  So
> something like this....
>
> ...
> <soapenv:Header>
>       <ns2:state
>
> soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next"
>
> soapenv:mustUnderstand="0" xmlns:ns2="old-namespace">good</ns2:state>
> </soapenv:Header>
> <soapenv:Body>
>    <response xmlns="old-namespace">
>       <status>status</status>
>       <message>a message</message>
>    </responser>
>    <resp xmlns="new-namespace">
>       <sc>status</sc>
>       <msg>a message</msg>
>    </res>
> </soapenv:Body>
> ...
>
> Has anyone else run into this problem?  Is there a way around it.  I've
> verified that my style sheet is working correctly, and the debug output
>
> from
>
> synapse indicates that the result of the transformation is correct.
>
> I did some poking around with the source and found that
> XSLTMediator.performXLST handles the merge of the result back in to the
> source document in two different ways - if the parent was a SOAPEnvelope
> (uses setFirstOMChild) and the other (addChild) if it is not.  With some
> experimentation I can perform and additional test to see if the parent is
>
> a
>
> SOAPBody and use setFirstOMChild accordingly - this results in a proper
> replacement of the source with the transformed elements.
>
> Thoughts?
>
> Thanks
> Griffin
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-user-help@ws.apache.org
>
>
>
>
>
>
> --------------------------------------------------------------------- To
> unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org For additional
> commands, e-mail: synapse-dev-help@ws.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: synapse-dev-unsubscribe@ws.apache.org
> For additional commands, e-mail: synapse-dev-help@ws.apache.org
>
>

Mime
View raw message