I have server-config.wsdd <globalConfiguration> .... <requestflow> <handler type="java:Handler"> </handler> </requestflow> ... </globalConfiguration>
SoapBody that comes to my Handler is like: <soapenv:Body> <ns2:method1 xmlns:ns2="Service1"> </ns2:method1> </soapenv:Body> And I change it using envelope.clearBody(); SOAPBodyElement newbody=null; newbody = new SOAPBodyElement(XMLUtils.StringToElement("Service2","method2","")); envelope.addBodyElement(newbody); after that my Soap message is: <soapenv:Body> <ns1:method2 xmlns:ns1="Service2"> </ns1:method2> </soapenv:Body> After that i get response from Service1 instead of service2 :( why? Grzesiek > Hi! > > I tried something like this about a year ago - it's tricky. I'll try to > explain what I did using your terminology. > > In my case as well, the client would invoke a method on MyService, but I > wanted the same method to be forwarded to CommonService. What I found out > quickly was that unless MyService is deployed, Axis will fail immediately > saying "No such method/service". > > My next bright idea was to do on-demand deployment. Here, when the user > first invokes MyService.method(), I would intercept the call in a handler, > check if MyService was deployed, and if it wasn't, I would generate the WSDD > for MyService and deploy it. Then, I would forward the call to the > newly-deployed MyService, which then forwarded to CommonService. > > This approach worked partially. I was able to intercept the call correctly, > detect whether or not MyService was deployed and generate the WSDD. In the > WSDD I made sure to mention that the service class was MyServiceImpl.java. I > wrote MyServiceImpl.java to have all of the methods that were there in > CommonServiceImpl.java, but the implementations didn't do much. For every > MyServiceImpl.method(), I simply forwarded the call to > CommonServiceImpl.method(), perhaps after adding a parameter or two. > > However, where I got stuck was trying to convince Axis that MyService had > been deployed. I tried many things including shoving responses into the > return, but it would fail. My understanding from this experience is that > when your client invokes MyService.method(), Axis constructs the handler > chain before actually invoking any handlers. The first time your client > invokes MyService.method(), MyService has NOT been deployed, therefore it > doesn't appear in the handler chain. At that point, no matter what you do, > the call is doomed to fail. Of course, I would proceed and deploy MyService, > but it would be useless - the call would always fail. > > However, the second call to any of MyService's methods would work because > this time around Axis was able to find MyService and insert it into the > handler chain. All subsequent calls would also succeed. As a result, we had > to explain to our clients to ignore the failure on the first method > invocation and try again. What we did was provide a dummy method in > MyService whose main job was to make the on-demand deployment happen. The > results/failures of the dummy method were ignored. > > All of this was with Axis 1.1 - things may have changed in 1.2. Also, > perhaps others have better ideas but a year ago I couldn't get much help on > this issue so I just tried whatever I thought was reasonable. > > Hope that helps! > > Anand > > On Tue, 14 Sep 2004 [EMAIL PROTECTED] wrote: > > : I want to call a WS called for example MyService but MyService isn't > : deployed in Axis (or anywhere else). Instead I want other WS to be > : called, for example CommonService (wchich is deployed of course) and a > : file MyService.txt to be passed as an argument for CommonService. I > : thought that I might write a handler to be processed in global chain that > : substitutes MyService with CommonService and adds argument (path to > : MyService.txt) but that does not change anything. What am I doing wrong? >