Java连接到CentralNIC EPP服务器

时间:2017-05-16 11:28:39

标签: java epp

我有关于流连接到epp服务器ssl socket communicatoin to an epp server的这个帖子。 我的代码:

Socket socket = sf.createSocket("xxx.xxx.xxx.xxx", 700);
    String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n" +
            "<epp xmlns=\"urn:ietfaramsml:ns:epp-1.0\"\n" +
            "                xmlnssi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
            "                xsi:schemaLocation=\"urn:ietfaramsml:ns:epp-1.0 epp-1.0.xsd\">\n" +
            "<command xmlns=\"urn:ietfaramsml:ns:epp-1.0\">\n" +
            "  <login>\n" +
            "    <clID>user</clID>\n" +
            "    <pw>pass</pw>\n" +
            "    <options>\n" +
            "      <version>1.0</version>\n" +
            "      <lang>en</lang>\n" +
            "    </options>\n" +
            "    <svcs>\n" +
            "      <objURI>urn:ietfaramsml:nsomain-1.0</objURI>\n" +
            "      <objURI>urn:ietfaramsml:ns:contact-1.0</objURI>\n" +
            "      <objURI>urn:ietfaramsml:ns:host-1.0</objURI>\n" +
            "    </svcs>\n" +
            "  </login>\n" +
            "  <clTRID>ACCCCFFFFF</clTRID>\n" +
            "</command>\n" +
            "</epp>";
    socket.setSoTimeout(300000);

    PrintWriter writer = new PrintWriter(new 
    OutputStreamWriter(socket.getOutputStream()),true);
    BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    writer.write(xml);
    writer.close();
    System.out.println("response 1:" + br.readLine());

    writer.println(xml);
    writer.close();
    System.out.println("response 2:" + br.readLine());

响应1返回问候消息,响应2返回null 如何向epp服务器发送登录命令?

0 个答案:

没有答案