cancel
Showing results for 
Search instead for 
Did you mean: 

Proxy Authentication Required Error

former_member185029
Active Contributor
0 Kudos

Hello All,

I am trying to run an email application through web dynpro, but I am getting following error.

java.rmi.RemoteException: Service call exception; nested exception is: com.sap.engine.services.webservices.jaxrpc.exceptions.InvalidResponseCodeException: Invalid Response Code: (407) Proxy Authentication Required ( The ISA Server requires authorization to fulfill the request. Access to the Web Proxy service is denied.  ).

I have configured proxy server and port.

I used the method _setUser and _setPassword to set username and password.

What else do I need to do to make this code run?

Please guide.

Regards,

Ashutosh

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Try using javax.jar file !!!

Regards, Anilkumar

former_member185029
Active Contributor
0 Kudos

javax.jar?

where from will i get it?

Ashutosh

Former Member
0 Kudos

Hi Ashutosh,

Let me know that whether your proxy server needs any authentication for accessing internet?

If yes then have you specified username and password for that?

Sometimes what happens, even we have specified this username and password in application, still we need to manually gives the user name and password.

T do this, access any website from the internet once on server machine. It will ask for user authentication. After authenticated deploy youe application on server and test.

Let me know the status.

Regards,

Bhavik

olaf_reiss
Participant
0 Kudos

Hello Bhavik,

we are facing the same problem. We have deployed the GoogleSearch to our WAS Server. I have connected to the internet from this server via MS Internet Explorer. It does not work. We always get the message: 401 Proxy Authntication required.

Thanks.

Best Regards,

Olaf Reiss

former_member185029
Active Contributor
0 Kudos

Hello Bhavik,

Thanks for the suggession.

I have already tried this solution and it has failed.

Yes my IE asks me for proxy authentication, but I have stored the authentication by clicking "Remember my login-password" option.

Hence, IE directly connects me to internet without popping up the authentication dialog box.

I also tried the same solution on other WAS server where IE pops up the authentication dialog; it did'nt work.

Regards,

Ashutosh

former_member185029
Active Contributor
0 Kudos

No replies?

I was very optimistic about the solution from this forum.

Ashutosh

Former Member
0 Kudos

hello Ashutosh,

here the server to which u r trying to connect might require authentication. try this code for it:

class SMTPAuthentication extends Authenticator

{

private String name;

private String password;

public SMTPAuthentication(String name, String pwd)

{

this.name = name;

this.password = pwd;

}

public PasswordAuthentication getPasswordAuthentication()

{

return new PasswordAuthentication(name,password);

}

}

this is the class that has the method getPasswordAuthentication() which is called automatically.

now in ur code make an object of this method.

eg:

SMTPAuthentication a = new SMTPAuthentication("username","password");

s = Session.getInstance(p,a); // where p is the property object.

i hope you are just trying to send a mail through this server.

regards,

Piyush.

former_member185029
Active Contributor
0 Kudos

Hello Piyush,

Thanks for the reply..

But I think you are talking about JavaMail syntax.

I have tried similar code in java mail ( using jsp or servlet ).

But the same code in web-dynpro throws exception.

Have you tried the same code with web-dynpro?

Regards

Ashutosh

Former Member
0 Kudos

hello Ashutosh

ya i tried this in WebDynpro and its working fine. im able to send mails. or i think the WAS server in which u r deploying might be requiring the authentication.

also make sure to give ur domain name in the username.

regards,

Piyush.

former_member185029
Active Contributor
0 Kudos

Hello Piyush,

Just to update you,

I am getting following exception if I use your code

javax.mail.SendFailedException: Sending failed;  nested exception is: 
com.sap.engine.services.javamail.exception.JavaMailMessagingException: Cannot send message to host MailServer:25 
using the SMTP protocol

Assume that MailServer is the server I am using to send mails.

On the contrary, I can send mails using JSP/Servlet/Console using same code.

What would you say now?

Regards,

Ashutosh

Former Member
0 Kudos

Please specify if you are using a Javamail application or trying to send mails using the Mail Webservice

If you are using the web service, this problem can occur as some proxies does not allow the use of Web services

Regards

Noufal

former_member185029
Active Contributor
0 Kudos

Hello Noufal,

I am trying both and will adopt the workable solution in my project.

But none of the services are working here and I am not able to send mails.

This problem occurs only if I am using Web-Dynpro for sending mails.

If I use jsp or servlets, I am able to send mails.

Regards,

Ashutosh

Former Member
0 Kudos

Try adding the smtp.jar file in your buidpath of your java mail project.

This file can be downloaded from java.sun.com

Former Member
0 Kudos

hello Ashutosh,

i think there is some problem in using ur mail apis. i also got similar execption but it was solved. are u leaving any field like subject etc. can u give the code?

Properties props = new Properties();

props.put("mail.smtp.host", "hostname");

Authenticator a = new SMTPAuthentication("username","pwd");

