This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes BEA/Weblogic and the fly likes Using HttpURLConnection.getInputStream() in weblogic Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Products » BEA/Weblogic
Bookmark "Using HttpURLConnection.getInputStream() in weblogic" Watch "Using HttpURLConnection.getInputStream() in weblogic" New topic
Author

Using HttpURLConnection.getInputStream() in weblogic

ddineshsmile Kumar
Greenhorn

Joined: Mar 03, 2011
Posts: 2
Hi,

I am using weblogic version 10.3.4 for my development
I am trying to creating a user using SPML request.

But I am getting error in the below line.

httpConn is the HttpURLConnection
InputStreamReader isr = new InputStreamReader(httpConn.getInputStream());

when i try to call the getInputStream() method I am getting the error as below:

Caused by: java.io.FileNotFoundException: Response: '401: Unauthorized' for url: 'xxxxxxxxxxxxx'
at weblogic.net.http.HttpURLConnection.getInputStream(HttpURLConnection.java:487)
at weblogic.net.http.SOAPHttpURLConnection.getInputStream(SOAPHttpURLConnection.java:37)
at org.test.Create.create(Create.java:93)

Please suggest me what would be the route cause for the below issue.

Regards,
Dinesh.
amit punekar
Ranch Hand

Joined: May 14, 2004
Posts: 511
Hi,
You might have some authentication mechanism in place on your weblogic. Unless you pass username and password it won't allow you to request.
You may as well want to check out Apache HTTPClient APIs for HTTP interaction. It makes it lot easier to do such things.


regds,
Amit
ddineshsmile Kumar
Greenhorn

Joined: Mar 03, 2011
Posts: 2
I am giving the username and password in the connection and i am getting the connection successfully
But when i try to execute the line InputStreamReader isr = new InputStreamReader(httpConn.getInputStream()); , I am getting the error.

When i execute the same java class in stand alone it is working fine.
But when i try from weblogic server i am facing the error.

Please suggest me how to proceed.

Regards,
Dinesh
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6661
    
    5

Does the target URL use BASIC authentication ? How are you passing the username and password ?


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using HttpURLConnection.getInputStream() in weblogic
 
Similar Threads
is "+" overloaded for wrapper objects
Could not access SOAP header - sending sopa message using weblogic
error in running stand alone WLST
Oracle 10g driver throws java.sql.SQLException: OALL8 is in an inconsistent state Web
validation by annotations