Search

Mobile tag

About Me

I am the "IBM Collaboration & Productivity Advisor" for IBM Asia Pacific. I'm based in Singapore.
Reach out to me via:
Follow notessensei on Twitter
(posts)
Skype
Sametime
IBM
Facebook
LinkedIn
XING
Amazon Store
Amazon Kindle

Twitter

Domino Upgrade

VersionSupport end
5.0
6.0
6.5
7.0
8.0
8.5
Upgrade to 9.x now!
(see the full Lotus lifcyle) To make your upgrade a success use the Upgrade Cheat Sheet.
Contemplating to replace Notes? You have to read this! (also available on Slideshare)

Languages

Other languages on request.

Visitors

Useful Tools

Get Firefox
Use OpenDNS
The support for Windows XP has come to an end . Time to consider an alternative to move on.
StopTheSecrecy

« Adventures in new-z-land: Configuring LVM on zLinux | Main| SpeedTest »

Apache Axis and Sharepoint Webservices

QuickImage In preparation for Lotusphere 2011 I had to deal with SharePoint web services. While SharePoint 2010 is transitioning to oData the bulk of APIs is still web services only as in SharePoint 2003 and 2007. Inspired by Stubby and Julian's excellent explanations I decided to use Apache Axis (It's a bit outdated and one probably would use Apache CXF for flexibility today, but for my use case Axis was sufficient and lean. Now SharePoint has a lot of web service end points (I always thought you have a few and distinguish by port and service, but who am I to challenge a Microsoft architecture) you might want to use in code. Axis comes with a nice little tool called WDSL2Java to generate all the Java classes you need. Unfortunately the ServiceLocator classes have the URL where the WSDL file was retrieved from hard coded as local variable in case you call the service locator without URL.
Now I don't like the idea to have an arbitrary URL in a Java file. So I considered 2 options: edit all generated classes and replace the static string with a call to a variable or an not-implemented error -or- find a way how all these classes can be generated for every instance where one wants to use them. Then the actual/current SharePoint server name would be in the variable. I decided for the later and wrote a little script. It's a Linux script and requires that you have downloaded AXIS and made it available on the Java classpath (easiest: copy the jars to the lib/ext directory of your jvm). I also used some Linux eye candy, so you might need to adjust that for Mac or Windows. The result is a JAR file you can use in your XPages, Agent or Java project(s). Here you go:
#!/bin/bash
#/** ========================================================================= *
# * Copyright (C) 2010, 2011 IBM Singapore Pte Ltd          *
# *                            All rights reserved.                            *
# * ========================================================================== *
# *                                                                            *
# * Licensed under the  Apache License, Version 2.0  (the "License").  You may *
# * not use this file except in compliance with the License.  You may obtain a *
# * copy of the License at <http://www.apache.org/licenses/LICENSE-2.0>.       *
# *                                                                            *
# * Unless  required  by applicable  law or  agreed  to  in writing,  software *
# * distributed under the License is distributed on an  "AS IS" BASIS, WITHOUT *
# * WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied.  See the *
# * License for the  specific language  governing permissions  and limitations *
# * under the License.                                                         *
# *                                                                            *
# * ========================================================================== */
# Script to generate all Sharepoint 2010 web service sources on a Linux machine
#
# The script uses zenity, tree and notify-send which might not be part of
# your standard Linux installation (but are highly recommended)
#
loc=$( zenity --entry --text="What is your Sharepoint servers URL (without / at end!)" --entry-text="http://sharepoint");
#if $? != 0, user click on cancel button, so exit
if [ "${loc}?" == "?" ] ; then
    notify-send -t 1000 -u low -i gtk-dialog-info "Operation has been canceled"
    exit 1
fi
notify-send -t 1000 -u low -i gtk-dialog-info "Generating classes for ${loc}"

retrieve="alerts|Authentication|Copy|DspSts|DWS|ExcelService|Forms|Imaging|Lists|Meetings|People|Permissions|sharepointemailws|sites|spsearch|UserGroup|versions|Views|webpartpages|Webs"

for item in ${retrieve//|/ };
 do
  notify-send -t 100 -u low -i gtk-dialog-info "Retrieving ${loc}/_vit_bin/${item}.asmx?WSDL"
  wget $loc/_vti_bin/${item}.asmx?WSDL -O ${item}.wsdl
  java org.apache.axis.wsdl.WSDL2Java $item.wsdl -o src
done
notify-send -t 2000 -u low -i gtk-dialog-info "Compiling Java"
tree -if src | grep .java > compilelist
mkdir bin -p
javac @compilelist -d bin
jar cf sp2010ws.jar -C src . -C bin .
notify-send -t 2000 -u low -i gtk-dialog-info "Retrieval completed for: ${loc}"
As usual YMMV

Disclaimer

This site is in no way affiliated, endorsed, sanctioned, supported, nor enlightened by Lotus Software nor IBM Corporation. I may be an employee, but the opinions, theories, facts, etc. presented here are my own and are in now way given in any official capacity. In short, these are my words and this is my site, not IBM's - and don't even begin to think otherwise. (Disclaimer shamelessly plugged from Rocky Oliver)
© 2003 - 2014 Stephan H. Wissel - some rights reserved as listed here: Creative Commons License
Unless otherwise labeled by its originating author, the content found on this site is made available under the terms of an Attribution/NonCommercial/ShareAlike Creative Commons License, with the exception that no rights are granted -- since they are not mine to grant -- in any logo, graphic design, trademarks or trade names of any type. Code samples and code downloads on this site are, unless otherwise labeled, made available under an Apache 2.0 license. Other license models are available on written request and written confirmation.