【问题标题】:JBoss EAP 5.1 Server not using Windows Network SettingJBoss EAP 5.1 服务器不使用 Windows 网络设置
【发布时间】:2013-10-29 06:15:22
【问题描述】:

我正在尝试从我的应用程序中调用 Web 服务。我的系统受防火墙保护,我使用代理访问任何外部 URL/互联网访问。该应用程序在 JBoss EAP 5.1 服务器上运行。应用程序无法写入服务 URL 并出现 IO 异常:“无法传输消息”。

但是,当我尝试使用 IE/Firefox 访问服务 URL 时,它正在打开。尽管我从浏览器收到的 XML 响应指出了一个通用错误 - “无效的请求参数...”,这很明显。因为我没有从浏览器发送正确的请求 XML。

我真的对这种差异感到困惑。我曾经相信 JBoss 会选择标准的 windows 网络设置,但在我的情况下它不是。

我的代码如下:

String strUrl = "http://theurlgoeshere";
String requestXml = "<request></request>";
String wsResponse="";
SOAPConnection conn = null;

try {               
MessageFactory msgFac = MessageFactory.newInstance();
MimeHeaders mh = new MimeHeaders();
mh.setHeader("Content-Type", "text/xml; charset=UTF-8");

log.info("Request Xml:" + requestXml );
InputStream is = new ByteArrayInputStream(requestXml.getBytes("UTF-8"));
SOAPMessage reqMsg = msgFac.createMessage(mh, is);

SOAPConnectionFactory conFac = SOAPConnectionFactory.newInstance();
conn = conFac.createConnection();

SOAPMessage repMsg = conn.call(reqMsg, strUrl);     
ByteArrayOutputStream out = new ByteArrayOutputStream();
repMsg.writeTo(out);            
wsResponse = new String(out.toByteArray());
}
catch (Exception e) {
e.printStackTrace();
}

【问题讨论】:

    标签: web-services networking settings jboss5.x


    【解决方案1】:

    几天前整理好了。基本上我现在使用 HttpURLConnection 在进行 Webservice 调用时在 java 代码本身中添加代理设置。刚刚结束这个问题,因为我的查询已经解决。

    如果有人需要,将更新新代码。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-05-15
      • 1970-01-01
      • 2016-08-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多