Cisco offers the so called "AXL Toolkit" which allows to access functionality provided by the Cisco Unified Communications Manager (CUCM).
A WSDL-File is shipped with the toolkit. Using Eclipse, I tried to create Java-stubs out of it. But this didn't work. It says the file was inaccessible, while I'm having it right on the filesystem...
I would like to associate a phone with an application user. I have a software which does a similar stuff - but sniffing on the network isn't possible, because HTTPS is enforced for AXL-calls.
Any idea how to accomplish this?
I've finally found a tutorial, right on the Cisco website. One can use Apache Axis to transform the WSDL file to working java classes. You just have to modify the WSDL somewhat before.
Here is the information you need to get started:
Using AXL via WSDL and Java (with Axis)
Then you can just run queries against the database directly (here I'm using the AxlSqlToolkit class from the example code at the link provided):
AxlSqlToolkit ast = new AxlSqlToolkit("192.168.10.72", "admin", "admin4cisco");
String[] res = ast.executeSQL("select pkid from device");
for (String s : res) {
System.out.println(s);
}
Related
I am using Google Cloud Translate v3 API Java Client. The Java Client code samples work great. The authentication of the code samples is done using the GOOGLE_APPLICATION_CREDENTIALS environment variable.
I need to develop code that will run in an application server that I have no control over the environment variables. So I need to use another way to get the call authenticated.
Setting Up Authentication for Server to Server Production Applications, under "Passing the path to the service account key in code" has a code sample (choose the JAVA tab) that works for the Storage service, but I can't find a similar way to pass the GoogleCredentials to Translation v3 API Java Client. Does anyone know?
Also, I can't find the Java doc for v3 API. https://googleapis.dev/java/google-cloud-clients/latest/index.html shows version "0.119.0-alpha" and it does not list the package com.google.cloud.translate.v3. Is there a separate java doc page ?
I think I found a solution.
The client API javadoc doesn't list com.google.cloud.translate.v3 but it does list com.google.cloud.translate.v3beta1. In the javadoc for TranslationServiceClient, i.e. https://googleapis.dev/java/google-cloud-clients/latest/com/google/cloud/translate/v3beta1/TranslationServiceClient.html
there's a mention of setting credential, and this method worked!
TranslationServiceSettings translationServiceSettings =
TranslationServiceSettings.newBuilder()
.setCredentialsProvider(FixedCredentialsProvider.create(myCredentials))
.build();
TranslationServiceClient translationServiceClient =
TranslationServiceClient.create(translationServiceSettings);
I am trying to connect to the SharePoint from my java code. However there seems to be something is missing and I am not able to connect to the sharepoint.
I am using the below code,
NtlmAuthenticator credentials = new NtlmAuthenticator("domain", "uname", "Password");
// Initialize proxy settings
//HttpProxy httpProxy = new HttpProxy("my_system_proxy", 80);
// Connect to Sharepoint
SPSite instance = new SPSite(new URL("https://my_url/cplc/projects/Knowledge%20Share/Forms/PracticeWise.aspx"), credentials, null, true, SPVersion.SP2013);
// Get root web instance
SPWeb rootWeb = instance.getRootWeb();
// Get list of all lists and document libraries from root web
SPListCollection lists = rootWeb.getLists();
I don't know what value I should set for proxy field there.
If I don't set the proxy and send null to it, it says "401: UnAuthorised"
HTTP transport error: java.net.UnknownHostException: proxy.msa"
Update:
I am referring this,
https://code.google.com/p/java-sharepoint-library/
Can anybody please help me to proceed further?
Even if this is not the answer to the question, I want to share with you a project i've just created to help otheres to integrate with sharepoint, as the problem you are into is the same i faced when trying to integrate java apps with sharepoint online. My first approach was to create a jni wrapper of a library made with c#, but this is a headache when you have linux machines in your company, as it will not work as it is based on native dlls method invocation.
I created a simple to use sharepoint java api that hope will help others to communicate with sharepoint
https://github.com/kikovalle/PLGSharepointRestAPI-java/
Also as the full implementation of the Rest API is not covered, you can feel free to contribute to the project.
Hope this will help and be usefull to save you time struggling with sharepoint integrations.
I am trying to write a small Java client for consuming services provided by Microsoft Exchange server through Exchange Web Services (EWS). For experimenting I set up Exchange Online account from here.
Then I configured my Outlook client to use the newly created mail on exchange and outlook's Test Email Auto-Configuration windows I tried to retrieve the link for Services.wsdl for that client:
Then I tried hitting Availability Services url, entered the username and password and it opened following page:
I then tried to hit the url specified on that page for service.wsdl, but it gave Page Not Found error. SO
Q1 where will I get WSDL file, and
Q2 which link should I hit while developing Java client. In my office environment I get WSDL file over configured Exchange server which directly opens WSDL file but am guessing what should be in case of exchange online.
Q1 - The WSDL file can be downloaded from the Exchange server endpoint that you wish to hit. I don't have credentials to try this, but this should work:
https://outlook.office365.com/EWS/Services.wsdl
It's usually in the EWS directory and named Services.wsdl. I just looked at your other screenshots above and inferred the same format.
Q2 - For Office 365 (which you are testing with), Microsoft recommends this approach for manually finding the URL to hit for API calls. (Alternative much more detailed desciption here: How to get services.wsdl for Office 365?)
However building the stubs yourself and finding URLs to invoke is a lot of work that you don't have to do if you use a pre-built Java library such as Microsoft's own EWS Java API or this 3rd party library. They both do basically the same thing, which is to expose Java classes in a Jar that allow you to make calls to any Exchange server. They will also take care of automatically discovering the URL to use, if you wish (it's a feature called Autodiscover).
I am learning to make web services with eclipse, apache and axis 2 following this tutorial. I am able to generate web services, create and upload .aar files and generate web service clients just like in the tutorial. But when I go to test the client it is not generating proper responses...
PersonalInfoServiceStub stub = new PersonalInfoServiceStub();
GetContactInfo atn = new GetContactInfo();
atn.setPersonID(1);
GetContactInfoResponse c = stub.getContactInfo(atn);
System.out.println(c.get_return()); //returns null
// The Java Class that serves as the basis for the web service works well...
PersonalInfoService s = new PersonalInfoService();
System.out.println(s.getContactInfo(1).getStreet()); //returns main street
This is all very new for me (I am still pretty dependent on following the tutorial) so I am not sure what might be causing this issue or how I might go about debugging what's wrong. What might be causing the problem and how would I go about debugging it?
If I try to call the webservice in the broswer using this url:
http://localhost:8080/axis2/services/PersonalInfoService/getContactInfo?personID=1
I get this
This XML file does not appear to have any style information associated with it. The document tree is shown below.
<ns:getContactInfoResponse xmlns:ns="http://webservices.com">
<ns:return xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
</ns:getContactInfoResponse>
It looks like your client code is okay. The response from the server just doesn't contain any data. The simplest explanation is that the server sent back a response without any data. If I were you, I'd troubleshoot the server's behavior when it receives this request, rather than focusing on the client code.
I would start with Wireshark or tcpdump, this will help you capturing Network traffic that will help you debug at application and transport level what your Java code is generating and the response from server.
I have the directory mapped on my machine so that I can browse and write to it via Windows explorer. I would like to write files via java.
File f = new File("http://dev1:8080/data/xml/myTestFile123.xml");
f.createNewFile();
I am getting the following error:
Exception in thread "main" java.io.IOException: The filename, directory name, or volume label syntax is incorrect
at java.io.WinNTFileSystem.createFileExclusively(Native Method)
at java.io.File.createNewFile(Unknown Source)
at MainTest.createTestFile(MainTest.java:156)
at MainTest.main(MainTest.java:72)
Is there any way to write files to a mapped directory that has the http:// in front? Because thats the way the directory is provided to me. It is a virtual directory that an oracle database is creating.
My understanding is that you are trying to write to an Oracle XML DB Repository. Oracle XML DB Repository is a feature that has been introduced by Oracle9i Database Release 2 for XML storage and that can be accessed through FTP or HTTP/WebDAV. In your case, it looks like you're trying to use HTTP/WebDAV.
As explained in the WedDAV page on Wikipedia:
WedDAV is a set of extensions on
top of HTTP that allows users to edit
and manage files collaboratively on
remote World Wide Web servers.
In other words, adding files, deleting them, renaming them, etc in a WebDAV repository is done using HTTP words: PUT, DELETE, MOVE, etc (see RFC 4918 for more details).
Consequently, interacting with a WebDAV server can be done using classes from java.net.
Or you could use a higher level API like Jakarta Commons HttpClient.
Or you could use a Java WebDAV client like the one provided by the Slide project. This article shows how to do it and it looks simple. However, as the Slide project is now retired, I wouldn't recommend it.
Luckily (or not), the Apache Jackrabbit project is an alternative to Slide... but AFAIK the WebDAV support in Jackrabbit is more focused on server-side implementations than clients. Anyway, you'll find some code samples in this thread on the jackrabbit-users mailing list.
I think I'd choose HttpClient and use the Tutorial or the Sample Code as starting points.
I'm not really sure what I'm talking about here (not a Java guy) but although you may "have it mapped" you're passing in a URL instead of an expected file system path. If (for example) you have a mapped drive under Windows, use the drive letter assigned.
Your trying to pass the location URI with a protocol. You need to pass location sans protocol:
\\dev1\data\xml\myTestFile123.xml
Instead of trying to using a mapped drive letter (seems very weak), have a look at JCIFS:
JCIFS is an Open Source client library that implements the CIFS/SMB networking protocol in 100% Java. CIFS is the standard file sharing protocol on the Microsoft Windows platform (e.g. Map Network Drive ...). This client is used extensively in production on large Intranets.
This piece of code shows how to Logon to a Remote Machine and Write File using jCifs (credits to Muneeb Ahmad):
import jcifs.smb.NtlmPasswordAuthentication;
import jcifs.smb.SmbFile;
import jcifs.smb.SmbFileOutputStream;
public class Logon {
public static void main( String argv[] ) throws Exception {
String user = "user:password";
NtlmPasswordAuthentication auth = new NtlmPasswordAuthentication(user);
String path = "smb://my_machine_name/D/MyDev/test.txt";
SmbFile sFile = new SmbFile(path, auth);
SmbFileOutputStream sfos = new SmbFileOutputStream(sFile);
sfos.write("Muneeb Ahmad".getBytes());
System.out.println("Done");
}
}
Edit: As mentioned in a comment added to the original question, my understanding is now that you are trying to write to a WebDAV directory. I'll cover the WebDAV topic in another answer for more clarity.
How have you mapped the file in Windows? I suspect it is not using the HTTP protocol, because no such mechanism exists for creating files. So you will not get anywhere using "http" as your protocol.
Find the mapped drive letter, you probably want something more like:
File f = new File("F:\\dir\\file.ext");
If you are using Samba you might want to take a look at JCIFS then you can use:
smb://server/share/
Use the local path
If you can see myTestFile123.xml in windows explorer, then right-click it and copy the Location: property value. Then use exactly this as the new File() argument, but either double up the backslashes or change them to forward slashes.