Spring-WS:如何在不启动Web服务的情况下生成WSDL?(Spring-WS: How generate the WSDL without having to start the web service?)
我们使用Spring-WS作为实现Web服务的基础(使用框架生成的WSDL)。 除了WAR文件之外,我们的构建还生成客户端JAR(供我们的Java客户端使用,我们自己的端到端功能测试),包括模式生成的DTO和Web服务方法的存根。 这些是使用wsimport(JAX-WS)生成的。 问题是这会产生一个多步骤的构建过程:
- 构建服务器WAR文件;
- 启动Tomcat(使WSDL可用);
- 生成客户端存根(在WSDL URL上指向wsimport)。
有没有办法生成WSDL而无需启动Web服务? 然后我们可以在一个步骤中构建所有内容。
We use Spring-WS as the basis for implementing a web service (with the WSDL generated by the framework). As well as a WAR file our build produces a client side JAR (for use by our Java clients and our own end-to-end functional tests) consisting of schema generated DTOs and stubs for the web service methods. These are generated using wsimport (JAX-WS). Problem is this gives rise to a multi-step build process:
- Build the server WAR file;
- Start Tomcat (to make the WSDL available);
- Generate the client side stubs (pointing wsimport at the WSDL url).
Is there some way to generate the WSDL without having to start the web service? Then we could build everything in a single step.
原文:https://stackoverflow.com/questions/3870995
最满意答案
// your script probably can't go on without this file? require 'config.php'; // I prefer to always pass the connection resource to mysql_query/mysql_real_escape_string // assume $mysql = mysql_connect.... $result = mysql_query("SELECT Count(*) AS rows FROM quotes", $mysql) or die(mysql_error()); // there's only one row with only one column, so mysql_result() is fine $rowcount = mysql_result($result, 0, 0); $rand = rand(0,$rowcount-1); $result = mysql_query("SELECT cQuotes FROM quotes LIMIT $rand, 1", $mysql) or die ('Error: '.mysql_error()); // there's either one or zero records. Again, no need for a while loop $row = mysql_fetch_array($result, MYSQL_ASSOC); if ( !$row ) { echo "Empty"; } else{ // do you have to treat $row['cQuotes'] with htmlspecialchars()? echo '<p>', $row['cQuotes'], '</p>'; }
// your script probably can't go on without this file? require 'config.php'; // I prefer to always pass the connection resource to mysql_query/mysql_real_escape_string // assume $mysql = mysql_connect.... $result = mysql_query("SELECT Count(*) AS rows FROM quotes", $mysql) or die(mysql_error()); // there's only one row with only one column, so mysql_result() is fine $rowcount = mysql_result($result, 0, 0); $rand = rand(0,$rowcount-1); $result = mysql_query("SELECT cQuotes FROM quotes LIMIT $rand, 1", $mysql) or die ('Error: '.mysql_error()); // there's either one or zero records. Again, no need for a while loop $row = mysql_fetch_array($result, MYSQL_ASSOC); if ( !$row ) { echo "Empty"; } else{ // do you have to treat $row['cQuotes'] with htmlspecialchars()? echo '<p>', $row['cQuotes'], '</p>'; }
相关问答
更多-
有什么数据库专业书籍介绍?[2022-05-19]
mysql -
使用PHP获取MySQL错误代码(Get MySQL error code with PHP)[2022-10-16]
PDOException对象有一个属性errorInfo ,它是一个三元素数组,与PDO::errorInfo() 。 MySQL错误代码是元素1。 try { . . . } catch (PDOException $e) $errorInfo = $e->errorInfo; error_log "MySQL error " . $errorInfo[1] . "\n"; } PS:请注意,只是回应错误是不正确的异常处理,我只是这样做,以显示如何访问信息。 A PDOExcep ... -
在mysql / php中插入错误(Insert error in mysql/php)[2022-08-22]
你错过了VALUES (子句)的结束。通常,在将它传递给mysql_query之前,更容易将SQL分配给变量(可以输出这样的调试用途)。 You're missing the closing ) from the VALUES ( clause. In general, it's easier to assign your SQL to a variable (which you can output for debugging purposes like this) prior to passing it ... -
$ connection变量在default_func不可见。 如果你想要它,只需将其声明为全局: function default_func() { global $connection; ... } 但是,当代码稍微复杂时,全局变量可能会导致难以诊断的错误。 隐藏的全局状态(如果你将第二个参数完全从mysql_query ,那就是你正在使用的状态)甚至更糟。 你最好将连接传递给函数: switch ($var) { case 'dosomething': break ...
-
php中的mysql错误(mysql error in php)[2023-02-15]
// your script probably can't go on without this file? require 'config.php'; // I prefer to always pass the connection resource to mysql_query/mysql_real_escape_string // assume $mysql = mysql_connect.... $result = mysql_query("SELECT Count(*) AS rows FRO ... -
PHP MySQL错误(Error in PHP MySQL)[2023-11-01]
FROM是MySQL中的保留字(通常是SQL)。 如果你真的有一个名为FROM的列,你应该用` (反引号)包装它,这样解析器就知道你的意思是一个名字: INSERT INTO WIRET (`FROM`, TO, ID, CURRENCY1, ... FROM is a reserved word in MySQL (and SQL in general). If you really have a column named FROM you should wrap it with ` (backtick ... -
更改$mysql_hostname = "localhost:8081"; to $mysql_hostname = "localhost"; mysql使用3306作为默认端口。 或$mysql_hostname = "localhost:3306"; 或者你的mysql列表的其他端口 change $mysql_hostname = "localhost:8081"; to $mysql_hostname = "localhost"; mysql use 3306 as default port. or ...
-
PHP中的Mysql密码错误(Mysql password Error in PHP)[2021-10-21]
它给出了这个错误,因为您的MySQL服务器使用旧的存储密码方式 - 而不是新方法,这更安全。 使用PHP 5.3引入的mysqlnd驱动程序不支持旧的身份验证方式。 因此,您必须修改MySQL配置,以使用新的,更安全的方式。 您收到的错误消息指示您如何执行此操作。 It gives this error because your MySQL server uses the old way of storing password -- and not the new way, which is more se ... -
看你phpinfo() 。 很可能mysql扩展不存在。 当你在它的时候,你可以放弃古老的mysql_*方式做事,并学习如何使用PDO和预备语句。 它是数据库连接和交互的抽象API。 Look at you phpinfo(). Most likely mysql extensions is not there. And while you are at it, you could just drop the ancient mysql_* way ow doing thing and learn how ...
-
PHP mySQL错误(PHP mySQL Error)[2021-09-08]
这是我在PHP中进行数据库访问的方式: $result=mysql_query($sql) or die ("bad sql query: ".mysql_error()); 所以如果SQL错了; 我得到一个可用的错误,通常是有罪的SQL片段 this is how i do my DB access in PHP: $result=mysql_query($sql) or die ("bad sql query: ".mysql_error()); so if the SQL is wrong; i ...