cancel
Showing results for 
Search instead for 
Did you mean: 

The following is working as a Java application but not as a DynPro App

Former Member
0 Kudos

Hello,

Please have a look at the following code:

URL testURL = new URL("http://<host>/error.txt");

HttpURLConnection c = (HttpURLConnection)(testURL.openConnection());
c.setDoInput(true);
c.setDoOutput(true);
c.setRequestProperty("Connection","Keep-Alive");
c.setRequestProperty("Proxy-Connection","Keep-Alive");
c.setRequestMethod("GET");
c.setUseCaches(false);
c.connect();

int cl = c.getContentLength();
DataInputStream dis = new DataInputStream(c.getInputStream());
	.......		

This code is working well when I run it as an independent Java application but when I "plant" this code on a DynPro application I receive an I/O Exception at this line:

DataInputStream dis = new DataInputStream(c.getInputStream());

Can anyone please tell me why?

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I had the similar problem and as a wrokaroung i have created a share on the HOSt and copied the file under that and used the same the follwing code.

Ex :
MACHINENAME
FILENAME.txt

FileReader f =new FileReader("

MachineName
CSNAPPURL.txt");

BufferedReader r=new BufferedReader(f);

String CSNURL=r.readLine();

Regards, Anilkumar

Former Member
0 Kudos

Dear Anilkumar,

At the moment implementing your solution is not available in our Network.

The Error message I receive is:

"Server returned http response code: 503 for URL...."

503 means that the URL can't be found on the target server but if this is true than how can it be that it finds the same URL on the same Server when I run the same code as a standalone Java application but not as a DynPro application?

By the way, when I open a browser from the Portal Server I am able to reach the problematic URL...

Any ideas anyone...?

Former Member
0 Kudos

503 error means a bit different thing. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html

<i><b>10.5.4 503 Service Unavailable</b>

The server is currently unable to handle the request due to a temporary overloading or maintenance of the server. The implication is that this is a temporary condition which will be alleviated after some delay. If known, the length of the delay MAY be indicated in a Retry-After header. If no Retry-After is given, the client SHOULD handle the response as it would for a 500 response.

Note: The existence of the 503 status code does not imply that a server must use it when becoming overloaded. Some servers may wish to simply refuse the connection.

</i>

Can you track requests from both stand-alone Java and WD application via some HTTP tunneling tool to check differences in headers, encoding, etc?

VS

Former Member
0 Kudos

Are you suggestiong that the rquest is different from my machine and from the Portal Server? In any case, I am not familiar with such a tool...

Former Member
0 Kudos

Please provide exception details.

The most general reason is Java security policy that forbids connection to certain hosts.

VS

Former Member
0 Kudos

Is your java Application deployed on the server?. Your WebDynpro application runs from the server.

Former Member
0 Kudos

No the Java application runs on the Client, I am aware that this is where the problem lies but why is this happening?