Hi Ruwan,

 

Thank you for the great help.

I tried the solution you suggested.

But could not pass through the XSLT Mediator ( I'm sure that I did something
terribly wrong):

 

I am getting an error as mentioned below:

 

 

============================================================================
==========================================================================

[I/O reactor worker thread 7] INFO  PipeImpl - Using simulated buffered
Pipes for event-driven to stream IO bridging

[HttpServerWorker-1] ERROR ServerWorker - Error processing POST request

org.apache.axis2.AxisFault: The endpoint reference (EPR) for the Operation
not found is /soap/MySvc and the WSA Action = http://developer.intuit.com/c

lientVersion

        at
org.apache.axis2.engine.DispatchPhase.checkPostConditions(DispatchPhase.java
:48)

        at org.apache.axis2.engine.Phase.invoke(Phase.java:399)

        at org.apache.axis2.engine.AxisEngine.invoke(AxisEngine.java:203)

        at org.apache.axis2.engine.AxisEngine.receive(AxisEngine.java:131)

        at
org.apache.axis2.transport.http.HTTPTransportUtils.processHTTPPostRequest(HT
TPTransportUtils.java:279)

        at
org.apache.axis2.transport.nhttp.ServerWorker.processPost(ServerWorker.java:
207)

        at
org.apache.axis2.transport.nhttp.ServerWorker.run(ServerWorker.java:171)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.ja
va:650)

        at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:6
75)

        at java.lang.Thread.run(Thread.java:595)

[HttpServerWorker-2] ERROR XSLTMediator - Unable to do the transformation

[HttpServerWorker-2] INFO  LogMediator - To: /soap/MySvc, WSAction:
http://developer.intuit.com/authenticate, SOAPAction:
http://developer.intuit.com/

authenticate, Envelope:

 <?xml version='1.0' encoding='utf-8'?>

<soap:Envelope

 xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"; 

 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 

 xmlns:xsd="http://www.w3.org/2001/XMLSchema";>

<soap:Body>

  <authenticate xmlns="http://developer.intuit.com/";>

<strUserName>test</strUserName>

<strPassword>test</strPassword>

  </authenticate>

</soap:Body>

</soap:Envelope>

 

 

============================================================================
==========================================================================

 

 

 

 

The xslt which I created is exactly like you mentioned in your solution.

And Config file is like mentioned below:

 

============================================================================
===========================================================================

<definitions xmlns="http://ws.apache.org/ns/synapse";>

<localEntry key="xslt-key-qb" src="file:repository/qbsync.xslt"/>

    <proxy name="WCRMERPAPISvc">

        <target>

          <inSequence>

                 <xslt key="xslt-key-qb"/>

        </inSequence>

 

            <endpoint>

                <address uri="http://localhost:8080/axis2/services/MySvc"/>

            </endpoint>

                  <outSequence>

                        <send/>

                  </outSequence>

        </target>

        <publishWSDL
uri="file:repository/conf/sample/resources/proxy/ERPAPISvc.wsdl"/>

    </proxy>

</definitions>

 

============================================================================
==========================================================================

 

Note: I avoid using source option in xslt , since I read somewhere that it
will take the first element by default if we are not using "source"
attribute in the tag. 

 

Could you please guide me with this problem?

 

Thanks,

Renjith 

 

 

 

