【发布时间】:2013-04-01 17:19:40
【问题描述】:
我正在开发一个托管在 JBoss 4.2.3 服务器内的 Web 服务解决方案(如下所示),并且我的连接到远程 JMS 队列的代码托管在另一台服务器上(192.168.35.25)
public static Context getInitialContext () throws JMSException,NamingException
{
Properties prop = new Properties();
prop.setProperty("java.naming.factory.initial", "org.jnp.interfaces.NamingContextFactory");
prop.setProperty("java.naming.factory.url.pkgs", "org.jboss.naming");
prop.setProperty("java.naming.provider.url", "192.168.35.20:1099");
Context context = new InitialContext(prop);
return context;
}
public String SendMessages(String msg) throws ServletException, IOException, URISyntaxException {
String body="";
try
{
Context init =ClsSat.getInitialContext();
javax.jms.Queue destination = (javax.jms.Queue) init.lookup("Queue/RemoteQueue");
ConnectionFactory connectionFactory = (ConnectionFactory) init.lookup("ConnectionFactory");
Connection connection = connectionFactory.createConnection("un","pwd");//
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
;
MessageProducer producer = session.createProducer(destination);
TextMessage message = session.createTextMessage();
message.setText(msg);
connection.start();
producer.send(message);
body = message.getText();
session.close();
connection.close();
}
catch (Exception e)
{
return(e.toString());
}
return body ;
}
但我得到一个错误... RemoteQueue 未绑定 所以任何人都有关于连接到远程队列抛出 Web 服务的想法或帮助 或有关从本地计算机上托管的 Web 服务连接到远程计算机上的远程队列的任何文档
【问题讨论】:
-
在您的示例中,您是否必须连接到下一个工作驱动器,如果是,连接字符串的外观如何。
标签: web-services