Quantcast
Channel: Apache Timeline
Viewing all articles
Browse latest Browse all 5648

CXF client throws exception or stuck inside probe() function

$
0
0
Hi,
I'm trying to implement WS-PRINT
<http://msdn.microsoft.com/en-us/library/windows/hardware/jj659908%28v=vs.85%29.aspx>

Unfortunately even the simple examples do not work in my environment. For
example, I created ws-discovery service and client using the CXF
WS-Discovery Client
<http://www.javatips.net/blog/2014/06/cxf-ws-discovery-client> and CXF
WS_Discovery Service
<http://www.javatips.net/blog/2014/06/cxf-ws-discovery-example>
1. Service Started as expected and the following out put has been printed:
Publishing on http://localhost:58882/PrinterServiceV20
Jan 14, 2015 9:31:29 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service {http://student.com/}ChangeStudentDetailsImplService
from class com.student.ChangeStudentDetails
Jan 14, 2015 9:31:30 AM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be
http://localhost:58882/PrinterServiceV20
Jan 14, 2015 9:31:30 AM org.eclipse.jetty.server.Server doStart
INFO: jetty-8.1.15.v20140411
Jan 14, 2015 9:31:30 AM org.eclipse.jetty.server.AbstractConnector doStart
INFO: Started SelectChannelConnector [ at ] localhost:58882
Jan 14, 2015 9:31:31 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromWSDL
INFO: Creating Service
{http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}Discovery from WSDL:
classpath:/org/apache/cxf/ws/discovery/wsdl/wsdd-discovery-1.1-wsdl-os.wsdl
Jan 14, 2015 9:31:31 AM org.apache.cxf.endpoint.ServerImpl initDestination
INFO: Setting the server's publish address to be
soap.udp://239.255.255.250:3702
Jan 14, 2015 9:31:31 AM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service
{http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}DiscoveryProxy from
class org.apache.cxf.jaxws.support.DummyImpl

I can see the wsdl using:
http://localhost:58882/PrinterServiceV20?wsdl link.
2. I use client to discover the service:
//Use WS-Discovery to find references to services that implement the
changeName portType
WSDiscoveryClient client = new WSDiscoveryClient();
// Setting timeout for WS-Discovery
client.setDefaultProbeTimeout(1000);
// Use WS-discovery 1.0
//client.setVersion10();
System.out.println("Probe:" + client.getAddress());
List<EndpointReference> references = client.probe();
client.close();
System.out.println("The probe has been finished");

ChangeStudentDetailsImplService service = new
ChangeStudentDetailsImplService();
Student student = new Student();
student.setName("Rockey");
// loop through all of them and have them invoke changeName
method.
for (EndpointReference ref : references) {
ChangeStudentDetails details = service.getPort(ref,
ChangeStudentDetails.class);
Student changeName = details.changeName(student);
" + changeName.getName());

here's the exception I got:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/C:/apache-cxf-2.7.14/lib/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/C:/Users/afrosa/workspace/WSDiscoveryClient02/lib/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
Probe:soap.udp://239.255.255.250:3702
Jan 14, 2015 1:10:15 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service
{http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}DiscoveryProxy from
class org.apache.cxf.jaxws.support.DummyImpl
Jan 14, 2015 1:10:16 PM org.apache.cxf.phase.PhaseInterceptorChain
doDefaultLogging
WARNING: Interceptor for
{http://docs.oasis-open.org/ws-dd/ns/discovery/2009/01}DiscoveryProxy#{http://cxf.apache.org/jaxws/dispatch}Invoke
has thrown exception, unwinding now
org.apache.cxf.interceptor.Fault: Could not send Message.
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:64)
at
org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:572)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:474)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:452)
at org.apache.cxf.endpoint.ClientImpl.invokeWrapped(ClientImpl.java:445)
at org.apache.cxf.jaxws.DispatchImpl.invokeAsync(DispatchImpl.java:451)
at
org.apache.cxf.ws.discovery.WSDiscoveryClient.probe(WSDiscoveryClient.java:379)
at
org.apache.cxf.ws.discovery.WSDiscoveryClient.probe(WSDiscoveryClient.java:328)
at
org.apache.cxf.ws.discovery.WSDiscoveryClient.probe(WSDiscoveryClient.java:321)
at com.discovery.client.WSDiscovery_Client.main(WSDiscovery_Client.java:23)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.TwoStacksPlainDatagramSocketImpl.receive0(Native Method)
at
java.net.TwoStacksPlainDatagramSocketImpl.receive(TwoStacksPlainDatagramSocketImpl.java:90)
at java.net.DatagramSocket.receive(DatagramSocket.java:786)
at
org.apache.cxf.transport.udp.UDPConduit$UDPBroadcastOutputStream.close(UDPConduit.java:308)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.udp.UDPConduit.close(UDPConduit.java:137)
at
org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
... 10 more

3. I added to the client the following instruction:
client.setVersion10();
The client got stuck forever with the following output:
SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in
[jar:file:/C:/apache-cxf-2.7.14/lib/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in
[jar:file:/C:/Users/afrosa/workspace/WSDiscoveryClient02/lib/slf4j-jdk14-1.7.7.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an
explanation.
SLF4J: Actual binding is of type [org.slf4j.impl.JDK14LoggerFactory]
Probe:soap.udp://239.255.255.250:3702
Jan 14, 2015 1:11:46 PM
org.apache.cxf.service.factory.ReflectionServiceFactoryBean
buildServiceFromClass
INFO: Creating Service
{http://schemas.xmlsoap.org/ws/2005/04/discovery}DiscoveryProxy from class
org.apache.cxf.jaxws.support.DummyImpl

it just got into client.probe() command and never returned back.

4. I tried to use the WireShark and all I can see that my client sent the
Probe and got back answers from many devices except the local host one. I
would expect to see the local host as well because I have the discoverable
service running there - see part 1.

4.1. In all cases I can see (using Wire Shark) the PROBE going out from my
IP address to 239.255.255.250:3702 and getting ProbeMatch from different
other services, except my own.

Can you please help me
1. why I got an exception if I do not use client.setVersion10() and stuck
inside the probe() if I do use it in client.
2. it seems that the server is running (I can call ?wsdl) , but is not using
WS-Discovery at all, it's like it's only web server not the WS Service.

I use the following :
apache-cxf-2.7.14
apache-tomcat-7.0.57
eclipse Kepler SR2

Thank you for your help
AlexA

Viewing all articles
Browse latest Browse all 5648

Trending Articles