美文网首页序员教你写代码
SAP HR的webservice调用心得(https)

SAP HR的webservice调用心得(https)

作者: 风一样的执着 | 来源:发表于2014-12-27 17:07 被阅读812次

    前提:

    SAP HR提供给你webservice到wsdl文件

    第一步:将wsdl文件转成java

    下载axis2-1.6.2-bin

    转到文件夹 \axis2-1.6.2\bin

    cmd到\axis2-1.6.2\bin文件夹 执行

    wsdl2java -uri 800_SI_HR_ORG_INService.wsdl

    //wsdl2java -uri 800_SI_HR_PERSON_INService.wsdl

    在bin文件夹中可以看到src代码

    第二步:将代码拷入工程调用

    将src拷入工程

    写如下调用代码:

    SI_HR_ORG_INServiceStub stub = new SI_HR_ORG_INServiceStub();

    Authenticator authenticator = new Authenticator();

    authenticator.setAuthSchemes(authScheme);

    authenticator.setUsername(Conf.getValue("hr_user"));

    authenticator.setPassword(Conf.getValue("hr_password"));

    // authenticator.setHost("HOST");

    // authenticator.setDomain("DOMAIN");

    // authenticator.setPort(443);

    authenticator.setAllowedRetry(true);

    authenticator.setPreemptiveAuthentication(true);

    Options options = stub._getServiceClient().getOptions();

    options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);

    options.setProperty(

    org.apache.axis2.transport.http.HTTPConstants.CHUNKED,

    Boolean.FALSE);

    options.setProperty(HTTPConstants.CHAR_SET_ENCODING,"utf-8");

    options.setTransportInProtocol("https");

    options.setProperty(HTTPConstants.SO_TIMEOUT, 300000);

    // options.setTo(new

    // EndpointReference("https://abc.def.com/EWS/Exchange.asmx"));

    stub._getServiceClient().setOptions(options);

    //TODO 调用具体方法

    stub.方法名();

    相关文章

      网友评论

        本文标题:SAP HR的webservice调用心得(https)

        本文链接:https://www.haomeiwen.com/subject/mfnatttx.html