Implement Salesforce Outbound Message by JavaEE

    xiaoxiao2026-08-08  6

    准备工具:JDK、Eclipse Java EE IDE、ngrok.exe(翻墙https://ngrok.com/download,http://www.cnblogs.com/chengxiaohui/articles/4864791.html

    Tools to use: JDK、Eclipse Java EE IDE、ngrok.exe(VPN: https://ngrok.com/download, http://www.cnblogs.com/chengxiaohui/articles/4864791.html

     

    Salesforce

    在Lead Object上创建一个Workflow,当有新Lead进来,即发Outbound Message到外部Server

    Create a Workflow on Object Lead which triggers an Outbound Message to Call-out Server when new leads come in.

    生成WSDL文件到本地桌面,命名为Notification.wsdl

    Generate a WSDL file to Desktop and name it as Notification.wsdl.

     

    创建新的Java Web工程

    Create a new Java Web project.

    直接把Notification.wsdl文件拖到LeadNotificaton工程

    Drag the file Notification.wsdl to Project LeadNotifcation.

     运行LeadNotification工程,启用Tomcat

    Run LeadNotification, start up Tomcat.

    Eclipse->File->New->Other->Web Service★★★★★

     

    选择"Top down Java been Web Service",点Browse加载wsdl文件,并且勾选"Publish the Web service"

    Choose "Top down Java been Web Service", click button Browse to load file WSDL and tick "Publish the Web service".★★★★★

     

    最后生成一些Java代码,打开NotificationBindingImpl.java,修改notifications方法return true并加入log

    Jave codes will be generated by now. Open NotificationBindingImpl.java, edit method Notification, Return true and add it to log.

    直接打开浏览器,输入http://localhost:8080/LeadNotification/services/Notification?wsdl

    Open browser, input http://localhost:8080/LeadNotification/services/Notification?wsdl ★★★★★

    这时候工程发布成功

    The project will be released successfully by now.

     

    打开翻墙工具,接着用cmd打开ngrok.exe工具(需要注册,载入Token),输入ngrok.exe http 8080

    Open VPN and open ngrok.exe by cmd(Register and load Token), input ngrok.exe http 8080.★★★★★

    替换浏览器里的localhost:8080地址,回车即可

    Copy and past the address localhost:8080 from the browser, enter.★★★★★

     

    最后再将这个域名更新到Outbound Message里

    At last update the DNS to Outbound Message.

     

    Salesforce里创建一条新的Lead,随后进入到Outbound Messaging Delivery Status,如果失败这里会有记录

    Create a new Lead in Salesforce. Go to Outbound Messaging Delivery Status. Records will be shown here if it failed.

     

    如果成功会看到Eclipse里的日志打印结果

    If it succeeded, log print result will be shown in Eclipse.

    最后,成功!!!!!!

    Congratulations! It's done!

    转载请注明原文地址: https://ju.6miu.com/read-1310973.html
    最新回复(0)