Hi Griffin,

Thought I would add something to asankha,

First go to https://issues.apache.org/jira/browse/SYNAPSE which is our jira
(You will have to create an account there) and create a new issue stating
the problem that U encountered.

I think you are still working with the release. You need to get a checkout
of svn head (http://svn.apache.org/viewvc/webservices/synapse/trunk/java/)
and do the code modifications to that codebase locally. Then do a svn diff,
put that diff output in to a file and attach that to the JIRA that U have
created earlier.

So that one of us can apply the changes....

Thanks,
Ruwan.

On 2/21/07, Asankha C. Perera <[EMAIL PROTECTED]> wrote:

 Hi Griffin

You first open a JIRA for the issue, and then subsequently attach a patch
(svn diff) to the JIRA. This is the standard way for a non-commiter of a
project to contribute code to Apache, and through that the license issues
are sorted out

asankha

Michael Griffin wrote:

indika, asanka,

What is the process for submitting a patch?  Let me know and I will submit
it.

Thanks,
Griffin
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] <[EMAIL PROTECTED]>]On Behalf 
Of
indika kumara
Sent: Wednesday, February 21, 2007 12:43 AM
To: [email protected]
Subject: Re: FW: XSLTMediator problem?


Hi Michael
The current implementation of the XSTL Mediator assume SOAP body will have
only one child element. According to the WS-I BasicProfile SOAP Body should
contains only single child element. But According to the SOAP specification
SOAP Body may has children. Therefore we have to change the logic inside the
XSLT Mediator. your solution seems to be fined. Please can you submit a
patch for the required change?.

thanks
indika


On 2/21/07, Michael Griffin <[EMAIL PROTECTED] > <[EMAIL PROTECTED]> wrote:
indika,

You are right, there are multiple children in the soap body -
((SOAPBody)parent).getChildren() returns an Iterator over three OMNode
instances in this order.

TEXT_NODE (white space)
ELEMENT_NODE (Which is the element that I am transforming)
TEXT_NODE (white space)

To me this seems like a likely condition.  Are you encountering something
different in your testing?  I did some more experimentation to better
understand what was happening using the different scenarios

Taking the approach (from version 0.91) of detaching the first child and
adding to the end results in the elimination of the first TEXT_NODE and the
addition of transformation result yielding a SOAPBody which still contains
three children as follows

ELEMENT_NODE (original)
TEXT_NODE (white space)
ELEMENT_NODE (transformed)

With the modified version that tests for the SOAPBody as the parent and then
using setFirstChild instead of addChild the result becomes

ELEMENT_NODE (transformed)
SPACE_NODE (white space)

This seems incorrect as well as the replacement affected more than just what
was transformed.

Why not just replace the existing node simply with a sequence of
addSiblingAfter() and detach().  Doing so is agnostic of the parent or the
existence of any text nodes in the body.  For my experiment the results is
the following

sourceNode.insertSiblingAfter( result );
sourceNode.detach();

TEXT_NODE (white space)
ELEMENT_NODE (transformed node)
TEXT_NODE (white space)

Regards,
Griffin

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] <[EMAIL PROTECTED]>]On Behalf 
Of
indika kumara
Sent: Tuesday, February 20, 2007 4:35 AM
To: [email protected]; [email protected]
Subject: Fwd: FW: XSLTMediator problem?


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 <[EMAIL PROTECTED]> <[EMAIL PROTECTED]>
Date: Feb 12, 2007 4:40 PM
Subject: Re: FW: XSLTMediator problem?
To: [email protected]

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 <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> 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"; <http://www.w3.org/2001/XMLSchema>
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"; 
<http://www.w3.org/2001/XMLSchema-instance>>
   <soapenv:Header>
      <ns2:state soapenv:actor="http://schemas.xmlsoap.org/soap/actor/next
" <http://schemas.xmlsoap.org/soap/actor/next>
soapenv:mustUnderstand="0"
xmlns:ns2="http://services.fsenablers.com/orderStatus"; 
<http://services.fsenablers.com/orderStatus>>good</ns2:state>
   </soapenv:Header>
   <soapenv:Body>
      <updateOrderStatusResponse
xmlns="http://services.fsenablers.com/orderStatus " 
<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: [EMAIL PROTECTED]
Sent: Friday, February 09, 2007 6:40 PM
To: [email protected]
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:[EMAIL PROTECTED] <[EMAIL PROTECTED]>]
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"; 
<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"; 
<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"; 
<http://services.fsenablers.com/orderStatus>
               xmlns:xsl=" http://www.w3.org/1999/XSL/Transform"; 
<http://www.w3.org/1999/XSL/Transform>
               xmlns=" http://www.fsenablers.com/v2"; 
<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/
" <http://schemas.xmlsoap.org/soap/envelope/>
xmlns:xsd=" http://www.w3.org/2001/XMLSchema"; <http://www.w3.org/2001/XMLSchema>
xmlns:xsi=" http://www.w3.org/2001/XMLSchema-instance"; 
<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"; 
<http://services.fsenablers.com/orderStatus>>good</ns2:state>
   </soapenv:Header>
   <soapenv:Body>
      <updateOrderStatusResponse
xmlns=" http://services.fsenablers.com/orderStatus"; 
<http://services.fsenablers.com/orderStatus>>
         <updateOrderStatusReturn>
            <message>The message</message>
            <statusCode>OK</statusCode>
         </updateOrderStatusReturn>
      </updateOrderStatusResponse>
      <uosr xmlns=" http://www.fsenablers.com/v2"; 
<http://www.fsenablers.com/v2>>
         <sc>OK</sc>
         <msg>The message</msg>
      </uosr>
   </soapenv:Body>
</soapenv:Envelope>

-----Original Message-----
From: Asankha C. Perera [mailto:[EMAIL PROTECTED] <[EMAIL PROTECTED]>]
Sent: Thursday, February 08, 2007 9:12 AM
To: [email protected]
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"; 
<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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]






--------------------------------------------------------------------- To
unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


   --------------------------------------------------------------------- To
unsubscribe, e-mail: [EMAIL PROTECTED] For additional
commands, e-mail: [EMAIL PROTECTED]




--
Ruwan Linton
http://www.wso2.org - "Oxygenating the Web Services Platform"

Reply via email to