How to make Web service use TCP transport with JAX-WS
By oleksiys on Jun 07, 2007
There are lots of places, which should be improved, however nothing could stop us using it right now :)
Several steps, especially for the server side, are similar or even same to WSIT ones, however the client side configuration is completely different.
So, "how to deploy web service to Glassfish and make it reachable via SOAP/TCP?".
- JavaEE 5 or JSR109 WS deployment.
Actually all Web services deployed to Glassfish using this deployment method become TCP transport enabled. They are automatically registered on SOAP/TCP listener and ready to process.
\*One known issue with JavaEE 5 deployment of WS is: if WS is being deployed to a Web container - then it is required for this WS to have the descriptor web.xml, where it will be specified to load on startup. In this case the SOAP/TCP listener will get to know about this web service.
- Servlet deployment.
For this deployment type, things are not much different. In this case one more servlet context listener should be added to a web service's (web appliction's) web.xml file .
And the servlet should be set to load on startup. Otherwise the SOAP/TCP listener will not be aware know about Web Service, until WSStartupServlet will not be started.
"How to make client to choose SOAP/TCP as transport to work with web service?"
We need to configure JAX-WS client to be aware of SOAP/TCP transport. For that reason, we have to provide following service provider file , located on client classpath, and contain line  in it.
Web service WSDL file, which is provided to a client, should contain Web service endpoint address (/definitions/service/port/soap:address@location) with SOAP/TCP specific protocol schema . Only in that case SOAP/TCP transport pipe will be attached and used for sending/receiving SOAP messages. Currently server side WSDL generation doesn't support protocol schema changing for SOAP/TCP, so this change should be made manually.