Options

How to import NAV web service in Java

zimworxcodezimworxcode Member Posts: 53
edited 2011-06-05 in NAV Three Tier
I need to connect to Web services while in Java. I followed instructions on this blog:

http://blogs.msdn.com/b/freddyk/archive ... -java.aspx

but I when i run the the command: C:\java>wsimport -d generated -s source http://localhost:7047/DynamicsNAV/WS/SystemService i get an error that requires me to provide a user name and password, it says:

[ERROR] Server returned HTTP response code: 401 for URL: http://localhost:7047/DynamicsNAV/WS/SystemService, "http://localhost:7047/DynamicsNAV/WS/SystemService&quot; needs authorization, please provide authorization file with read access at C:\Users\developer\.metro\auth or use -Xauthfile to give the authorization file and on each line provide authorization information using this format : http://user:password@host:port//<url-path>

I may be missing out something but the blog did not specify details on how we provide authentication when this command is run so please assist me, I need to import a web reference of a Dynamics web service to my java project

Comments

  • Options
    kinekine Member Posts: 12,562
    Yes, because in the example, the command is running under standard windows user. I assume you are running it on machine which is not part of the domain and under user which is not domain user... ;-)
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    zimworxcodezimworxcode Member Posts: 53
    Thank you for the response, i get what u say. The account i am using is an Admin Account, how do i make it a domain account. I am using windows 7 home basic.
  • Options
    kinekine Member Posts: 12,562
    Windows 7 Home cannot be part of the domain. You need to use another way...

    Try to use Credential Manage in Windows 7 to save login and password for your server. Than it should use the correct login when opening the site...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    zimworxcodezimworxcode Member Posts: 53
    I have set up Windows Credentials for the login thanks to you Kine, but now i get this error when java parses the wsdl:

    [ERROR] Failed to read the WSDL document: http://localhost:7047/DynamicsNAV/WS/SystemService, because 1) could not find the document; /2) the document could not be read; 3) the root element of the document is not <wsdl:definitions>. unknown location
  • Options
    kinekine Member Posts: 12,562
    localhost?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    zimworxcodezimworxcode Member Posts: 53
    may you clarify how i should be running the wsimport command. or is it the server name which is wrong here?i have tried to google the net on this
  • Options
    kinekine Member Posts: 12,562
    I need clarify one thing: how looks your infrastructure? You are running all on one machine which is Windows 7 Home?
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • Options
    zimworxcodezimworxcode Member Posts: 53
    I have windows 7 home (i know it's not the best for developers but that is what i have currently). The application when complete will be deployed on a server with Windows 2008 but for now i need it to work on my machine jut so i see how it runs. On my machine i have installed JDK 7 early access, netbeans, microsoft dynamics 2009 R2.

    There are files that will be placed on my Windows 2008 server machine in a specified folder at random. There is a program that will be listening and logging file names of all files received in this folder. The names are passed to an nav code unit which i have exposed as a service and processing occurs.
  • Options
    kinekine Member Posts: 12,562
    Than you do not need to set the login information into credential manager. You only need to be sure that your local account is SUPER user in your local NAV database, over which the webservices are running.
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
Sign In or Register to comment.