我有一个外部Web服务,它可以通过https工作,我可以使用wsimport生成java类但是当我调用该服务时,我会收到以下异常:
Exception in thread "main" com.sun.xml.internal.ws.client.ClientTransportException: HTTP transport error: java.net.UnknownHostException: ECM01
at com.sun.xml.internal.ws.transport.http.client.HttpClientTransport.getOutput(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(Unknown Source)
at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(Unknown Source)...
Caused by: java.net.UnknownHostException: ECM01
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.SocksSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
Run Code Online (Sandbox Code Playgroud)
我调用服务的类是这样的:
public static void main(String[] args) {
ColleagueServiceService cs = new ColleagueServiceService();
ColleagueService service = cs.getColleagueServicePort();
try {
service.getColleagues("user", "password", 1);
} catch (Exception_Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
我尝试使用SoapUI来调用webservice,但它显示了另一个异常:
Tue Dec 18 09:40:06 BRST 2012:ERROR:org.apache.http.conn.HttpHostConnectException: …Run Code Online (Sandbox Code Playgroud) 我有一个Apache2 HTTP Server,这个服务器可用于外部网络.对于我的网络服务,我在内部网络中有一个Jboss 4.我在Apache上使用DMZ配置了VirtualHosts,因此我可以通过以下方式访问来自外部主机的服务http://externalserver/services/SomeService?wsdl,当使用/ services/*进行请求时,我将请求重定向到http://internalserver/services/SomeService?wsdlProxyPass.
这在Intranet上工作,但是当我尝试从外部主机使用我的web服务时,我的wsdl引用内部主机.我有这样的事情:
<service name="SomeServiceService">
<port binding="tns:SomeServiceBinding" name="SomeServicePort">
<soap:address location="http://internalserver/services/SomeService"/>
</port>
</service>
Run Code Online (Sandbox Code Playgroud)
我需要在生成的wsdl中更改location属性,我该怎么办?
提前致谢.
编辑:
我可以更改主机和端口我编辑了jboss-beans.xml,现在我有这样的事情:
<property name="webServiceHost">${jboss.bind.address}</property>
<property name="modifySOAPAddress">true</property>
<property name="webServiceSecurePort">8443</property>
<property name="webServicePort">8080</property>
Run Code Online (Sandbox Code Playgroud)
但是这不会改变协议,我可以调用http://myapp/Service?wsdl或者https://myapp/Service?wsdl在两个地址中都是http,我需要将其更改为https.
我使用带有续集的nodejs v4,我有一个这样的模型:
var Device = sequelize.define('Device', {
id: {
type: DataTypes.BIGINT,
primaryKey: true,
autoIncrement: true
},
tenantId: {
type: DataTypes.BIGINT,
allowNull: false
},
token: {
type: DataTypes.STRING,
allowNull: false
}
}, {
tableName: 'devices'
});
Run Code Online (Sandbox Code Playgroud)
当我通过id选择设备时,id的类型是字符串,例如:
Device.findById(9).then( function(result) {
console.log(result.toJSON().id + 10);
});
Run Code Online (Sandbox Code Playgroud)
输出将是910,而不是19,所以我看一下json并看到了这样的内容:
{
id: "9"
tenantId: "123"
token: "adsadsdsa"
}
Run Code Online (Sandbox Code Playgroud)
找到的设备中的id是一个字符串,但我将其定义为数字...
难道不应该是{“ id”:9}吗?
如何选择具有我之前定义的类型的设备?
我有一个拥有java.sql.Connection的超类.有很多子类使用连接来执行选择.
我需要拦截通过连接执行的所有语句,并记录执行的SQL.
我该怎么做?
在开发Java EE应用程序时,可以使用EJB作为控制器吗?
EJB容器提供诸如生命周期管理和并发控制之类的功能,是否正确创建无状态EJB作为控制器并将其注入ManagedBean?