Link to home
Start Free TrialLog in
Avatar of johnnywong71
johnnywong71

asked on

SOAP request error in IE

Hi Expert,

I have tried to use the following SOAP request in java applet viewer. It works fine.

      String url = "http://170.65.186.162/WsNew/recordingservice.asmx";
      URL HttpURL = new URL(url);
      conn = (HttpURLConnection)HttpURL.openConnection();

      conn.setDefaultUseCaches (false);
      conn.setUseCaches(false);
      conn.setDoInput(true);

conn.setRequestProperty("POST", "/WsNew/recordingservice.asmx HTTP/1.1");
conn.setRequestProperty("Host", "170.65.186.162");
conn.setRequestProperty("Content-Type", "text/xml; charset=\"utf-8\"");
conn.setRequestProperty("SOAPAction", "http://tempuri.org/GetRecordingID");
conn.setRequestMethod("POST");
....................................

But when I try to run it in IE, it show the following error message:
java.lang.ClassCastException: com/ms/net/wininet/http/HttpURLConnection
      at com/pls/util/HttpConnectionTestTT.main
      at com/pls/util/WsNew.GetRecordID
      at com/pls/base/CallCenterApp$1.run
      at java/lang/Thread.run

Thanks!

Avatar of Jaax
Jaax
Flag of India image

This is because MS uses its own Java VM and its own classes.
While you had expected java.net.HttpURLConnection, it returned you com/ms/net/wininet/http/HttpURLConnection

In the IE, goto Tools->Internet Options->Advanced and check the option to use Java VM.
This might help
Avatar of johnnywong71
johnnywong71

ASKER

Hi Expert,

But I use Java VM, it will show the exception as below:

java.security.AccessControlException: access denied (java.io.FilePermission c:\javalog read)
      at java.security.AccessControlContext.checkPermission(Unknown Source)
      at java.security.AccessController.checkPermission(Unknown Source)
      at java.lang.SecurityManager.checkPermission(Unknown Source)
      at java.lang.SecurityManager.checkRead(Unknown Source)
      at java.io.File.exists(Unknown Source)
      at sun.applet.AppletPanel.run(Unknown Source)
      at java.lang.Thread.run(Unknown Source)

Is this class is not work in latest java VM?

import java.io.*;

Thanks!
Frankie
ASKER CERTIFIED SOLUTION
Avatar of Jaax
Jaax
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial