锁定老帖子 主题:对接成功Boss系统
精华帖 (0) :: 良好帖 (0) :: 新手帖 (1) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2010-01-28
开这次给视频会议做的营帐系统与移动的Boss对接成功,销户等操作移动需要我们提供接口给boss,原理很简单,但是还是写一篇文章贡献一下自己的经验吧。 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <OrderMessage> <OrderId>12345</OrderId> // Transaction Number <MessageBody> <Order> <OrderType>1</OrderType> // Service Type <User> // User Structure <Name>02162855709</Name> <Password>3eU9ed</Password> <Telephone>02162855709</Telephone> <Activated>1</Activated> <Email>myname@gmail.com</Email> <Mobile>13952409898</Mobile> </User> </Order> </MessageBody> </OrderMessage> Socket datagramSocket = new ServerSocket (port); socket = datagramSocket.accept(); InputStream is = socket.getInputStream(); String resultStr = null; int readIndex = 5 * 1024 * 1024; BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(is), readIndex); char[] charArray = new char[readIndex]; int read_rst=0; PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true); while ((read_rst = bufferedReader.read(charArray))!=-1) { try { resultStr = new String(charArray, 0, read_rst); XmlContent=resultStr; XmlContent=XmlContent.trim(); log.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>收到boss消息:"+XmlContent); SAXReader reader = new SAXReader(); Document doc; doc = reader.read(new ByteArrayInputStream(XmlContent.getBytes("UTF-8"))); org.dom4j.Element root = doc.getRootElement(); log.debug(root.getText()); log.debug(root.getName()); if(root!=null) { Element OrderId=root.element("OrderId"); ordId=OrderId.getStringValue(); Element MessageBody=root.element("MessageBody"); Element Order=MessageBody.element("Order"); Element OrderType=Order.element("OrderType"); // System.out.println(OrderType.getStringValue()); // System.out.println("XmlContent from client : " + XmlContent); if(OrderType.getStringValue().trim().equals("1")) { log.debug(">>>>>>>>>>>socket 创建用户"); Element User =Order.element("User"); Element Name=User.element("Name"); Element Password=User.element("Password"); Element Telephone=User.element("Telephone"); Element Activated=User.element("Activated"); Element Email=User.element("Email"); Element Mobile=User.element("Mobile"); .......do 开户serveice }
声明:ITeye文章版权属于作者,受法律保护。没有作者书面许可不得转载。
推荐链接
|
|
返回顶楼 | |
发表时间:2010-07-08
kakaluyi 写道 开这次给视频会议做的营帐系统与移动的Boss对接成功,销户等操作移动需要我们提供接口给boss,原理很简单,但是还是写一篇文章贡献一下自己的经验吧。 <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <OrderMessage> <OrderId>12345</OrderId> // Transaction Number <MessageBody> <Order> <OrderType>1</OrderType> // Service Type <User> // User Structure <Name>02162855709</Name> <Password>3eU9ed</Password> <Telephone>02162855709</Telephone> <Activated>1</Activated> <Email>myname@gmail.com</Email> <Mobile>13952409898</Mobile> </User> </Order> </MessageBody> </OrderMessage> Socket datagramSocket = new ServerSocket (port); socket = datagramSocket.accept(); InputStream is = socket.getInputStream(); String resultStr = null; int readIndex = 5 * 1024 * 1024; BufferedReader bufferedReader = new BufferedReader( new InputStreamReader(is), readIndex); char[] charArray = new char[readIndex]; int read_rst=0; PrintWriter out = new PrintWriter(new BufferedWriter(new OutputStreamWriter(socket.getOutputStream())), true); while ((read_rst = bufferedReader.read(charArray))!=-1) { try { resultStr = new String(charArray, 0, read_rst); XmlContent=resultStr; XmlContent=XmlContent.trim(); log.debug(">>>>>>>>>>>>>>>>>>>>>>>>>>>>收到boss消息:"+XmlContent); SAXReader reader = new SAXReader(); Document doc; doc = reader.read(new ByteArrayInputStream(XmlContent.getBytes("UTF-8"))); org.dom4j.Element root = doc.getRootElement(); log.debug(root.getText()); log.debug(root.getName()); if(root!=null) { Element OrderId=root.element("OrderId"); ordId=OrderId.getStringValue(); Element MessageBody=root.element("MessageBody"); Element Order=MessageBody.element("Order"); Element OrderType=Order.element("OrderType"); // System.out.println(OrderType.getStringValue()); // System.out.println("XmlContent from client : " + XmlContent); if(OrderType.getStringValue().trim().equals("1")) { log.debug(">>>>>>>>>>>socket 创建用户"); Element User =Order.element("User"); Element Name=User.element("Name"); Element Password=User.element("Password"); Element Telephone=User.element("Telephone"); Element Activated=User.element("Activated"); Element Email=User.element("Email"); Element Mobile=User.element("Mobile"); .......do 开户serveice }
用SOAP,WEBSERVICE,是中国移动增值业务系统的大势所趋,当你接触到中国移动VGOP系统的互通网关就知道原因了 |
|
返回顶楼 | |
发表时间:2010-07-08
哥们你说的很对,联通的营帐就是用soap,webservice做的
|
|
返回顶楼 | |
发表时间:2010-09-14
用webservice的确是好东西,最起码我接触的电信很多东西,不管是门户还是底层接口都有很多是通过这个开放的
|
|
返回顶楼 | |
发表时间:2011-01-11
华为 也是搞这么一套
|
|
返回顶楼 | |
浏览 6104 次