Skip to main content

Notifications

Microsoft Dynamics GP (Archived)

Consuming Dynamics GP native web service from Java using Apache CXF framework

Posted on by Microsoft Employee

I have a requirement to consume Dynamics GP native web service from Java and i am using Apache CXF to create the soap client. We are using kerbaros authentication as part of CXF (spnego).

We are able to call the web service from a .net based  soap client from the same computer by passing the username, password and domain name as input for authentication.

But with java.. we are getting SocketTimeoutException as below.

[Krb5LoginModule] authentication failed

org.apache.cxf.interceptor.Fault: General security error (An error occurred in trying to obtain a TGT: Receive timed out)

Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.DualStackPlainDatagramSocketImpl.socketReceiveOrPeekData(Native Method)
at java.net.DualStackPlainDatagramSocketImpl.receive0(DualStackPlainDatagramSocketImpl.java:124)
at java.net.AbstractPlainDatagramSocketImpl.receive(AbstractPlainDatagramSocketImpl.java:143)
at java.net.DatagramSocket.receive(DatagramSocket.java:812)
at sun.security.krb5.internal.UDPClient.receive(NetClient.java:206)
at sun.security.krb5.KdcComm$KdcCommunication.run(KdcComm.java:411)
at sun.security.krb5.KdcComm$KdcCommunication.run(KdcComm.java:364)
at java.security.AccessController.doPrivileged(Native Method)
at sun.security.krb5.KdcComm.send(KdcComm.java:348)
at sun.security.krb5.KdcComm.sendIfPossible(KdcComm.java:253)
at sun.security.krb5.KdcComm.send(KdcComm.java:229)
at sun.security.krb5.KdcComm.send(KdcComm.java:200)
at sun.security.krb5.KrbAsReqBuilder.send(KrbAsReqBuilder.java:316)
at sun.security.krb5.KrbAsReqBuilder.action(KrbAsReqBuilder.java:361)
at com.sun.security.auth.module.Krb5LoginModule.attemptAuthentication(Krb5LoginModule.java:766)
... 40 more

We have login.config and krb5.conf files as below.

login.config ==============

spnego-client {
com.sun.security.auth.module.Krb5LoginModule required
debug=true
refreshKrb5Config=true;
};

======================

krb5.conf================

[libdefaults]
default_realm=DOMAIN1.MYCOMPANY.LOCAL

[realms]
DOMAIN1.MYCOMPANY.LOCAL = {
kdc=MACHINE01.domain1.mycompany.local
default_domain=DOMAIN1.MYCOMPANY.LOCAL
}
[domain_realm]
.domain1.mycompany.local=DOMAIN1.MYCOMPANY.LOCAL
domain1.mycompany.local=DOMAIN1.MYCOMPANY.LOCAL

=======================

Endpoint : http://MACHINE01:112233/Dynamics/GPService/GPService

client.getRequestContext().put("ws-security.callback-handler", new NamePasswordCallbackHandler("UERNAME", "PASSWORD"));

*This post is locked for comments

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans