我正在尝试将参数传递给类构造函数,但没有成功。我试过以下
PHP
$c = "site.wsdl";
$client = new SoapClient($c,array('classmap' => array('state' => "mystate",'county' => "mycounty")),array("trace"=> 1,"exceptions" => 1));
$client = new SoapClient($c,array('classmap' => array('state' => "mystate",'county' => "mycounty")));
$client = new SoapClient($c,array('state' => "mystate",'county'=>"mycounty"));
Web服务代码Java
@WebService
public class MyWebservice{
String test = "";
/**
*
* @param county
* @param state
*/
public MyWebservice(@WebParam(name = "county") String county,
@WebParam(name = "state") String state) {
test= county+"_"+state;
//want to use this String elsewhere in the class
}
}
错误
Fatal error: Uncaught SoapFault exception: [S:Server] com.sun.enterprise.container.common.spi.util.InjectionException: Error creating managed object for class
如果我从构造函数中删除参数,我在创建肥皂客户端时没有任何问题。
谢谢你的帮助。