Export Webservice consumer to disk

%REM
	Export Java Web services jars
	Created Mar 04, 2014 by Fredrik Norling
	http://www.xpagedeveloper.com/2014/calling-web-services-from-xpages
%END REM
Option Public
Option Declare

Sub Initialize
	
	On Error GoTo traperror
	Dim s As New NotesSession
	Dim db As NotesDatabase
	Set db=s.Currentdatabase
	Dim Noteid As String,NextNoteId As String,path As string
	Dim em As NotesEmbeddedObject,title As string
	Dim nc As NotesNoteCollection,ddoc As notesdocument
	Set nc=db.CreateNoteCollection(false)
	nc.Selectalldesignelements(true)
	nc.Selectionformula={@Begins($Flags;"sj34Q") & $FlagsExt="W"}
	Call nc.Buildcollection()
	If nc.Count>0 Then

		path=InputBox$("Enter the path where you want to store the jars (i.e d:\temp)")
		If path="" Then Exit Sub
	If direxists(path) Then
		If Not Right(path,1)="\" Then path=path+"\"
		NoteId=nc.Getfirstnoteid()

		Do While Not NoteId=""
				Set ddoc=db.Getdocumentbyid(Noteid)
				Title=ddoc.getitemvalue("$title")(0)
				Set em=ddoc.Getattachment("%%object%%.jar")
				em.Extractfile(path+Title+"_object.jar")
				Set em=ddoc.Getattachment("%%webserviceresource%%.jar")
				em.Extractfile(path+Title+"_Resource.jar")	
				NextNoteID=nc.Getnextnoteid(Noteid)
				NoteId=NextNoteId
		Loop
		MsgBox "Exported "+CStr(nc.Count)+" web services"
		Else
	MsgBox "Directory doesn't exists export is aborted"
End if
	End If
	Exit Sub
traperror:
	MsgBox "Error:"+Error+" line:"+CStr(Erl)
	Exit sub
End Sub
Function DirExists (strPath As String) As Boolean
   DirExists = (Dir$ (strPath ,16 ) <> "" )
End Function





Code to export webservice comsumer to disk found in Notesin9 137
http://notesin9.com/index.php/2014/03/04/notesin9-137-xpages-and-web-services/
to the blog post and the full sample database
http://www.xpagedeveloper.com/2014/calling-web-services-from-xpages

LotusScript
Fredrik Norling
March 4, 2014 2:33 PM
Rating
52

All code submitted to OpenNTF XSnippets, whether submitted as a "Snippet" or in the body of a Comment, is provided under the Apache License Version 2.0. See Terms of Use for full details.



No comments yetLogin first to comment...