JBoss AS 7.1.1.Final with JBossWS-CXF 4.1.1.Final , changing the endpoint address
bige Jan 18, 2013 3:09 AMHi,
I`ve tried to create a Webservice (as a Stateless Session Bean) similar as described under: https://docs.jboss.org/author/display/AS71/JAX-WS+Tools (Echo Example).
If I call the Webservice under localhost (no changing of endpoint address) it works. But if I try to change the endpoint address (Client-side) in this way:
SchedulerService service = new SchedulerService();
Scheduler scheduler = service.getSchedulerPort();
String endpointURL = "http://NEW_ENDPOINT_URL";
BindingProvider bindingProvider = (BindingProvider) scheduler;
bindingProvider.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointURL);
scheduler.testWebService();
------------------------------------
I get a Socket Exception:
............
Caused by: java.net.SocketException: SocketException invoking http://192.168.10.103:8080/m_evok-ejb/SchedulerService/Scheduler: Connection reset
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:525)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.mapException(HTTPConduit.java:1467)
at org.apache.cxf.transport.http.HTTPConduit$WrappedOutputStream.close(HTTPConduit.java:1452)
at org.apache.cxf.transport.AbstractConduit.close(AbstractConduit.java:56)
at org.apache.cxf.transport.http.HTTPConduit.close(HTTPConduit.java:659)
at org.apache.cxf.interceptor.MessageSenderInterceptor$MessageSenderEndingInterceptor.handleMessage(MessageSenderInterceptor.java:62)
at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:262)
at org.apache.cxf.endpoint.ClientImpl.doInvoke(ClientImpl.java:530)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:463)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:366)
at org.apache.cxf.endpoint.ClientImpl.invoke(ClientImpl.java:319)
at org.apache.cxf.frontend.ClientProxy.invokeSync(ClientProxy.java:96)
at org.apache.cxf.jaxws.JaxWsClientProxy.invoke(JaxWsClientProxy.java:134)
.......
Is there something missing/wrong in the JBoss (7.1.1.Final) standalone.xml subsystem, maybe? It looks like:
<subsystem xmlns="urn:jboss:domain:webservices:1.1">
<modify-wsdl-address>true</modify-wsdl-address>
<wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
<endpoint-config name="Standard-Endpoint-Config"/>
<endpoint-config name="Recording-Endpoint-Config">
<pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
<handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
</pre-handler-chain>
</endpoint-config>
</subsystem>
The JBoss AS is running under Windows 7. No Firewall for Testing Phase is activated.
--------------------------------------------------------
My Classes/Interface :
Scheduler Interface:
-----------------------------
@WebService
public interface Scheduler {
@Oneway
public void testWebService();
}
SchedulerImpl Class:
--------------------------------
@Stateless
@WebService(name = "Scheduler", serviceName = "SchedulerService", targetNamespace = "http://services.batch.mytest.test.com/",
endpointInterface = "com.test.mytest.batch.services.Scheduler")
public class SchedulerImpl implements Scheduler, TimedObject {
private static final Logger LOGGER = LoggerFactory.getLogger(SchedulerImpl.class);
@Resource
private TimerService timerService;
@Override
public void testWebService() {
LOGGER.info("Webservice method: testWebService");
}
}
SchedulerService class:
-----------------------------------
@WebServiceClient(name = "SchedulerService", targetNamespace = "http://services.batch.mytest.test.com/",
wsdlLocation = "http://localhost:8080/m_evok-ejb/SchedulerService/Scheduler?wsdl")
public class SchedulerService extends Service {
private final static URL SCHEDULERSERVICE_WSDL_LOCATION;
static {
URL url = null;
try {
url = new URL("http://localhost:8080/m_evok-ejb/SchedulerService/Scheduler?wsdl");
} catch (MalformedURLException e) {
e.printStackTrace();
}
SCHEDULERSERVICE_WSDL_LOCATION = url;
}
public SchedulerService(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public SchedulerService() {
super(SCHEDULERSERVICE_WSDL_LOCATION, new QName("http://services.batch.mytest.test.com/", "SchedulerService"));
}
@WebEndpoint(name = "SchedulerPort")
public Scheduler getSchedulerPort() {
return (Scheduler) super.getPort(new QName("http://services.batch.mytest.test.com/", "SchedulerPort"), Scheduler.class);
}
}
Note:
I didn`t use any generated tool (wsprovide,wsconsume) . The wsdl contract should the one which is automatically created by JBoss on application deployment time.
---------------------------------------------------------
Any help is highly appreciated!
Thanks in advance!
.