Я пытаюсь использовать веб-службу SOAP из хранимой процедуры Java, и в этом я использую команду getOutputStream () для записи полезной нагрузки в соединение, которое выдает ошибку доступа, как показано ниже.
Вызов Javaпрервано неперехваченным Java-исключением:
java.security.AccessControlException:
the Permission (java.net.SocketPermission <Server-Name>:<Port> connect,resolve)
has not been granted to INFOIFACE.
The PL/SQL to grant this is dbms_java.grant_permission
( 'INFOIFACE', 'SYS:java.net.SocketPermission', <Server-Name>:<Port>, 'connect,resolve' )
Но такой же доступ к схеме предоставляется в базе данных Oracle, и все равно она показывает ошибку.
public class remoteConnection {
public static String connectToFPH(String destUrl, String pacFile, String cred, String payLoad) throws Exception {
System.out.println("Inside function");
BrowserProxyInfo bInfo = new BrowserProxyInfo();
bInfo.setType(ProxyType.AUTO);
bInfo.setAutoConfigURL(pacFile);
DummyAutoProxyHandler handler = new DummyAutoProxyHandler();
try {
handler.init(bInfo);
} catch (ProxyConfigException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return null;
}
String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(cred.getBytes());
URL url = new URL(destUrl);
String proxyUrl = "";
ProxyInfo[] ps = handler.getProxyInfo(url);
for(ProxyInfo p : ps){
proxyUrl = p.toString();
}
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyUrl.split(":")[0], Integer.valueOf(proxyUrl.split(":")[1])));
HttpsURLConnection conn = (HttpsURLConnection)url.openConnection(proxy);
conn.setRequestMethod("POST");
conn.setRequestProperty ("Authorization", basicAuth);
conn.setRequestProperty("Content-Type", "text/xml; charset=UTF-8");
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setAllowUserInteraction(false);
OutputStream out = conn.getOutputStream();
OutputStreamWriter writer = new OutputStreamWriter(out, "UTF-8");
writer.write(payLoad);
writer.close();
out.close();
String inputLine;
StringBuffer buf = new StringBuffer();
if(conn.getResponseCode() == 200)
{
BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
while ((inputLine = in.readLine()) != null)
{
buf.append(inputLine);
}
in.close();
}
else
{
//throw new Exception("Unable to connect to FPH. Please contact Administrator");
return "unable to connect";
}
conn.disconnect();
return buf.toString();
}
}
Я прошу помощи в этом отношении.Требуется ли какой-либо другой доступ к базе данных Oracle?