I have created a project using Tomcat Server.
1. My project has the following web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemalocation="http://java.sun.com/xml/ns/javaee
http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
<servlet>
<display-name>SimpleCXFNonSpringServlet</display-name>
<servlet-name>SimpleCXFNonSpringServlet</servlet-name>
<servlet-class>com.student.SimpleCXFNonSpringServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>SimpleCXFNonSpringServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
2. I created a class:
public class SimpleCXFNonSpringServlet extends CXFNonSpringServlet {
@Override
public void loadBus(ServletConfig servletConfig) {
super.loadBus(servletConfig);
Bus bus = getBus();
BusFactory.setDefaultBus(bus);
try {
ServerSocket sock = new ServerSocket();
InetSocketAddress s = new
InetSocketAddress(InetAddress.getLocalHost(), 0);
sock.bind(s);
int port = sock.getLocalPort();
sock.close();
String address = "http://localhost:" + port +
"/PrinterServiceV20";//
Object implementor = new PrinterServiceV20TypeImpl();
Endpoint.publish( address, implementor );
System.out.println("Publishing on " + address + " has been
finished");
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
3. When I start the service I see (using the WireShark) the WS-Discovery
*Hello * message on other hosts in my sub-net.
4. My Service never receives *Probe* messages from other services from the
subnet.
But I can see them coming into my machine using the WireShark.
If I copy the message to the txt file and send it from local machine I do
receive it. I use wsdebug_client.exe "send" command to send the probe.
Here's the example of the probe data:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2003/05/soap-envelope"
xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
xmlns:wsd="http://schemas.xmlsoap.org/ws/2005/04/discovery"
xmlns:wsdp="http://schemas.xmlsoap.org/ws/2006/02/devprof">
<soap:Header>
<wsa:To>urn:schemas-xmlsoap-org:ws:2005:04:discovery</wsa:To>
<wsa:Action>http://schemas.xmlsoap.org/ws/2005/04/discovery/Probe</wsa:Action>
<wsa:MessageID>urn:uuid:93857a8d-d83a-42a8-a8d0-177a64e4a8f5</wsa:MessageID>
</soap:Header>
<soap:Body>
<wsd:Probe>
<wsd:Types>wsdp:Device</wsd:Types>
</wsd:Probe>
</soap:Body>
</soap:Envelope>
5. Should I have any additional configuration of the server or may be cxf in
order to receive all the *Probe and Resolve* messages from the sub-net ?
6. I use apache-tomcat-7.0.57 and apache-cxf-2.7.14
--
View this message in context:
http://cxf.547215.n5.nabble.com/WS-Discovery-works-only-on-local-machine-tp5753223.html
Sent from the cxf-user mailing list archive at Nabble.com.