Problem calling a remote web service out of SLSB
markusschwarz Mar 2, 2015 10:32 AMHi guys,
in the last month I migrated my application from JBoss 4.x to JBoss Wildfly 8.1.0.FINAL. But now I have some problems calling a remote web service out of a session bean. The session bean is the client in this case.
I'm using the jaxws-maven-plugin to create the service classes and interfaces out of an existing WSDL file.
public class MyService extends javax.xml.ws.Service {
...
}
public interface MyPort {
...
}
Now I call the web service from a SLSB like this:
@Stateless
public class ServiceBean {
public void doSomething() {
MyService service = new MyService("http://remote-server/service/doSomething", new QName("AAA", "BBB"));
MyPort port = service.getPort(new QName("AAA", "CCC"), MyPort.class);
port.doSomething(...);
...
}
}
In JBoss 4.x it worked very well, but now with Wildfly, there are different problems.
The first error I saw after calling the web service was following exception:
javax.wsdl.WSDLException: WSDLException: faultCode=PARSER_ERROR: com.ctc.wstx.exc.WstxParsingException: Unexpected close tag ; expected . at [row,col,system-id]: [61,18,"http://remote-server/service/doSomething"]
org.apache.cxf.wsdl11.WSDLManagerImpl.loadDefinition(WSDLManagerImpl.java:257)
org.apache.cxf.wsdl11.WSDLManagerImpl.getDefinition(WSDLManagerImpl.java:206)
org.apache.cxf.wsdl11.WSDLServiceFactory.<init>(WSDLServiceFactory.java:98)
org.apache.cxf.jaxws.ServiceImpl.initializePorts(ServiceImpl.java:204)
org.apache.cxf.jaxws.ServiceImpl.<init>(ServiceImpl.java:149)
org.jboss.wsf.stack.cxf.client.ProviderImpl$JBossWSServiceImpl.<init>(ProviderImpl.java:563)
org.jboss.wsf.stack.cxf.client.ProviderImpl.createServiceDelegate(ProviderImpl.java:258)
javax.xml.ws.Service.<init>(Service.java:57)
test.MyService.<init>(MyService.java:42)
...
After some research I recognized that the implementation has been changed, from JAXWS RI to Apache CXF. And Apache CXF has problems with IIS web services, if chunking is not disabled.
Because I had no clue how to configure chunking in the stateless session bean, I just tried to use the previous working implementation. Therefore I added the JAXWS-RT dependency, and yeah, its working again. Now the WAR file is about 4-4 MB bigger, because it contains all the libraries of JAXWS-RT.
After some time I realized that there is another problem: The Java 8 metaspace is growing indefinitely. Directly after startup there are about 16.000 classes loaded. But I also saw about 1,5 Millionen loaded classes after many calls of the web service. And I have no idea what is going on there.
So now I'm stuck, how to solve this. I have to possibilities I think:
1. Make the web service call working with JBoss WS implementation (Apachae CXF) and disable chunking. But how can I set chunking when the first call to new MyService(...) fails.
2. Solve the memory problem when using JAXWS-RT, but how can this be done
I have no idea so far, so it would be great if someone has some hints for me.
Regards, Markus