Web 服务返回类型为复杂
我返回了一个 Web 服务,它从数据挖掘 API 返回“实例”。现在的问题很明显,默认情况下 Web 服务无法处理“实例”作为返回类型。我的方法应该是什么。
或者
我可能不得不说用户定义的数据类型,请指导我可以实现此目的的任何文档。
////////////////////////////////////////////////////////
public Instances fetch(){
Properties properties =
Utils.readProperties("weka/experiment/DatabaseUtils.props");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url = "jdbc:oracle:thin:@localhost:1521:XE";
java.util.Properties props = new java.util.Properties();
props.setProperty("user", "system");
props.setProperty("password", "root")
DriverManager.registerDriver(new OracleDriver());
Connection conn = DriverManager.getConnection(url, props);
Statement stmt = conn.createStatement();
ResultSet rset1 = stmt.executeQuery("SELECT * FROM iris"");
return retrieveInstances(rset1);
}
////////////////////////////////////////////////////////
提前致谢 SR
I have return a web services which return "Instances" from a datamining api. Now the problem is obvious web services by default cannot handle "Instances" as return type. What should be my approach.
Or
I may have to say User defined data types, please guide me of any documentation where I can implement this.
////////////////////////////////////////////////////////
public Instances fetch(){
Properties properties =
Utils.readProperties("weka/experiment/DatabaseUtils.props");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
String url = "jdbc:oracle:thin:@localhost:1521:XE";
java.util.Properties props = new java.util.Properties();
props.setProperty("user", "system");
props.setProperty("password", "root")
DriverManager.registerDriver(new OracleDriver());
Connection conn = DriverManager.getConnection(url, props);
Statement stmt = conn.createStatement();
ResultSet rset1 = stmt.executeQuery("SELECT * FROM iris"");
return retrieveInstances(rset1);
}
////////////////////////////////////////////////////////
thanks in advance
SR
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
嗯,我认为你应该关注数据,而不是实例。尝试序列化为 XML 或使用 JSON 来传递数据。
此外,该网站上发布了很多答案:
https://stackoverflow.com/search?q= web+service+complex+data
希望有帮助,
Well, I think you should focus on data, rather than Instances. Try to serialize to XML or use JSON to pass data across.
Moreover, there are plenty of answers posted on this site:
https://stackoverflow.com/search?q=web+service+complex+data
Hope that helps,