0
我想將參數傳遞給類的構造函數,但一直沒有成功。我曾嘗試以下將參數傳遞給Class構造函數PHP SOAP?
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"));
Webservice的代碼的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
如果我從構造函數中刪除參數,我沒有產生任何問題肥皂客戶端。
謝謝你的幫助。