如何在 CXF 生成的客户端中以编程方式更改 JMS 主题?
我有 WSDL 文件,其中包含:
<wsdl:port name="NotificationConsumerSoapJms"
binding="tns_NotificationConsumer:NotificationConsumerSoapJmsBinding">
<jms:address destinationStyle="topic"
jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicTopics/test.DefaultTopic">
<jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
<jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616" />
</jms:address>
</wsdl:port>
这是由 CXF 生成的 JMS 客户端:
URL wsdlURL = EfaNbiWebService.WSDL_LOCATION;
if (args.length > 0 && args[0] != null && !"".equals(args[0])) {
File wsdlFile = new File(args[0]);
try {
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
EfaNbiWebService ss = new EfaNbiWebService(wsdlURL, SERVICE_NAME);
NotificationConsumer port = ss.getNotificationConsumerSoapJms();
{
System.out.println("Invoking notify...");
org.tmforum.mtop.fmw.xsd.hdr.v1.Header _notify_mtopHeader = null;
org.tmforum.mtop.fmw.xsd.notmsg.v1.Notify _notify_mtopBody = null;
port.notify(_notify_mtopHeader, _notify_mtopBody);
}
如您所见,主题名称存储在 WSDL 文件中。那么如何以编程方式更改主题名称呢?
I have WSDL file which contains:
<wsdl:port name="NotificationConsumerSoapJms"
binding="tns_NotificationConsumer:NotificationConsumerSoapJmsBinding">
<jms:address destinationStyle="topic"
jndiConnectionFactoryName="ConnectionFactory"
jndiDestinationName="dynamicTopics/test.DefaultTopic">
<jms:JMSNamingProperty name="java.naming.factory.initial"
value="org.apache.activemq.jndi.ActiveMQInitialContextFactory" />
<jms:JMSNamingProperty name="java.naming.provider.url"
value="tcp://localhost:61616" />
</jms:address>
</wsdl:port>
And here is JMS client which was generated by CXF:
URL wsdlURL = EfaNbiWebService.WSDL_LOCATION;
if (args.length > 0 && args[0] != null && !"".equals(args[0])) {
File wsdlFile = new File(args[0]);
try {
if (wsdlFile.exists()) {
wsdlURL = wsdlFile.toURI().toURL();
} else {
wsdlURL = new URL(args[0]);
}
} catch (MalformedURLException e) {
e.printStackTrace();
}
}
EfaNbiWebService ss = new EfaNbiWebService(wsdlURL, SERVICE_NAME);
NotificationConsumer port = ss.getNotificationConsumerSoapJms();
{
System.out.println("Invoking notify...");
org.tmforum.mtop.fmw.xsd.hdr.v1.Header _notify_mtopHeader = null;
org.tmforum.mtop.fmw.xsd.notmsg.v1.Notify _notify_mtopBody = null;
port.notify(_notify_mtopHeader, _notify_mtopBody);
}
As you see, the topic name is store in WSDL file. So how to change topic name programmatically?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了解决方案:
祝大家有美好的一天:)
I found the solution:
Have a nice day, guys :)