Return-Path: Delivered-To: apmail-ws-synapse-dev-archive@www.apache.org Received: (qmail 55512 invoked from network); 20 Feb 2007 12:58:34 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 20 Feb 2007 12:58:34 -0000 Received: (qmail 76671 invoked by uid 500); 20 Feb 2007 12:58:42 -0000 Delivered-To: apmail-ws-synapse-dev-archive@ws.apache.org Received: (qmail 76645 invoked by uid 500); 20 Feb 2007 12:58:41 -0000 Mailing-List: contact synapse-dev-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: synapse-dev@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list synapse-dev@ws.apache.org Delivered-To: moderator for synapse-dev@ws.apache.org Received: (qmail 19276 invoked by uid 99); 20 Feb 2007 09:35:26 -0000 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of indika.kuma@gmail.com designates 66.249.92.174 as permitted sender) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:sender:to:subject:in-reply-to:mime-version:content-type:references:x-google-sender-auth; b=CxPJcy+t45CeE8FWOMIkc5pthLyZwqSx3GMXdCSLh+t0w1JpXBbP2ru0SfVRL6EnYpsNzKoMNj45GTXRuTUJR7hAjjIIpERR79/zFaujvdJ/Cv3MWqEbKcIt5wTxkIX2dSpUpvAjsXJD8/wKWaJIpYBOcWkpQEHpr0T9ncltrIo= Message-ID: Date: Tue, 20 Feb 2007 15:04:53 +0530 From: "indika kumara" Sender: indika.kuma@gmail.com To: synapse-dev@ws.apache.org, synapse-user@ws.apache.org Subject: Fwd: FW: XSLTMediator problem? In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_49004_8094762.1171964093126" References: <45CD063A.4020103@wso2.com> X-Google-Sender-Auth: 84509eb380df5337 X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_49004_8094762.1171964093126 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline 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 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 something something 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 wrote: > > Asanka, > > Sorry for the delay in getting this posted. Here is the original response > from my back-end service. > > Regards, > Griffin > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"> > > soapenv:mustUnderstand="0" > xmlns:ns2="http://services.fsenablers.com/orderStatus">good > > > xmlns="http://services.fsenablers.com/orderStatus"> > > The message > OK > > > > > > > -----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 > > > > value="file:repository/conf/sample/resources/"/> > > > > > key="transform/updateOrderStatusResponse.xslt"/> > address="http://hostname/services/myservice"/> > > > > > > > > > > > > > > > Here is my style sheet > > 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"> > > > > > > > > > > > > > > > > > > > select="//fse-internal:updateOrderStatusReturn"/> > > > > > > And here is an actual response recieved by the client code > > xmlns:xsd="http://www.w3.org/2001/XMLSchema" > xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"> > > soapenv:mustUnderstand="0" > xmlns:ns2="http://services.fsenablers.com/orderStatus">good > > > xmlns="http://services.fsenablers.com/orderStatus"> > > The message > OK > > > > OK > The message > > > > > -----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:actor="http://schemas.xmlsoap.org/soap/actor/next" > > soapenv:mustUnderstand="0" xmlns:ns2="old-namespace">good > > > > status > a message > > > status > a message > > > ... > > 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 > > ------=_Part_49004_8094762.1171964093126 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline 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


------=_Part_49004_8094762.1171964093126--