Forgot to mention that I am using Xfire version 1.2.5.
[EMAIL PROTECTED] 15.03.2007 13:17 Please respond to [email protected] To [email protected] cc Subject [xfire-user] web-service using Xfire+JSR181+WS-Addressing Reviewed by Category Hello, I would like to publish a web-service using XFire+JSR181 Annotations+WS-Addressing. After spending several hours without much success, knocking at the door of this list may be in order. I am configuring XFire programmatically using my own servlet as shown below. By the way, I can get the service working without WS-Addressing just fine. Without further ado, here is my servlet. // ---------------------------------------------------------- package ch.qos.arte; import javax.servlet.ServletException; import javax.xml.namespace.QName; import org.codehaus.xfire.DefaultXFire; import org.codehaus.xfire.XFire; import org.codehaus.xfire.XFireFactory; import org.codehaus.xfire.addressing.AddressingInHandler; import org.codehaus.xfire.addressing.AddressingOutHandler; import org.codehaus.xfire.annotations.AnnotationServiceFactory; import org.codehaus.xfire.server.http.XFireHttpServer; import org.codehaus.xfire.service.Service; import org.codehaus.xfire.transport.http.XFireServlet; import org.slf4j.Logger; import org.slf4j.LoggerFactory; public class MyXfireServlet extends XFireServlet { private static final long serialVersionUID = 14536657L; Logger logger = LoggerFactory.getLogger(MyXfireServlet.class); public XFire createXFire() throws ServletException { logger.debug("createXFire() called"); try { XFire xfire = (XFire) getServletContext().getAttribute(XFIRE_INSTANCE); if (xfire == null) { XFireFactory factory = XFireFactory.newInstance(); xfire = factory.getXFire(); ((DefaultXFire) xfire).addInHandler(new AddressingInHandler()); ((DefaultXFire) xfire).addOutHandler(new AddressingOutHandler()); Service echoService = registerServiceAnnotation(xfire, new EchoServiceImpl(), new QName("http://www.qos.ch/arte", "EchoService")); xfire.getServiceRegistry().register(echoService); getServletContext().setAttribute(XFIRE_INSTANCE, xfire); } return xfire; } catch (Exception e) { logger.error("Couldn't start XFire", e); throw new ServletException("Couldn't start XFire.", e); } } Service registerServiceAnnotation(XFire xfire, Object serviceImpl, QName qname) { AnnotationServiceFactory factory = new AnnotationServiceFactory(xfire.getTransportManager()); Service service = factory.create(serviceImpl.getClass()); service.setName(qname); return service; } } Here is the interface I wish to expose: // ---------------------------------------------------------- package ch.qos.arte; import javax.jws.WebMethod; import javax.jws.WebResult; import javax.jws.WebService; @WebService(name = "EchoService", targetNamespace = " http://www.qos.ch/arte") public interface EchoService { @WebMethod(operationName = "doEcho", action = "urn:doEcho") @WebResult(name = "echoResult") public String doEcho(String in); } // ---------------------------------------------------------- The implementation: // ---------------------------------------------------------- package ch.qos.arte.xfire; import javax.jws.WebService; @WebService(endpointInterface = "ch.qos.arte.EchoService", serviceName="EchoService") public class EchoServiceImpl implements EchoService { public EchoServiceImpl() { } public String doEcho(String in) { return "You said: "+ in; } } // --------------------------------------------------------------------------- Using soapUI, I forward the following SOAP request: // -------------------------------------------------------------------------- <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:a="http://www.w3.org/2005/08/addressing"> <s:Header> <a:Action s:mustUnderstand="1">urn:doEcho</a:Action> <a:To>http://www.qos.ch/arte/EchoService</a:To> <a:MessageID>urn:uuid:c87f9f62-79bb-4f93-bfd8-aaac26856cbf</a:MessageID> </s:Header> <s:Body> <doEcho xmlns="http://www.qos.ch/arte"> <inputStr>sd</inputStr> </doEcho> </s:Body> </s:Envelope> // ------------------------------------------------------------------------ Here is the response: // ------------------------------------------------------------------------ <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <soap:Body> <soap:Fault> <faultcode>soap:Client</faultcode> <faultstring>Action 'urn:doEcho' was not found for service http://www.qos.ch/arte/EchoService</faultstring> </soap:Fault> </soap:Body> </soap:Envelope> // ------------------------------------------------------------------------ Going through the code with a debugger, I can see that on line 89 in the invoke method(MessageContext) method of o.c.xfire.addressing.AddressingInHandler class (see below), the context.getExchange().getOperation() returns null. 88: // Dispatch the Exchange and operation 89: OperationInfo op = context.getExchange().getOperation(); 90: AddressingOperationInfo aop = AddressingOperationInfo.getOperationByInAction(service.getServiceInfo(), headers Any suggestions to put me on the right track? Many thanks in advance, ************************ DISCLAIMER ************************ This message is intended only for use by the person to whom it is addressed. It may contain information that is privileged and confidential. Its content does not constitute a formal commitment by Lombard Odier Darier Hentsch Group and any of its affiliates. If you are not the intended recipient of this message, kindly notify the sender immediately and destroy this message. Thank You. ***************************************************************** ************************ DISCLAIMER ************************ This message is intended only for use by the person to whom it is addressed. It may contain information that is privileged and confidential. Its content does not constitute a formal commitment by Lombard Odier Darier Hentsch Group and any of its affiliates. If you are not the intended recipient of this message, kindly notify the sender immediately and destroy this message. Thank You. *****************************************************************
