java调用sap webservice

1. 在R3中创建remote enable的RFC

2. 将RFC扩展成为WEBSERVICE

3. 维护webservice并获得WSDL

4. 在eclipse中建立webservice client,并调用接口

java调用sap webservice

@RequestMapping(value = "/getInBox", method = RequestMethod.GET)
@ResponseBody
public JSONArray dictChangeBapi(String user){
try {
ZWS_SAP_WAPI_GETWORKLIST_ServiceLocator serviceLocator = new ZWS_SAP_WAPI_GETWORKLIST_ServiceLocator();
serviceLocator.setZWS_SAP_WAPI_GETWORKLISTEndpointAddress(getAddress("ZWS_SAP_WAPI_GETWORKLIST"));
ZWS_SAP_WAPI_GETWORKLIST_PortType porttype = serviceLocator.getZWS_SAP_WAPI_GETWORKLIST();
             SWR_WIHDR[] temp = new SWR_WIHDR[0];
            TABLE_OF_SWR_WIHDRHolder tablist = new TABLE_OF_SWR_WIHDRHolder(temp);
                       int  returnstatus=porttype.ZWS_SAP_WAPI_GETWORKLIST(user, tablist);
            List<SWR_WIHDR> swlist=new ArrayList<SWR_WIHDR>();
            for(int i=0;i<tablist.value.length;i++){
            swlist.add(tablist.value[i]);
            }
    JSONArray jsonArray = JSONArray.fromObject(swlist);
    return jsonArray;
} catch (Exception e) {
throw new AppException(e.toString());
}
}




你可能感兴趣的:(java调用sap webservice)