When using the servlet transport, I don't think you do:
Endpoint.publish("http://" + java.net.InetAddress.getLocalHost().getHostName()
+ "/myServlet/myServletWS", new iServiceWebServiceImpl())
I think you just use the tailing part:
Endpoint.publish("/myServletWS");
as the servlet transport completely controls the rest of the URL.
Dan
On Tuesday 09 September 2008 6:43:25 am Rahul Dev wrote:
> Hi,
>
> I am trying to load CXF inside my servlet. Here is what I am trying to do.
>
> Am I doing anything wrong? Kindly advice.
> Rahul
>
>
> @WebService
> public interface iService {
>
> public MyStruct execute(MyStruct _MyStructObj) throws
> java.lang.Exception;
>
> }
>
> //No Annotations here...
> public class iServiceWebServiceImpl implements iService {
>
> public iServiceWebServiceImpl() {
> }
>
> @Resource
> private WebServiceContext wsContext;
>
> public MyStruct execute(MyStruct _MyStructObj) throws
> java.lang.Exception { return new MyStruct();
> }
> }
>
>
>
> public class MainServlet extends
> org.apache.cxf.transport.servlet.CXFNonSpringServlet {
>
> .............
>
> @Override
> public void loadBus(ServletConfig servletConfig) throws
> ServletException { super.loadBus(servletConfig);
> Bus bus = getBus();
> BusFactory.setDefaultBus(bus);
>
> }
>
>
> public void init(ServletConfig _ServletConfigObj) throws
> ServletException try {
> Class[] Classes = new Class[] { Class1.class, Class2.class};
>
> if (true) {
> Endpoint ep = Endpoint.publish("http://" +
> java.net.InetAddress.getLocalHost().getHostName() +
> "/myServlet/myServletWS", new iServiceWebServiceImpl()); HashMap props =
> new HashMap();
> props.put("jaxb.additionalContextClasses", Classes);
> props.put("mtom-enabled", Boolean.TRUE);
> ep.setProperties(props);
> } else {
> Endpoint ep = Endpoint.create(new
> iServiceWebServiceImpl()); HashMap props = new HashMap();
> props.put("jaxb.additionalContextClasses", Classes);
> props.put("mtom-enabled", Boolean.TRUE);
> ep.setProperties(props);
> ep.publish("http://" +
> java.net.InetAddress.getLocalHost().getHostName() +
> "/myServlet/myServletWS"); }
> } catch (Exception ex) {
> log.fatal("CXF failed", ex);
> throw new Exception(ex);
> }
>
> }
>
> .............
> }
--
Daniel Kulp
[EMAIL PROTECTED]
http://www.dankulp.com/blog