接口:
@WebService(targetNamespace = "http://interf.service.blood.shlx.com", serviceName = "PdaService")
public interface PdaService {
@WebResult(name = "return", targetNamespace = "http://interf.service.blood.shlx.com")
@WebMethod(action = "http://interf.service.blood.shlx.com/doReceipt")
public String doReceipt(
@WebParam(name="BagCode",targetNamespace="http://interf.service.blood.shlx.com") String BagCode,
@WebParam(name="CheckerCode",targetNamespace="http://interf.service.blood.shlx.com") String CheckerCode,
@WebParam(name="SingerCode",targetNamespace="http://interf.service.blood.shlx.com") String SingerCode,
@WebParam(name="DepartmentCode",targetNamespace="http://interf.service.blood.shlx.com") String DepartmentCode
) ;
}
接口实现:
@WebService(endpointInterface="com.shlx.blood.service.interf.PdaService",serviceName="PdaService")
@IocBean
public class PdaServiceImpl implements PdaService {
private final Log log = Logs.get();
@Inject
protected Dao dao;
@Inject
protected PdaServiceBo pdaServiceBo;
@Aop(TransAop.READ_COMMITTED)
@Override
public String doReceipt(String BagCode,String CheckerCode,String SingerCode,String DepartmentCode){
NutMap returnMap = new NutMap();
//执行结果代号--出参
int ReturnCode = -999;
//执行结果描述--出参
String ReturnText = "无";
Sql sql = Sqls.create("{CALL PDA_SCAN_BAGCODE(@BagCode,@CheckerCode,@SingerCode,@DepartmentCode,@OUTReturnCode,@OUTReturnText)}");
sql.setEntity(dao.getEntity(Record.class));
sql.params().set("BagCode", BagCode); // 设置入参
sql.params().set("CheckerCode", CheckerCode); // 设置入参
sql.params().set("SingerCode", SingerCode); // 设置入参
sql.params().set("DepartmentCode", DepartmentCode); // 设置入参
sql.params().set("OUTReturnCode", Types.INTEGER);// 设置出参类型,注意,必须加OUT开头
sql.params().set("OUTReturnText", Types.VARCHAR);// 设置出参类型,注意,必须加OUT开头
dao.execute(sql);
Record re = sql.getOutParams();
ReturnCode = re.getInt("returncode");
ReturnText = re.getString("returntext");
returnMap.put("ReturnCode", ReturnCode);
returnMap.put("ReturnText", ReturnText);
//return ReturnText;
return Json.toJson(returnMap);
}
}
后台客户端模拟调用webservice后:
开始获取数据。。。
Exception in thread "main" com.sun.xml.internal.ws.fault.ServerSOAPFaultException: Client received SOAP Fault from server: Fault occurred while processing. Please see the server log to find more detail regarding exact cause of the failure.
at com.sun.xml.internal.ws.fault.SOAP11Fault.getProtocolException(Unknown Source)
at com.sun.xml.internal.ws.fault.SOAPFaultBuilder.createException(Unknown Source)
at com.sun.xml.internal.ws.client.sei.StubHandler.readResponse(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(Unknown Source)
at com.sun.xml.internal.ws.db.DatabindingImpl.deserializeResponse(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(Unknown Source)
at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(Unknown Source)
at com.sun.proxy.$Proxy31.doReceipt(Unknown Source)
at com.shlx.blood.service.interf.Client.main(Client.java:8)