Session session = Session.getInstance(props, a);

session.setDebug(debug);

Message msg = new MimeMessage(session);

InternetAddress addressFrom = new InternetAddress("from");

msg.setFrom(addressFrom);

InternetAddress addressTo = new InternetAddress("to");

msg.setRecipient(Message.RecipientType.TO, addressTo);

msg.setSubject(subject);

msg.setContent(message, "text/plain");

Transport.send(msg);

this might help u.

regards,

Piyush.

former_member185029
Active Contributor
0 Kudos

Following is the code for sending mail.

************Authenctiator class *********

class TheMail extends Authenticator
{
	private String name;
	private String password;
	public TheMail(String name, String pwd)
	{
		this.name = name;
		this.password = pwd;
	}

	public PasswordAuthentication getPasswordAuthentication()
	{
		return new PasswordAuthentication(name,password);
	}
}

                • Sending mails *************

Authenticator mail=new TheMail("myDomainId","password");
      
Properties props = System.getProperties();
props.put("mail.smtp.host", "myHost");
props.put("mail.smtp.auth","true");
Session sess=Session.getInstance(props,mail);
Message msg1 = new MimeMessage(sess);
msg1.setFrom(new InternetAddress("myId@host.com"));
msg1.setRecipients(Message.RecipientType.TO,
			  InternetAddress.parse("myId@host.com", false));
msg1.setSubject("I just called to say..");
msg1.setText("...that I can send mail from WebDynpro ");
msg1.setSentDate(new Date());
			
Transport.send(msg1);

Regards,

Ashutosh

Former Member
0 Kudos

Did you try adding the jar file I told earlier?

I think it would help.

former_member185029
Active Contributor
0 Kudos

Yes I added the smtp.jar file as you said.

Then I tried

Request_IEmailService_sendMail req = new  Request_IEmailService_sendMail();

wdContext.nodeWebServiceEmail().bind(req);
	
req._setUser("myDomainId");
req._setPassword("passwd");
//........

//.......

But I am getting exception as ...

Proxy Authentication Required ( The ISA Server requires 
authorization to fulfill the request. Access to the Web 
Proxy service is denied.  ).

Regards,

Ashutosh

Message was edited by: Ashutosh Moharir

Former Member
0 Kudos

Hi,

You seems to have used the Web service for mailing.

I was suggesting the JavaMail api

You can refer the following link for assistance.

/people/sap.user72/blog/2005/06/08/sending-attachments-in-mails

Add the smtp.jar file in the build path of the project.

The code given here is in java however it works in webdynpro too

Regards

Noufal

former_member185029
Active Contributor
0 Kudos

Hello Noufal,

as I told you earlier, I am trying both the options.

The JavaMail API gives exception as

Cannot send message to host whateverHost:25 using the SMTP protocol.

But the same code will work when I put it in jsp/ servlets.

Is there any trouble in setting webdynpro?

Regards,

Ashutosh

Former Member
0 Kudos

try{

Properties props = new Properties();

props.put("mail.transport.protocol","smtp");

props.put("mail.smtp.port","25");

props.put("mail.smtp.host", "host");

Session sess=Session.getInstance(props);

Message msg1 = new MimeMessage(sess);

msg1.setFrom(new InternetAddress("myId@host.com"));

msg1.setRecipients(Message.RecipientType.TO,

InternetAddress.parse("myId@host.com", false));

msg1.setSubject("I just called to say..");

msg1.setText("...that I can send mail from WebDynpro ");

msg1.setSentDate(new Date());

Transport.send(msg1);

}catch(Exception e){

wdComponentAPI.getMessageManager().reportSuccess(e.toString());

}

check if this code works

Regards

Noufal

former_member185029
Active Contributor
0 Kudos

Sorry Noufal,

it gives same exception

Cannot send message to host hostname:25 using the SMTP protocol.

thanks and regards,

Ashutosh

Former Member
0 Kudos

This code works well in my system. I was able to send mails.

Try running this application from someother system. My friend also faced this problem.

Hope you are sdding the mail.jar and activation.jar from the plugins given in the plugins folder of your nds.

Regards

Noufal

former_member185029
Active Contributor
0 Kudos

Thats right Noufal,

I am importing mail.jar and activation.jar files.

Thats how I am able to use JavaMail functions

Ashutosh

Former Member
0 Kudos

From the code you had given earlier I too got the same exception that you said(javax.mail.SendFailedException: Sending failed; nested exception is: javax.mail.AuthenticationFailedException), but when I produced the following changed it worked for me.

1) change the System.getProperties() to new Properties()

2)remove the authentication true statement.

Hope you have provided the changes?

Just copy paste the code I gave earlier and try. If it still does not work try running it from some other NDS.

Please do let me know.

former_member185029
Active Contributor
0 Kudos

Hello Noufal,

stil I am getting the same exception...


Cannot send message to host hostName:25 using the SMTP 
protocol

Ashutosh