-----Original Message-----
From: Ruwan Linton [mailto:[EMAIL PROTECTED] 
Sent: Friday, July 13, 2007 10:48 PM
To: [email protected]
Subject: Re: "Regarding Namespace Problem with an application"

 

Hi Renjith,

 

Cool, nice to here that you got it working... See the comments in line;

 

 

On 7/14/07, Renjith <[EMAIL PROTECTED]> wrote:

> 

> 

> 

> Hi Ruwan,

> 

> 

> 

> Thanks for the information.

> 

> With the information provided by you, I am able to get proxy service

> worked.

> 

> Let me repeat my original question and your proposed solution so that I

> can get some help with XSLT:

> 

> 

> 

> 

> 

> *ORIGINAL QUESTION:*

> 

> 

> 

>          "Let me explain how I developed the WebServices. I started

> 

>  developing the code from the WSDL the ERP client provides. And it is

> 

>  as shown in attached ERPAPISvc.wsdl (Namespace is

> 

>  "*http://developer.intuit.com*";). And when I deployed the service it

> 

>  worked fine with the client (Let say Client1).

> 

> 

> 

>          But we have 2 or more client program that can use the same

> 

>  service.

> 

>  But that client exists in our System in different Namespace. As

> 

>  described in MySvc.wsdl (Namespace is "*http://sync.dtc.com/*";).

> 

> 

> 

>          So when I tried to change the existing Namespace

> 

>  "http://developer.intuit.com"; to "*http://sync.dtc.com/*"; the Client1

> (build using ERPAPISvc.wsdl)

> 

>  stop working and throws unexpected subelement strUserName. And all

> 

>  other client program (build using MySvc.wsdl) starts running.

> 

> 

> 

>        So what I am trying to do is make all client works with code

> 

>  developed from same wsdl (MySvc.wsdl)  and having the namespace

> 

>  "*http://sync.dtc.com/*".";

> 

> 

> 

> 

> 

> * AND THE SOLUTION PROPOSED BY YOU WAS*:(I modified 2 values as per my

> understading)

> 

> 

> 

> <definitions xmlns="http://ws.apache.org/ns/synapse";>

> 

>     <proxy name="$NAME_OF_THE_PROXY">

> 

> 

> 

>         <target>

> 

>             <inSequence>

> 

>                 <xslt key*="$XSLT_FILE_REGISTRY_KEY*"/>

> 

>             </inSequence>

> 

>             <endpoint>

> 

>                 <address uri=" *http://localhost:8080/axis2/services/MySvc

> *"/>

> 

>             </endpoint>

> 

>             <outSequence>

> 

>                 <send/>

> 

>             </outSequence>

> 

>         </target>

> 

>         <publishWSDL uri="file:repository/*ERPAPISvc.wsdl*"/>

> 

>     </proxy>

> 

> </definitions>

> 

> 

> 

> 

> 

> In the XSLT you have to transform the NS from one to another.

> 

> 

> 

> Note : I have modified the address URI to

> http://localhost:8080/axis2/services/MySvc (It is been running in

> JBOSS-TOMCAT server where *MySvc.wsdl* is been published)

> 

> And I am supposed to keep *ERPAPI.wsdl* in publishWSDL-uri rt? Please

> correct me if I am wrong.

> 

 

You are absolutely correct.

 

 

Could you please guide me in creating the XSLT & configure the same in

> definitions file OR using WSO2 ESB.

> 

 

 

Yes sure.

 

Now you need to create a XSLT which will transform the name space from "

http://sync.dtc.com/"; to "http://developer.intuit.com"; and put that in the

repository  of synapse (will say $XSLT_FILE_REGISTRY_KEY).

 

Since you need to transform the NS of the request you could specify the

element which contains the NS declaration in the request to the XSLT

mediator using the attribute "source" as an XPATH (to do this you need to

know the exact request that is coming to synapse)

 

Now your configuration for the XSLT mediator will be something like this

 

<xslt key="$XSLT_FILE_REGISTRY_KEY" source="&XPATH_TO_THE_NS_DECLARATION" />

 

Your xslt file should looks something like the following

 

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"; version="

1.0">

<xsl:template match="*">

<xsl:text>http://developer.intuit.com</xsl:text>

</xsl:template>

</xsl:stylesheet>

 

I assume that you can get the XPATH expression to get the NS declaration,

you can refer to the followings on XSLT and XPATH.

 

[1] - http://www.w3schools.com/xpath/xpath_examples.asp

[2] - http://www.cafeconleche.org/books/xmljava/chapters/ch16.html

[3] - http://www.w3schools.com/xsl/default.asp

 

If you are having any issues with this feel free to go for any more

clarifications...

 

 

Thanks,

Ruwan** <http://sync.dtc.com/>

 

 

-- 

Ruwan Linton

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

Reply via email to