We are trying the sample application in Cisco DevNet website, which demonstrates how to create an Extension Mobility web service consumer client. We have followed the instructions and imported the certification to the keystore, but it still won't work.

Here is the link of the sample: https://developer.cisco.com/site/extension-mobility/learn/sample-apps/index.gsp

Here is the error message:

Exception in thread "main" javax.net.ssl.SSLHandshakeException: java.security.cert.CertificateException: No subject alternative names present

When I test with insecure connection use the URL as

http:/<x.x.x.x>/:8080/emservice/EMServiceServlet

It shows 500 error message:

java.lang.NullPointerException
java.lang.String.<init>(String.java:147)
com.cisco.emservice.EMServiceServlet.processRequest(EMServiceServlet.java:204)
com.cisco.emservice.EMServiceServlet.doPost(EMServiceServlet.java:451)
com.cisco.emservice.EMServiceServlet.doGet(EMServiceServlet.java:385)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:722)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
java.lang.reflect.Method.invoke(Method.java:597)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:274)
org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:271)
java.security.AccessController.doPrivileged(Native Method)
javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:306)
org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:166)

Here is my code:

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

    URL url = new URL("https://192.168.10.11:8443/emservice/EMServiceServlet");
    URLConnection conn = url.openConnection();
    conn.setDoOutput(true);
    conn.setRequestProperty("Content-Type","application/x-www-form-urlencoded");

    String EMRequest = "<request><appinfo><appid>operator</appid><appcertificate>operator</appcertificate></appinfo>";
    EMRequest += "<login><devicename>SEP000000000001</devicename><userid>user01</userid><deviceprofile>EM-USER01/deviceprofile>";
    EMRequest += "<exclusiveduration><time>60</time></exclusiveduration></login></request>";
    //URL encode/escape the request
    EMRequest = URLEncoder.encode(EMRequest,"UTF-8");
    //Build the complete HTTP form request body
    EMRequest = "xml="+EMRequest;

    //Create an OutputStreamWriter for the URLConnection object and make the request
    OutputStreamWriter writer = new OutputStreamWriter(conn.getOutputStream());
    writer.write(EMRequest);
    writer.flush();

    //Read the response
    BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream()));

    //Output the response to the console
    String line;
    while ((line = reader.readLine()) != null) {
    System.out.println(line);
    }

    //Cleanup the stream objects
    writer.close();
    reader.close();
    }
}

is there any solution for this problem? Thank you...

0

There are 0 best solutions below