Index: /trunk/im-jssp/src/main/java/org/intra_mart/jssp/script/api/SOAPClientObject.java =================================================================== --- /trunk/im-jssp/src/main/java/org/intra_mart/jssp/script/api/SOAPClientObject.java (リビジョン 294) +++ /trunk/im-jssp/src/main/java/org/intra_mart/jssp/script/api/SOAPClientObject.java (リビジョン 295) @@ -395,16 +395,15 @@ String portName, String serviceName) { - try { - // エンジン生成 + try{ CodeGenerationEngine engine = getCachedCodeGenEngine(wsdlLocationURI, outputLocation, portName, serviceName); CodeGenConfiguration codeGenConfiguration = engine.getConfiguration(); - return codeGenConfiguration; } - catch (Exception e) { - throw Context.throwAsScriptRuntimeEx(e); - } - } - + catch (CodeGenerationException cge) { + throw Context.throwAsScriptRuntimeEx(cge); + } + } + + /** * CodeGenerationEngineの取得。(キャッシュあり) @@ -418,7 +417,7 @@ */ private CodeGenerationEngine getCachedCodeGenEngine(String wsdlLocationURI, - File outputLocation, - String portName, - String serviceName ) throws CodeGenerationException { + File outputLocation, + String portName, + String serviceName ) throws CodeGenerationException { CodeGenerationEngine engine = cache4codeGenEngine.get(wsdlLocationURI); @@ -478,5 +477,5 @@ return args; } - + private String getStubClassName(CodeGenConfiguration codeGenConfiguration) { @@ -640,5 +639,5 @@ args[1] = "-c"; args[2] = unix.toString(); - _logger.debug("Compile Command(UNIX) -> {} {} {}", (Object[])args); + _logger.debug("Compile Command(UNIX) -> {} {} {}", (Object[]) args); } else{ @@ -998,7 +997,9 @@ if(returnType.equals(void.class)){ + // 引数が存在する場合 if(operationParamTypes.length != 0){ source.append(" this.stub." + operatinoName + "(operationParam);") .append(LINE_SEP); } + // 引数がない場合 else{ source.append(" this.stub." + operatinoName + "();") .append(LINE_SEP); @@ -1007,5 +1008,6 @@ } else{ - String getterName = "get_return"; + List getterNameList = new ArrayList(); + Map returnTypeProp = JavaScriptUtility.getBeanPropertyMap(returnType); Iterator propDescIt = returnTypeProp.values().iterator(); @@ -1015,17 +1017,27 @@ // setterが無いプロパティは除外 (例:「class」プロパティ) if(propDesc.getReadMethod() != null && propDesc.getWriteMethod() != null){ - getterName = propDesc.getReadMethod().getName(); - break; + getterNameList.add(propDesc.getReadMethod().getName()); } } + // 引数が存在する場合 if(operationParamTypes.length != 0){ source.append(" var javaResult = this.stub." + operatinoName + "(operationParam);") .append(LINE_SEP); } + // 引数がない場合 else{ source.append(" var javaResult = this.stub." + operatinoName + "();") .append(LINE_SEP); } + + // 戻り値が単一の場合 + if(getterNameList.size() == 1){ + String getterName = getterNameList.get(0); source.append(" var jsResult = " + name4JavaScriptUtility + ".javaBeanToJS"); source.append( "(javaResult." + getterName + "());") .append(LINE_SEP); + } + // 戻り値が複数の場合 + else{ + source.append(" var jsResult = " + name4JavaScriptUtility + ".javaBeanToJS(javaResult);") .append(LINE_SEP); + } source.append(" jsResult = normalize(jsResult);") .append(LINE_SEP); @@ -1082,5 +1094,8 @@ * @throws ClassNotFoundException */ - protected void executeStubJS(String stubClassName, File srcDir, String targetEndpoint) throws JavaScriptException, FileNotFoundException, InstantiationException, IllegalAccessException, IOException, ClassNotFoundException { + protected void executeStubJS(String stubClassName, File srcDir, String targetEndpoint) + throws JavaScriptException, FileNotFoundException, + InstantiationException, IllegalAccessException, + IOException, ClassNotFoundException { ScriptScope scope = getScriptScope(stubClassName, srcDir); this.setPrototype(scope); @@ -1294,4 +1309,3 @@ Never } - }