JAXM RI - How to fix 'Client Not Connected' Sever error

D

Danny M

I found that I had to explicitly instigate an InitConnection message
for each JAXMServlet (not shown in the examples that accompany the
JAXM RI). The way to to this seems to be to call
providerConnection.createMessageFactory() or
providerConnection.getMetaData().

I initially tried this in the init(config) method of my jaxmservlets
but was experiencing a deadlock with the message provider app (same
web app container), so I moved the createMessageFactory() call to the
JAXMServlet's service() method, being sure to call the super class's
service.

Here is a code snipet. Hope it helps anyone who needs it.

public class BIMServlet extends JAXMServlet implements OnewayListener
{
private ProviderConnectionFactory providerConnectionFactory;
private ProviderConnection providerConnection;
private MessageFactory mf = null;



public void service(HttpServletRequest request, HttpServletResponse
resp)
throws IOException, ServletException {
if (mf == null) {
try {
ProviderMetaData metaData = providerConnection.getMetaData();
String[] supportedProfiles = metaData.getSupportedProfiles();
String profile = null;

for (int i = 0; i < supportedProfiles.length; i++) {
if (supportedProfiles.equals("soaprp")){
profile = supportedProfiles;
break;
}
}

// Set the MessageFactory object that will be used to create the
// SOAPMessage object that will be used to internalize the
// message that's posted to the servlet.

mf = providerConnection.createMessageFactory(profile);
this.setMessageFactory(mf);


} catch (JAXMException e) {

}
}
super.service(request, resp);

}
/**
* Establishes a provider connection as wel as a ebXML SOAP message
factory for
* the servlet.
*/
public void init(ServletConfig config) throws ServletException {


super.init(config);

try {

// Establish messaging provider connection factory
providerConnectionFactory =
ProviderConnectionFactory.newInstance();

// Establish messaging provider connection
providerConnection = providerConnectionFactory.createConnection();
/*

*/

} catch (JAXMException e) {
throw new ServletException(e);
}



}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top