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);
}
}
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);
}
}