0 0

有人帮我指点下我如何实现服务器和客户机之间数据传送 5

首先我是服务器,别人用SOAP协议发包给我,我的接口该怎么发布呢?
如下是别人调用我的接口的代码:
public String loginIn(String bnetAccount, String useAccount, String password, String timestamp) throws Exception {
        MD5 md5 = new MD5();
        String hashcode = md5.getMD5ofStr(bnetAccount + useAccount + "GD9900050" + timestamp + "1234567890ABCDEF");
        //异或运算获取密码
        password = Util.encrypt(password.getBytes(), hashcode.getBytes());
        String temp = this.makeAuthXML(bnetAccount, useAccount, password, timestamp);
        String ret = "";
        String result = "";
        String xmlString =
                " <?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                " <SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\"\n" +
                "                  xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\"\n" +
                "                  xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" +
                "                  xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                "                    xmlns:v1=\"http://bnet.gsta.com/v1.18\">\n" +
                " <SOAP-ENV:Body>\n" + temp +
                " </SOAP-ENV:Body>\n" +
                " </SOAP-ENV:Envelope>";
        MessageFactory mf = MessageFactory.newInstance();
        SOAPMessage smsg =
                mf.createMessage(new MimeHeaders(), new ByteArrayInputStream(xmlString.getBytes()));
        //SOAPPart sp = smsg.getSOAPPart();
        //SOAPEnvelope se = (SOAPEnvelope) sp.getEnvelope();
        //发送请求
        SOAPConnection conn = SOAPConnectionFactory.newInstance().createConnection();
        SOAPMessage response = conn.call(smsg, endPoint);
红色的endpoint应该是我发布接口的端口,但现在问题是不知道我的端口怎么发布。。
2008年6月30日 10:47

1个答案 按时间排序 按投票排序

0 0

用webservice 作不就行么

2008年6月30日 17:23

相关推荐

Global site tag (gtag.js) - Google Analytics