Using IP address in EWSClient.getEWSClient

Can I use IP address instead of email server address like the following?

IEWSClient client = EWSClient.getEWSClient( new URL( “https://10.23.27.41/EWS/Exchange.asmx” ) );

I got the following error message when trying it.

com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed

@tedkong

I don’t think there should be an issue. It seems that you are trying to access IP address which is inaccessible. Can you please verify using Ping if you able to access the server using IP address?

Here is an example.

(1) I tried to ping the mail server mail.ricoh-gse.com and it showed the IP address but couldn’t reach it. However it works fine when getting the content of mail using Aspose library(v.26). The IP address of the server is ‘52.251.124.96’.

Following codes works.

		try {
		EWSClient.useSAAJAPI( true );
		System.setProperty( "http.auth.preference", "NTLM" );

		Authenticator.setDefault( getAuthenticator( "slxntest002@ricoh-gse.com", "6Q=A9c~PYmKPjN*5!\"d)!L:{6e?>", "" ) );
		IEWSClient client = EWSClient.getEWSClient( new URL( "https://mail.ricoh-gse.com/EWS/Exchange.asmx" ) );

		System.out.println( "client - " + client.toString() );
	} catch ( Exception e ) {
		System.out.println( "Exception message - " + e.getMessage() );
	}

But following codes after replacing the server address with IP address does not work.

		try {
		EWSClient.useSAAJAPI( true );
		System.setProperty( "http.auth.preference", "NTLM" );

		Authenticator.setDefault( getAuthenticator( "slxntest002@ricoh-gse.com", "6Q=A9c~PYmKPjN*5!\"d)!L:{6e?>", "" ) );
		IEWSClient client = EWSClient.getEWSClient( new URL( "https://52.251.124.96/EWS/Exchange.asmx" ) );

		System.out.println( "client - " + client.toString() );
	} catch ( Exception e ) {
		System.out.println( "Exception message - " + e.getMessage() );
	}

(2) What versions of Exchange Servers does Aspose email support?

@tedkong

Can you please confirm which API version you are using on your end. Please try Aspose.Email for .NET 20.9 on your end.

Please visit this documentation link for your convenience.

I am using ‘aspose-email-20.6-jdk16.jar’.
Can I use ‘.NET’ version for Java programming?

I tested with Java 20.9 but showed the same error message.
You can test it with above sample codes I provided.

Oct 16, 2020 3:05:41 PM com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnection post 
SEVERE: SAAJ0009: Message send failed
Exception message - com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: com.sun.xml.internal.messaging.saaj.SOAPExceptionImpl: Message send failed

@tedkong

I have created an issue with ID EMAILJAVA-34756 in our issue tracking system to further investigate and resolve the issue. This thread has been linked with the issue so that you may be notified once the issue will be fixed.