• IsmpSp接口开发


    中国电信Ismp接口改造,参考文档:

    1、《中国电信综合业务管理平台ISMP接口规范(RC1.0.1)-SP接口.pdf

    2、《IsmpSpEngine.wsdl

    一、    接口服务的开发

    以下是具体的开发过程:

    1、  Eclipse中新建一个web工程zdflsmsserviceJAVA EE 5.0规范

    2、  build path中添加User Libraray Axis2

    3、  WebRoot目录下新建目录wsdl,把IsmpSpEngine.wsdl文件放进来

    4、  使用newàother…àAxis2 code generator生成服务端代码,选择“通过wsdl文件生成代码”,wsdl文件指向IsmpSpEngine.wsdl,如图:

    5、  下一步,照下图填写:

    6、  下一步,选择 ,然后点“browser”,选择当前工程作为目标目录

    7、  点击finish,完成。

    8、  刷新项目文件夹,打开文件com.chinatelecom.ismp.sp.IsmpSpEngineServiceSkeleton.java,进行编辑,实现其中的3个方法:

            public com.chinatelecom.ismp.sp.OrderRelationUpdateNotifyReturn orderRelationUpdateNotify

                      (

                      com.chinatelecom.ismp.sp.OrderRelationUpdateNotifyReqE orderRelationUpdateNotifyReq0

                      )

                {

                    OrderRelationUpdateNotifyReqE reqe=orderRelationUpdateNotifyReq0;

                    OrderRelationUpdateNotifyReturn ret=new OrderRelationUpdateNotifyReturn();

                    OrderRelationUpdateNotifyReq req=reqe.getOrderRelationUpdateNotifyReq();

                    int i=SpOrder.OrderUpdate(req);

                    Response resp=new Response();

                    resp.setResultCode(i);

                    resp.setStreamingNo(req.getStreamingNo());

                    ret.setOrderRelationUpdateNotifyReturn(resp);

                    return ret;

                }

        

            

            /**

             * Auto generated method signature

             *

                                         * @param serviceConsumeNotifyReqPara2

             */

           

                     public com.chinatelecom.ismp.sp.ServiceConsumeNotifyReturn serviceConsumeNotify

                      (

                      com.chinatelecom.ismp.sp.ServiceConsumeNotifyReqPara serviceConsumeNotifyReqPara2

                      )

                {

                       ……略

                       int i=SpOrder.ServiceConsume(req);

                       ……略

                 }

        

            

            /**

             * Auto generated method signature

             *

                                         * @param notifyManagementInfoReq4

             */

           

                     public com.chinatelecom.ismp.sp.NotifyManagementInfoReturn notifyManagementInfo

                      (

                      com.chinatelecom.ismp.sp.NotifyManagementInfoReqE notifyManagementInfoReq4

                      )

                {

    ……略

                       int i=SpOrder.ManagementNotify(req);

    ……略

                }

        

        

    9、  新建类SpOrder,编写业务逻辑:

    package com.chinatelecom.ismp.sp;

    import com.chinatelecom.ismp.sp.req.NotifyManagementInfoReq;

    import com.chinatelecom.ismp.sp.req.OrderRelationUpdateNotifyReq;

    import com.chinatelecom.ismp.sp.req.ServiceConsumeNotifyReq;

    public class SpOrder {

        public static int OrderUpdate(OrderRelationUpdateNotifyReq req)

        {

           String streamNo=req.getStreamingNo();  //流水号

            String packageId=req.getPackageID();    //套餐id

            String productId=req.getProductID();    //产品id

            String userId=req.getUserID();          //用户id

            int opType=req.getOPType();             //操作:0-订购,3-退订

            int userIdType=req.getUserIDType();     //用户id类别:0-MSISDN,1-PHS,2-PSTN,3-伪码

            System.out.println(String.format(

                 "流水号:%1$s,套餐id:%2$s,产品id:%3$s,用户id:%4$s,用户id类别:%5$s,操作:%6$s",

                 streamNo,packageId,productId,userId,userIdType,opType));       

           return 0;

        }

        public static int ServiceConsume(ServiceConsumeNotifyReq req){

           ……略

        }

        public static int ManagementNotify(NotifyManagementInfoReq req){

           ……略

        }

    }

     

    10、              打开向导Axis2 service Archiver, NEXT,选择类文件所在目录:

     

    11、              下一步,选择wsdl文件:

    12、              下一步,加入外部包:

    13、              下一步,选择service.xml文件:

    14、              下一步,选择aar存放文件路径和文件名:

    15、              访问http://10.180.13.53:5845/axis2/services/IsmpSpEngineService?wsdl,查看服务是否发布成功

     

    二、    客户端开发

    1、  新建java 工程zdflsmsserviceTest

    2、  导入用户库axis2build path

    3、  axis2 code generator生成客户端代码,使用同一个wsdl文件:

    4、  下一步,生成选项:

    5、  下一步,生成的目标路径,当前工程目录:

    6、  Finish,完成。刷新工程文件目录。

    7、  新建类ClientTest,编写测试客户端代码:

    package com.chinatelecom.ismp.sp;

     

    import com.chinatelecom.ismp.sp.IsmpSpEngineServiceStub.NotifyManagementInfoRsp;

    import com.chinatelecom.ismp.sp.IsmpSpEngineServiceStub.OrderRelationUpdateNotifyReq;

    import com.chinatelecom.ismp.sp.IsmpSpEngineServiceStub.OrderRelationUpdateNotifyReqE;

    import com.chinatelecom.ismp.sp.IsmpSpEngineServiceStub.Response;

    import com.chinatelecom.ismp.sp.IsmpSpEngineServiceStub.NotifyManagementInfoReq;

    import com.chinatelecom.ismp.sp.IsmpSpEngineServiceStub.NotifyManagementInfoReqE;

    import com.chinatelecom.ismp.sp.IsmpSpEngineServiceStub.ServiceConsumeNotifyReq;

    import com.chinatelecom.ismp.sp.IsmpSpEngineServiceStub.ServiceConsumeNotifyReqPara;

    public class ClientTest {

     

        /**

         * @param args

         */

        public static void main(String[] args)throws Exception {

           stub=new IsmpSpEngineServiceStub(

                  "http://222.172.222.40:5845/axis2/services/IsmpSpEngineService");

           //orderRelationUpdateNotfy();

           //notifyManagementInfo();

           serviceConsumeNotfy();

        }

        public static IsmpSpEngineServiceStub stub;

     

        public static void orderRelationUpdateNotfy()throws Exception{

           OrderRelationUpdateNotifyReqE e=new OrderRelationUpdateNotifyReqE();

           OrderRelationUpdateNotifyReq req=new OrderRelationUpdateNotifyReq();

           req.setOPType(0);    //订购

           req.setPackageID("000");//套餐id

           req.setProductID("123");//产品id

           req.setStreamingNo("1999001112233554676");//流水号

           req.setUserID("15969508550");//号码

           req.setUserIDType(0);       //号码类型:MSISDN

           e.setOrderRelationUpdateNotifyReq(req);

           Response rsp=stub.orderRelationUpdateNotify(e).getOrderRelationUpdateNotifyReturn();

           System.out.println(String.format("resp------------/n流水号:%1$s,返回码:%2$s",

                  rsp.getStreamingNo(),rsp.getResultCode()));

          

        }

        public static void notifyManagementInfo()throws Exception{

           NotifyManagementInfoReqE e=new NotifyManagementInfoReqE();

           NotifyManagementInfoReq req=new NotifyManagementInfoReq();

           req.setStreamingNo("888888888888888888");//流水号

           req.setID("444");//id

           req.setIDType(0);//id类型:产品 id

           req.setStatus(0);//状态:正常

           e.setNotifyManagementInfoReq(req);

           NotifyManagementInfoRsp rsp=stub.notifyManagementInfo(e).getNotifyManagementInfoReturn();

           System.out.println(String.format("resp------------/n流水号:%1$s,返回码:%2$s",

                  rsp.getStreamingNo(),rsp.getResultCode()));         

        }

        public static void serviceConsumeNotfy()throws Exception{

           ServiceConsumeNotifyReqPara e=new ServiceConsumeNotifyReqPara();

           ServiceConsumeNotifyReq req=new ServiceConsumeNotifyReq();

           req.setFeatureStr("DF#106295598#17050100");//特征码

           req.setLinkID("");//linkid

           req.setProductID("123");//产品id

           req.setStreamingNo("111111111");//流水号

           req.setUserID("15969508550");//号码

           req.setUserIDType(0);//号码类型:MSISDN

           e.setServiceConsumeNotifyReqPara(req);

           Response rsp=stub.serviceConsumeNotify(e).getServiceConsumeNotifyReturn();

           System.out.println(String.format("resp------------/n流水号:%1$s,返回码:%2$s",

                  rsp.getStreamingNo(),rsp.getResultCode()));  

        }

     

    }

    ....>>图片比较多,实在懒得上传了,大家也可以去资源中下载word文档(含所有图片)。资源名《中国电信

    IsmpSp接口开发》。

                                                                                                      杨宏焱 2009-8-24

  • 相关阅读:
    INTERVAL YEAR TO MONTH数据类型
    Oracle 中DATE类型的计算
    Oracle中特殊的变量类型
    Webview窗口设置遮罩层
    mui.init方法配置
    mui.fire()触发自定义事件
    管理员启动程序的命令
    收藏网址
    html标签
    Event对象和触发
  • 原文地址:https://www.cnblogs.com/encounter/p/2188561.html
Copyright © 2020-2023  润新知