i've got an application (my server) that launches its own jetty server for 
sending files to external nodes. they currently talk to each other using 
simple xml passed in as a post request and in the response. the external 
nodes don't run a web server of any kind.

i now need to add a soap interface on my server but can't figure out how. this 
is how my jetty server is started:

ServletHolder servlet;
org.mortbay.jetty.Server jettyServer = 
        new org.mortbay.jetty.Server(PORT);
Context root = new Context(jettyServer, "/", Context.SESSIONS);
....
servlet = new ServletHolder(someServlet);
root.addServlet(servlet, "/*");
....
CXFServlet cxf = new CXFServlet();
servlet = new ServletHolder(cxf);
servlet.setName("soap");
servlet.setForcedPath("soap");
root.addServlet(servlet, "/soap/*");
HelloWorld hw = new HelloWorldImpl();
Endpoint.publish("/soap/HelloWorld", hw);
jettyServer.start();

----------------------------
package a.b.c;
import javax.jws.WebService;
@WebService
public interface HelloWorld {
        String sayHi(String text);
}
----------------------------
import javax.jws.WebService;
@WebService(endpointInterface = "a.b.c.HelloWorld")
public class HelloWorldImpl implements HelloWorld {
        public String sayHi(String text) {
                return "The interesting question becomes is what is soap?";
        }
}
----------------------------

i got errors ranging from a null pointer exception when i went to 
http://localhost:PORT/soap/ to "/soap/HelloWorld" not being a valid url (in 
the line Endpoint.publish). i had to set a full url there, when i 
used "http://localhost:PORT/soap/HelloWorld"; it told me that the port was 
being used, so i figured its launching its own internal instance of jetty (or 
whatever it uses). i then replaced the port to some 8087 and it almost works, 
but i get a "<faultstring>No such operation: </faultstring>" message when 
viewing http://localhost:8087/soap/HelloWorld

i would really like to be able to use the same jetty server, and be able to 
give access to my existing objects in my application. i'm using spring to 
load up an object that has all of my configuration settings but not in the 
same way you would in a typical web app that runs on a webserver. the 
customer currently has access to that spring config file and it would be 
wrong to give them access (or force them to configure) the soap services.

in other words, my app is launched this way:
public static void main(...) {
  Resource resource = new FileSystemResource(config);
  BeanFactory factory = new XmlBeanFactory(resource);
  Config config = (Config)factory.getBean(bean);
  configApp(config);
  startServices();
}


Actual error messages:
(using /soap/... in publish line)
Caused by: java.net.MalformedURLException: no protocol: /soap/HelloWorld
        at java.net.URL.<init>(URL.java:567)
        at java.net.URL.<init>(URL.java:464)
        at java.net.URL.<init>(URL.java:413)
        at 
org.apache.cxf.transport.http_jetty.JettyHTTPDestination.<init>(JettyHTTPDestination.java:87)
        at 
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.createDestination(JettyHTTPTransportFactory.java:96)
        at 
org.apache.cxf.transport.http_jetty.JettyHTTPTransportFactory.getDestination(JettyHTTPTransportFactory.java:83)
        at 
org.apache.cxf.binding.soap.SoapTransportFactory.getDestination(SoapTransportFactory.java:74)
        at 
org.apache.cxf.endpoint.ServerImpl.initDestination(ServerImpl.java:90)
        at org.apache.cxf.endpoint.ServerImpl.<init>(ServerImpl.java:69)
        at 
org.apache.cxf.frontend.ServerFactoryBean.create(ServerFactoryBean.java:108)
        ... 8 more

(using http://...:PORT/ in publish line)
Exception in thread "main" java.net.BindException: Address already in use
        at java.net.PlainSocketImpl.socketBind(Native Method)
        at java.net.PlainSocketImpl.bind(PlainSocketImpl.java:359)

**********************************************************************

This email, its content and any attachments is PRIVATE AND 
CONFIDENTIAL to TANDBERG Television, Part of the Ericsson Group. 
If received in error please notify the sender and destroy the original 
message and attachments.

www.tandbergtv.com
**********************************************************************

Reply via email to