java - How to host a SOAP service and REST service at the same port? -


does know how configure soap service , rest service can share same port using jersey (grizzly) outside of application server?

  • my soap service @ www.someurl.com:port/soap/crm
  • my rest service @ www.someurl.com:port/crm

these services share same port not same base url , therefor should able run side side on port. however, there port bind error ..

all of in custom service application , there no web.xml or such.

the rest service using jersey , soap service class 'receptionservice' published on endpoint.

uri soapuri = uri.create("192.168.0.0:1234\soap\crm") uri resturi = uri.create("192.168.0.0:1234\crm")  // start soap service object reception = getobjectresource(receptionservice.class); endpoint e = endpoint.publish(soapuri, reception);  // start rest service     resourceconfig rc = new resourceconfig().packages("company.rest"); httpserver server = grizzlyhttpserverfactory.createhttpserver(resturi, rc); 

when try this, grizzly spits out 'java.net.bindexception: address in use: bind'

my soap service reception setup this:

    @webservice(targetnamespace = "company.crm")     @soapbinding(style = soapbinding.style.document, use = soapbinding.use.literal,      parameterstyle = soapbinding.parameterstyle.wrapped)     public class reception implements receptionservice {      ... methods     } 

my rest service classes annotated usual ...

@path("hello/{username}") public class hello { ... } 

i bit of newbie @ , pointers appreciated. , please, don't bother suggesting run application server. not problem here -- problem how around port-bind issue without moving other webservice framework?

note re bounty: cannot iterate enough

"the bounty winner demonstrate how use jersey rest , java soap service (annotated jax-ws) on same endpoint. the answer not require changes rest , soap annotated classes. however, , http server code changes or configuration changes make work acceptable. switching jetty or other application server not acceptable solution must 100% embedded , run using java se , java web service libraries."

jetty's overlay feature allows deploy 2 different webapps different paths on same jetty instance/port.

you have 1 web.xml jersey servlet (for rest) , other web.xml soap servlet.

http://www.eclipse.org/jetty/documentation/current/overlay-deployer.html


Comments