XMLSocket.onConnect - success is false?
I'm using Flash MX 2004 and i've written a sample socket
server in php. it responds when i telnet in from everywhere:
* using telnet from the Win XP command line from my desktop
* using raw telnet from puTTY from my desktop
* using telnet from the linux command line on the server
flash, however won't let me connect with and XMLSocket.
XMLSocket.connect returns true but my onConnect function always
receives success=false. I CANNOT FIGURE OUT WHY. How do i figure
out what the problem is?
Here's my actionscript:
var host:String = 'mydomain.com';
var port:Number = 1234;
mySock = new XMLSocket();
mySock.onConnect = function(success) {
trace('this is my anonymous onConnect function');
trace(' success:' + success);
mySock.send('foobar is what i sent');
trace('here we go, connecting to ' + host + ":" + port);
var foo = mySock.connect(host, port);
trace('connect attempted, foo is ' + foo);
mySock.close();
the trace results are this:
===trace===
here we go, connecting to mydomain.com:1234
connect attempted, foo is true
this is my anonymous onConnect function
success:false
===trace===
How on earth do I figure out what this false results is for?
I have put the following crossdomain.xml file at the root of
mydomain.com:
===crossdomain.xml===
<?xml version="1.0"?>
<!DOCTYPE cross-domain-policy SYSTEM
http://www.macromedia.com/xml/dtds/cross-domain-policy.dtd">
<!-- Policy file for
http://www.mysite.com -->
<cross-domain-policy>
<allow-access-from domain="*" />
</cross-domain-policy>
===/crossdomain.xml===
I have also tried uninstalling flash player 9 and installing
he debug version instead. the trace statements end up in
flashlog.txt but this directive is totally ignored apparently:
SecurityDialogReportingEnable = true
I never get any security message or anything. I'm totally
mystified.
ALRIGHTY THEN. Thanks so much to all of your for helping so
much.
Given the resounding silence at this very very simple
request, I suppose I must resort to a packet sniffer. I'll report
back when I know more.
Similar Messages
-
Hi
I've got a problem validating date by SimpleDateFormat. Format "yyyy" successfully parses string like "2009-78" into date 01.01.2009. Can you please help me with it?
Here is my code:
SimpleDateFormat format = new SimpleDateFormat("yyyy");
format.setLenient(false);
String dateStr = "2009-78";
Date date;
try {
date = format.parse(dateStr);
} catch (ParseException e) {
date = null;
e.printStackTrace();
System.out.println(String.format("String '%s' parsed to date %s", dateStr, date));Output:
String '2009-78' parsed to date Thu Jan 01 00:00:00 MSK 2009I need an exception to be thrown in such situation. How can I check where the string represents a correct date?
Thanks for your help.
Evgeny
Edited by: su.eug on Apr 13, 2009 12:56 AMRead the comments in the API:
[http://java.sun.com/javase/6/docs/api/java/text/DateFormat.html#parse(java.lang.String)|http://java.sun.com/javase/6/docs/api/java/text/DateFormat.html#parse(java.lang.String)]
You could try the other overload of parse, if you want to test whether the whole String was used:
[http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#parse(java.lang.String, java.text.ParsePosition)|http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html#parse(java.lang.String,%20java.text.ParsePosition)]
(Sorry--the second link doesn't go to the right place. There is a version of "parse" with two parameters, which you can use to determine if the whole String was used.) -
XMLSocket on Windows Mobile - no data send and onConnect not entered
Hi,
I'm developing a FlashLite 2.1 application and try to communicat with the host device (WiMo) through a XMLSocket to write some data to the disk.
I have the following code in the FL-App:
xmlSocket = new XMLSocket();
xmlSocket.onConnect = function(success:Boolean)
fscommand("Launch", "\\...\\FileEditor.exe,Success=" + success);
if (success)
LearnLogic.Current.xmlSocket.send(LearnLogic.Current.Message.toString());
else
LearnLogic.Current._cardBox[_cardIds[_currentCardIndex]] = 10;
var connected:Boolean = xmlSocket.connect("127.0.0.1", 8181);
fscommand("Launch", "\\...\\FileEditor.exe,Connected=" + connected);
xmlSocket.send(Message.toString());
xmlSocket.close();
The File Editor simply writes the Argument to a log file and I get the "Connected=true" in the log, but not the "Success=xxx" and on the host application (C#) I got a connection but no data is submitted (Client.Available stays 0).
What can I do to fix that problem or is there an easier way to edit files on the phone?
regardsHi,
my file editor is a console application, so it has no window which can come to the foreground and I already have a Launch command inside the onConnect Handler which get never called (=no etry in the log file)...
regards -
In Javascript or PHP you can have a function that could return, for example, a string in case of success and false in case of failure.
I've noticed (in the few days I've been learning C#) that you need to define a type of value that the function will return, so you need to return that type of value but in case of failure you can't return false.
What is the best way to achieve this behavior and is there an example I can see?
Thank you in advance,
JuanJuan, be aware that returning null won't work with value types, such as an int, which can't be null. You'd have to use a nullable value type. A nullable int would be declared with a "?", such as:
int? someOtherFunction(int param)
if(something goes great)
return param * 42;
return null;
And you have to use it like this:
int? result = someOtherFunction(666);
if (result != null) // you can also use result.HasValue
// it worked, do something with the result
// if you're doing math with the result, no problem
int x = result * 2;
// but if you're assigning it to another an int, you need to use this syntax
int y = result.Value;
Before nullable value types came along, for a method that returned an int, I'd use a value of something that wouldn't normally be returned by that method to indicate failure, such as a -1.
~~Bonnie DeWitt [C# MVP]
That's something very very important to keep in mind. Can save you from a lot of headaches!
So if you have an int function and it might return NULL, if you are doing Math with the return value you can use it directly, but if you're assigning it to another variable you have to use .Value?
Thanks -
XMLSocket to localhost problem
Hello!
Doe anyone have experience with XMLSockets that have to connect to the localhost (or 127.0.0.1)?
My flash application can connect to all other servers but not to the server the flash app resides on.
The server accepts the socket but in flash the onConnect event has "false" as parameter. If I ignore this and start sending anyway, sometimes the data is send to the server.
I run windows CE6.0 R3 with flash lite 3.1.
Any Idea's?
Thanks,
John.Hi,
don't know if it helps still, but i am using XMLSocket on Symbian: my FlashLite code accesses an natice C++ http server, using XMLSOckets.
It works quite well, however i had some small tunings to do:
* XML form (the one which is sent over to the server) has to terminate by '\0'. My code is adding an addtioanla '\0\ at the end, both on the FL code and on the server code
* Of course, you have to publish your FL as "netwrok access"
* .... and also to solve all the security problems (i.e. either crossdomain, or using Trusted subdir).
Voila, not sure how much of ti applies to your plateform !
Jacques. -
SharePoint 2013 event receiver error
I am currently working on a SharePoint online project. I am facing a strange issue. My code generates 6 documents
in 6 different document libraries along with other metadata. When I save data to a List, the event receiver fires and creates all the 6 documents. But sometimes it stops creating the 6 documents and left with 1 or 2 documents. Sometimes documents has been
created but without any metadata. The same code is working fine in my on-premises environment, but it sometimes breaks in the Office 365 environment. I also created a log list to track the issue as we cannot debug in Office 365. In the log list I found a error
message saying "Thread was being aborted." Below is my code. please help it is happening only in Office 365 environment.
using Microsoft.SharePoint;
/// <summary>
/// List Item Events
/// </summary>
public class ExcelGenReceiver : SPItemEventReceiver
/// <summary>
/// The template URL
/// </summary>
private const string TemplateUrl = "/Quotation Analysis Electrical/Forms/Quotation Analysis Sheet ELEC_Blank.xlsm";
/// <summary>
/// The template url1
/// </summary>
private const string TemplateUrl1 = "/Quotation Analysis Mechanical/Forms/Quotation Analysis Sheet MECH_Blank.xlsm";
/// <summary>
/// The template url2
/// </summary>
private const string TemplateUrl2 = "/TenderSummaryLib/Forms/TenderSummaryBlankMaster1.xlsm";
/// <summary>
/// The RFI template URL
/// </summary>
private const string RfiTemplateUrl = "/EstimatingRFI/Forms/RFI Schedule MASTER.docx";
/// <summary>
/// The drawing template URL
/// </summary>
private const string DrawingTemplateUrl = "/Tender and Drawing Schedule/Forms/Tender Document Drawing Schedule.docx";
/// <summary>
/// The tender return template URL
/// </summary>
private const string TenderReturnTemplateUrl = "/Est_Tender_Pricing_Document/Forms/Tender Pricing Document blank.xlsm";
/// <summary>
/// The project number
/// </summary>
private string projectNumber = string.Empty;
/// <summary>
/// The project name
/// </summary>
private string projectName = string.Empty;
/// <summary>
/// The no bid
/// </summary>
private string noBid;
/// <summary>
/// The team
/// </summary>
private string team;
/// <summary>
/// The description
/// </summary>
private string description;
/// <summary>
/// The status
/// </summary>
private string status;
/// <summary>
/// The electrical
/// </summary>
private SPUser electrical;
/// <summary>
/// The mechanical
/// </summary>
private SPUser mechanical;
/// <summary>
/// The document date
/// </summary>
private DateTime? docDate;
/// <summary>
/// The tender received
/// </summary>
private DateTime? tenderReceived;
/// <summary>
/// The tender return
/// </summary>
private DateTime? tenderReturn;
/// <summary>
/// The pre construction program start date
/// </summary>
private DateTime? preConstructionProgramStart;
/// <summary>
/// The pre construction program end date
/// </summary>
private DateTime? preConstructionProgramEnd;
/// <summary>
/// The sector
/// </summary>
private string sector;
/// <summary>
/// The design build
/// </summary>
private string designBuild;
/// <summary>
/// The build type
/// </summary>
private string buildType;
/// <summary>
/// The service program start date
/// </summary>
private DateTime? serviceProgramStart;
/// <summary>
/// The service program completion date
/// </summary>
private DateTime? serviceProgramCompletion;
/// <summary>
/// The client1
/// </summary>
private string client1;
/// <summary>
/// The client2
/// </summary>
private string client2;
/// <summary>
/// The client3
/// </summary>
private string client3;
/// <summary>
/// The client4
/// </summary>
private string client4;
/// <summary>
/// The consultant
/// </summary>
private string consultant;
/// <summary>
/// An item is being added.
/// </summary>
/// <param name="properties">The Item Event properties</param>
public override void ItemAdded(SPItemEventProperties properties)
//this.EventFiringEnabled = false;
var web = properties.Web;
var listItem = properties.ListItem;
try
LogIssue(web, null, "Item Added", "List Item Id {0}", listItem.ID);
if (!this.AttemptCopyProcess(listItem))
LogIssue(web, null, "List Id : " + listItem.ID, "AttemptCopyProcess failed.");
catch (Exception ex)
LogIssue(web, ex, "List Id : " + listItem.ID, "AttemptCopyProcess failed.");
finally
//this.EventFiringEnabled = true;
LogIssue(web, null, "List Id : " + listItem.ID, "Event Receiver completed sucessfully.");
/// <summary>
/// Logs any issues found
/// </summary>
/// <param name="webContext">The web context.</param>
/// <param name="exception">The exception, if null not exception details are written</param>
/// <param name="contextId">The context identifier, a unique identifier that allows us to know where the call originated, i.e. a List and ListItem Id, or a Page Url</param>
/// <param name="comment">The comment.</param>
/// <param name="args">The arguments.</param>
private static void LogIssue(SPWeb webContext, Exception exception, string contextId, string comment, params object[] args)
//// if (webContext.AllProperties.ContainsKey("EnableLogging"))
var list = webContext.Lists.TryGetList("ErrorIssues");
if (list != null)
var item = list.AddItem();
item["Title"] = contextId;
if (exception != null)
item["Message"] = exception.Message;
item["InnerException"] = exception.InnerException ?? (object)string.Empty;
item["StackTrace"] = exception.StackTrace;
if (!string.IsNullOrEmpty(comment))
item["Comment"] = string.Format(comment, args);
item.Update();
/// <summary>
/// Assigns the field.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>The fields string value if present, otherwise string.empty.</returns>
private static string AssignField(SPListItem listItem, string fieldName, string contextId)
var fieldValue = string.Empty;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
fieldValue = listItem[fieldName].ToString();
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return fieldValue;
/// <summary>
/// Assigns the field as a DateTime
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>Returns the date if found, otherwise returns DateTime.MinValue</returns>
private static DateTime? AssignDateField(SPListItem listItem, string fieldName, string contextId)
DateTime? fieldValue = null;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
fieldValue = Convert.ToDateTime(listItem[fieldName].ToString());
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return fieldValue;
/// <summary>
/// Creates the folder.
/// </summary>
/// <param name="listdoc">The list.</param>
/// <param name="folderName">Name of the folder.</param>
private static void CreateFolder(SPList listdoc, string folderName)
LogIssue(listdoc.ParentWeb, null, "List Id : " + listdoc.ID, "Creating folder {0} in {1}", folderName, listdoc.RootFolder.ServerRelativeUrl);
// Updated by Indusnet
SPListItem folder1 = listdoc.Items.Add(listdoc.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder);
folder1["Name"] = folderName;
folder1.Update();
listdoc.Update();
// End Updated
/// <summary>
/// Assigns the user field.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>Returns the user if found, otherwise null.</returns>
private static SPUser AssignUserField(SPListItem listItem, string fieldName, string contextId)
SPUser user = null;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
var userField = (SPFieldUser)listItem.Fields.GetField(fieldName);
var fieldValue = (SPFieldUserValue)userField.GetFieldValue(listItem["electrical_proj_manager"].ToString());
user = fieldValue.User;
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return user;
/// <summary>
/// Attempts the copy process.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <returns>True if it successfully processed, false otherwise.</returns>
private bool AttemptCopyProcess(SPListItem listItem)
if (listItem.ParentList.Title != "Enquiry_Template")
LogIssue(listItem.Web, null, "List Id : " + listItem.ID, "ListItem titles is not Enquiry_Template, aborting.");
return false;
var finalNum = "15-" + new Random().Next(0, 9999).ToString("D4");
this.Initialize(listItem, finalNum);
if (this.noBid != "Yes")
LogIssue(listItem.Web, null, "List Id : " + listItem.ID, "The noBid field does not equal Yes, aborting.");
return false;
this.CopyFiles(listItem.Web, finalNum);
this.CreateFolders(listItem.Web);
return true;
/// <summary>
/// Copies the files.
/// </summary>
/// <param name="web">The web.</param>
/// <param name="finalNum">The final number.</param>
private void CopyFiles(SPWeb web, string finalNum)
LogIssue(web, null, "Web Id : " + web.ID, "Setting the copying of files ...");
var mechanicalQuoteList = web.Lists["Quotation Analysis Mechanical"];
var electricalQuoteList = web.Lists["Quotation Analysis Electrical"];
var tenderSummarList = web.Lists["TenderSummaryLib"];
var estimatingList = web.Lists["EstimatingRFI"];
var tenderSheduleList = web.Lists["Tender and Drawing Schedule"];
var tenderPricingList = web.Lists["Est_Tender_Pricing_Document"];
var url1 = mechanicalQuoteList.RootFolder.ServerRelativeUrl;
var url = electricalQuoteList.RootFolder.ServerRelativeUrl;
var url2 = tenderSummarList.RootFolder.ServerRelativeUrl;
var urlA = estimatingList.RootFolder.ServerRelativeUrl;
var urlB = tenderSheduleList.RootFolder.ServerRelativeUrl;
var urlC = tenderPricingList.RootFolder.ServerRelativeUrl;
var foldername1 = string.Empty;
var foldername = string.Empty;
var foldername2 = string.Empty;
var foldernameA = string.Empty;
var foldernameB = string.Empty;
var foldernameC = string.Empty;
var folder1 = web.Folders[url1 + "/" + foldername1];
var folder = web.Folders[url + "/" + foldername];
var folder2 = web.Folders[url2 + "/" + foldername2];
var folderA = web.Folders[urlA + "/" + foldernameA];
var folderB = web.Folders[urlB + "/" + foldernameB];
var folderC = web.Folders[urlC + "/" + foldernameC];
if (!folder1.Exists && !folder.Exists && !folder2.Exists && !folderA.Exists && !folderB.Exists && !folderC.Exists)
var folders1 = web.GetFolder(url1).SubFolders;
var folders = web.GetFolder(url).SubFolders;
var folders2 = web.GetFolder(url2).SubFolders;
var foldersA = web.GetFolder(urlA).SubFolders;
var foldersB = web.GetFolder(urlB).SubFolders;
var foldersC = web.GetFolder(urlC).SubFolders;
folders1.Add(foldername1);
folders.Add(foldername);
folders2.Add(foldername2);
foldersA.Add(foldernameA);
foldersB.Add(foldernameB);
foldersC.Add(foldernameC);
var file1 = web.GetFile(web.Site.Url + TemplateUrl1);
var file = web.GetFile(web.Site.Url + TemplateUrl);
var file2 = web.GetFile(web.Site.Url + TemplateUrl2);
var fileA = web.GetFile(web.Site.Url + RfiTemplateUrl);
var fileB = web.GetFile(web.Site.Url + DrawingTemplateUrl);
var fileC = web.GetFile(web.Site.Url + TenderReturnTemplateUrl);
if (file1 != null && file != null && file2 != null && fileA != null && fileB != null && fileC != null)
var fileName = string.Format("{0}/{1}{2}", folder1.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 1 {0} to {1}...", file1.Name, fileName);
var byteArray1 = file1.OpenBinary();
var uploadedFile1 = folder1.Files.Add(fileName, byteArray1, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 1 Uploaded with new ID of {0}", uploadedFile1.Item.ID);
this.EventFiringEnabled = false;
var listitem1 = uploadedFile1.Item;
listitem1["Name"] = this.projectName;
listitem1["EnquiryNo"] = finalNum;
listitem1["Project_Name"] = this.projectName;
listitem1["Tender_Received"] = this.tenderReceived;
listitem1["Tender_Return"] = this.tenderReturn;
listitem1["Quotation_Analysis_Mech_Url"] = "https://groupportal.sharepoint.com/sites/EnginSouth/Quotation%20Analysis%20Mechanical/Forms/DispForm.aspx?ID=" + listitem1.ID;
listitem1.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 1.");
fileName = string.Format("{0}/{1}{2}", folder.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 2 {0} to {1}...", file.Name, fileName);
var byteArray = file.OpenBinary();
var uploadedFile = folder.Files.Add(fileName, byteArray, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 2 Uploaded with new ID of {0}", uploadedFile.Item.ID);
this.EventFiringEnabled = false;
var listitem = uploadedFile.Item;
listitem["Name"] = this.projectName;
listitem["EnquiryNo"] = finalNum;
listitem["Project_Name"] = this.projectName;
listitem["Tender_Received"] = this.tenderReceived;
listitem["Tender_Return"] = this.tenderReturn;
listitem["Quotation_Analysis_Elec_Url"] = "https://groupportal.sharepoint.com/sites/EnginSouth/Quotation%20Analysis%20Electrical/Forms/DispForm.aspx?ID=" + listitem.ID;
listitem.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 2.");
fileName = string.Format("{0}/{1}{2}", folderA.ServerRelativeUrl, this.projectName, ".docx");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 3 {0} to {1}...", fileA.Name, fileName);
var byteArrayA = fileA.OpenBinary();
var uploadedFileA = folderA.Files.Add(fileName, byteArrayA, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 3 Uploaded with new ID of {0}", uploadedFileA.Item.ID);
this.EventFiringEnabled = false;
var listitemA = uploadedFileA.Item;
listitemA["Name"] = this.projectName;
listitemA["EnquiryNo"] = finalNum;
listitemA["Project_Name"] = this.projectName;
listitemA["Date"] = this.docDate;
listitemA["Description"] = this.description;
listitemA["ProjectNo"] = this.projectNumber;
listitemA["RFIUrl"] = "https://groupportal.sharepoint.com/sites/EnginSouth/EstimatingRFI/Forms/DispForm.aspx?ID=" + listitemA.ID;
listitemA.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 3.");
fileName = string.Format("{0}/{1}{2}", folderB.ServerRelativeUrl, this.projectName, ".docx");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 4 {0} to {1}...", fileB.Name, fileName);
var byteArrayB = fileB.OpenBinary();
var uploadedFileB = folderB.Files.Add(fileName, byteArrayB, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 4 Uploaded with new ID of {0}", uploadedFileB.Item.ID);
this.EventFiringEnabled = false;
var listitemB = uploadedFileB.Item;
listitemB["Name"] = this.projectName;
listitemB["EnquiryNo"] = finalNum;
listitemB["Project_Name"] = this.projectName;
listitemB["Date"] = this.docDate;
listitemB["Description"] = this.description;
listitemB["ProjectNo"] = this.projectNumber;
listitemB["DrawingURL"] = "https://groupportal.sharepoint.com/sites/EnginSouth/Tender%20and%20Drawing%20Schedule/Forms/DispForm.aspx?ID=" + listitemB.ID;
listitemB.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 4.");
fileName = string.Format("{0}/{1}{2}", folderC.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 5 {0} to {1}...", fileC.Name, fileName);
var byteArrayC = fileC.OpenBinary();
var uploadedFileC = folderC.Files.Add(fileName, byteArrayC, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 5 Uploaded with new ID of {0}", uploadedFileC.Item.ID);
this.EventFiringEnabled = false;
var listitemC = uploadedFileC.Item;
listitemC["Name"] = this.projectName;
listitemC["EnquiryNo"] = finalNum;
listitemC["Project_Name"] = this.projectName;
listitemC["Date"] = this.docDate;
listitemC["Description"] = this.description;
listitemC["ProjectNo"] = this.projectNumber;
listitemC["PricingURL"] = "https://groupportal.sharepoint.com/sites/EnginSouth/Est_Tender_Pricing_Document/Forms/DispForm.aspx?ID=" + listitemC.ID;
listitemC.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 5.");
fileName = string.Format("{0}/{1}{2}", folder2.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 5 {0} to {1}...", file2.Name, fileName);
var byteArray2 = file2.OpenBinary();
var uploadedFile2 = folder2.Files.Add(fileName, byteArray2, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 6 Uploaded with new ID of {0}", uploadedFile2.Item.ID);
this.EventFiringEnabled = false;
var listitem2 = uploadedFile2.Item;
listitem2["Name"] = this.projectName;
listitem2["EnquiryNo"] = finalNum;
listitem2["Project_Name"] = this.projectName;
listitem2["Date"] = this.docDate;
listitem2["Team"] = this.team;
listitem2["Estimator_Electrical"] = this.electrical;
listitem2["Estimator_Mechanical"] = this.mechanical;
listitem2["Status"] = this.status;
listitem2["Tender_Received"] = this.tenderReceived;
listitem2["Tender_Return"] = this.tenderReturn;
listitem2["Sector"] = this.sector;
listitem2["Design_Build"] = this.designBuild;
listitem2["Build_Type"] = this.buildType;
listitem2["Service_Prog_Start"] = this.serviceProgramStart;
listitem2["Service_Prog_Completion"] = this.serviceProgramCompletion;
listitem2["Client_1"] = this.client1;
listitem2["Client_2"] = this.client2;
listitem2["Client_3"] = this.client3;
listitem2["Client_4"] = this.client4;
listitem2["Consultant"] = this.consultant;
listitem2["Pre-construction_Prog_Start"] = this.preConstructionProgramStart;
listitem2["Pre-construction_Prog_End"] = this.preConstructionProgramEnd;
listitem2["Tender_Summary_Url"] = "https://groupportal.sharepoint.com/sites/EnginSouth/TenderSummaryLib/Forms/DispForm.aspx?ID=" + listitem2.ID;
listitem2.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 6.");
/// <summary>
/// Creates the folders.
/// </summary>
/// <param name="web">The web.</param>
private void CreateFolders(SPWeb web)
var projectListId = web.Lists.Add(this.projectName.Replace(' ', '_'), string.Empty, SPListTemplateType.DocumentLibrary);
var projectList = web.Lists[projectListId];
projectList.OnQuickLaunch = true; // The document library will appear in Quick Launch bar.
CreateFolder(projectList, "1.Tender Documents");
CreateFolder(projectList, "2. Electrical");
CreateFolder(projectList, "3. Mechanical");
CreateFolder(projectList, "4. Correspondance");
CreateFolder(projectList, "5. Settlement Meeting Docs");
CreateFolder(projectList, "6. Tender Return Docs");
CreateFolder(projectList, "7. Tender Handover");
projectList.Update();
/// <summary>
/// Initializes the specified list item.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="finalNum">The final number.</param>
private void Initialize(SPListItem listItem, string finalNum)
var contextId = string.Format("List:{0}, Id:{1}", listItem.ParentList.Title, listItem.ID);
this.noBid = AssignField(listItem, "Bid", contextId);
this.projectName = AssignField(listItem, "Project_Name", contextId);
var teamlookup = AssignField(listItem, "Team", contextId);
var lookupParts = teamlookup.Split(new[] { ";#" }, StringSplitOptions.None);
this.team = lookupParts[1];
this.description = AssignField(listItem, "Description", contextId);
this.status = AssignField(listItem, "enquiry_status", contextId);
this.electrical = AssignUserField(listItem, "electrical_proj_manager", contextId);
this.mechanical = AssignUserField(listItem, "mechanical_proj_manager", contextId);
this.docDate = AssignDateField(listItem, "Date", contextId);
this.tenderReceived = AssignDateField(listItem, "Tender_Received", contextId);
this.tenderReturn = AssignDateField(listItem, "Tender_Return", contextId);
this.preConstructionProgramStart = AssignDateField(listItem, "Pre-construction_Prog_Start", contextId);
this.preConstructionProgramEnd = AssignDateField(listItem, "Pre-construction_Prog_End", contextId);
this.sector = AssignField(listItem, "Sector", contextId);
this.designBuild = AssignField(listItem, "Design_Build", contextId);
this.buildType = AssignField(listItem, "Build_Type", contextId);
this.serviceProgramStart = AssignDateField(listItem, "Service_Prog_Start", contextId);
this.serviceProgramCompletion = AssignDateField(listItem, "Service_Prog_Completion", contextId);
this.client1 = AssignField(listItem, "Client_1", contextId);
this.client2 = AssignField(listItem, "Client_2", contextId);
this.client3 = AssignField(listItem, "Client_3", contextId);
this.client4 = AssignField(listItem, "Client_4", contextId);
this.consultant = AssignField(listItem, "Consultant", contextId);
if (this.status == "Won")
this.projectNumber = string.Format("15-{0}-{1}", this.team, new Random().Next(0, 9999).ToString("D4"));
if (this.status == "Active" || this.status == "Closed")
this.projectNumber = "No Project No";
listItem["ProjectNo"] = this.projectNumber;
listItem["EnquiryNo"] = finalNum;
listItem.Web.AllowUnsafeUpdates = true;
listItem.SystemUpdate(false);Hi,
In this forum we mainly discuss questions and feedbacks about Office client products, as your question is about SharePoint 2013, I suggest you post this thread in SharePoint forum:
https://social.technet.microsoft.com/Forums/office/en-US/home?category=sharepoint
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
Melon Chen
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
SharePoint online 2013 event receiver error
I am currently working on a SharePoint online project. My code generates 6 documents in 6 different document libraries along with other metadata. When I save data to a List, the event receiver fires and creates all the 6 documents. But sometimes it stops creating
the 6 documents and left with 1 or 2 documents. Sometimes documents has been created but without any metadata.
The same code is working fine in my on-premises environment, but it sometimes breaks in the Office 365 environment. I also created a log list to track the issue as we cannot debug in Office 365. In the log list I found a error message saying "Thread was
being aborted." Below is my code. please help it is happening only in Office 365 environment.
namespace ExcelGen.ExcelGenReceiver
using System;
using Microsoft.SharePoint;
/// <summary>
/// List Item Events
/// </summary>
public class ExcelGenReceiver : SPItemEventReceiver
/// <summary>
/// The template URL
/// </summary>
private const string TemplateUrl = "/Quotation Analysis Electrical/Forms/Quotation Analysis Sheet ELEC_Blank.xlsm";
/// <summary>
/// The template url1
/// </summary>
private const string TemplateUrl1 = "/Quotation Analysis Mechanical/Forms/Quotation Analysis Sheet MECH_Blank.xlsm";
/// <summary>
/// The template url2
/// </summary>
private const string TemplateUrl2 = "/TenderSummaryLib/Forms/TenderSummaryBlankMaster1.xlsm";
/// <summary>
/// The RFI template URL
/// </summary>
private const string RfiTemplateUrl = "/EstimatingRFI/Forms/RFI Schedule MASTER.docx";
/// <summary>
/// The drawing template URL
/// </summary>
private const string DrawingTemplateUrl = "/Tender and Drawing Schedule/Forms/Tender Document Drawing Schedule.docx";
/// <summary>
/// The tender return template URL
/// </summary>
private const string TenderReturnTemplateUrl = "/Est_Tender_Pricing_Document/Forms/Tender Pricing Document blank.xlsm";
/// <summary>
/// The project number
/// </summary>
private string projectNumber = string.Empty;
/// <summary>
/// The project name
/// </summary>
private string projectName = string.Empty;
/// <summary>
/// The no bid
/// </summary>
private string noBid;
/// <summary>
/// The team
/// </summary>
private string team;
/// <summary>
/// The description
/// </summary>
private string description;
/// <summary>
/// The status
/// </summary>
private string status;
/// <summary>
/// The electrical
/// </summary>
private SPUser electrical;
/// <summary>
/// The mechanical
/// </summary>
private SPUser mechanical;
/// <summary>
/// The document date
/// </summary>
private DateTime? docDate;
/// <summary>
/// The tender received
/// </summary>
private DateTime? tenderReceived;
/// <summary>
/// The tender return
/// </summary>
private DateTime? tenderReturn;
/// <summary>
/// The pre construction program start date
/// </summary>
private DateTime? preConstructionProgramStart;
/// <summary>
/// The pre construction program end date
/// </summary>
private DateTime? preConstructionProgramEnd;
/// <summary>
/// The sector
/// </summary>
private string sector;
/// <summary>
/// The design build
/// </summary>
private string designBuild;
/// <summary>
/// The build type
/// </summary>
private string buildType;
/// <summary>
/// The service program start date
/// </summary>
private DateTime? serviceProgramStart;
/// <summary>
/// The service program completion date
/// </summary>
private DateTime? serviceProgramCompletion;
/// <summary>
/// The client1
/// </summary>
private string client1;
/// <summary>
/// The client2
/// </summary>
private string client2;
/// <summary>
/// The client3
/// </summary>
private string client3;
/// <summary>
/// The client4
/// </summary>
private string client4;
/// <summary>
/// The consultant
/// </summary>
private string consultant;
/// <summary>
/// An item is being added.
/// </summary>
/// <param name="properties">The Item Event properties</param>
public override void ItemAdded(SPItemEventProperties properties)
//this.EventFiringEnabled = false;
var web = properties.Web;
var listItem = properties.ListItem;
try
LogIssue(web, null, "Item Added", "List Item Id {0}", listItem.ID);
if (!this.AttemptCopyProcess(listItem))
LogIssue(web, null, "List Id : " + listItem.ID, "AttemptCopyProcess failed.");
catch (Exception ex)
LogIssue(web, ex, "List Id : " + listItem.ID, "AttemptCopyProcess failed.");
finally
//this.EventFiringEnabled = true;
LogIssue(web, null, "List Id : " + listItem.ID, "Event Receiver completed sucessfully.");
/// <summary>
/// Logs any issues found
/// </summary>
/// <param name="webContext">The web context.</param>
/// <param name="exception">The exception, if null not exception details are written</param>
/// <param name="contextId">The context identifier, a unique identifier that allows us to know where the call originated, i.e. a List and ListItem Id, or a Page Url</param>
/// <param name="comment">The comment.</param>
/// <param name="args">The arguments.</param>
private static void LogIssue(SPWeb webContext, Exception exception, string contextId, string comment, params object[] args)
//// if (webContext.AllProperties.ContainsKey("EnableLogging"))
var list = webContext.Lists.TryGetList("ErrorIssues");
if (list != null)
var item = list.AddItem();
item["Title"] = contextId;
if (exception != null)
item["Message"] = exception.Message;
item["InnerException"] = exception.InnerException ?? (object)string.Empty;
item["StackTrace"] = exception.StackTrace;
if (!string.IsNullOrEmpty(comment))
item["Comment"] = string.Format(comment, args);
item.Update();
/// <summary>
/// Assigns the field.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>The fields string value if present, otherwise string.empty.</returns>
private static string AssignField(SPListItem listItem, string fieldName, string contextId)
var fieldValue = string.Empty;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
fieldValue = listItem[fieldName].ToString();
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return fieldValue;
/// <summary>
/// Assigns the field as a DateTime
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>Returns the date if found, otherwise returns DateTime.MinValue</returns>
private static DateTime? AssignDateField(SPListItem listItem, string fieldName, string contextId)
DateTime? fieldValue = null;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
fieldValue = Convert.ToDateTime(listItem[fieldName].ToString());
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return fieldValue;
/// <summary>
/// Creates the folder.
/// </summary>
/// <param name="listdoc">The list.</param>
/// <param name="folderName">Name of the folder.</param>
private static void CreateFolder(SPList listdoc, string folderName)
LogIssue(listdoc.ParentWeb, null, "List Id : " + listdoc.ID, "Creating folder {0} in {1}", folderName, listdoc.RootFolder.ServerRelativeUrl);
// Updated by Indusnet
SPListItem folder1 = listdoc.Items.Add(listdoc.RootFolder.ServerRelativeUrl, SPFileSystemObjectType.Folder);
folder1["Name"] = folderName;
folder1.Update();
listdoc.Update();
// End Updated
/// <summary>
/// Assigns the user field.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="fieldName">Name of the field.</param>
/// <param name="contextId">The context identifier.</param>
/// <returns>Returns the user if found, otherwise null.</returns>
private static SPUser AssignUserField(SPListItem listItem, string fieldName, string contextId)
SPUser user = null;
if (listItem.Fields.ContainsField(fieldName) && listItem[fieldName] != null)
var userField = (SPFieldUser)listItem.Fields.GetField(fieldName);
var fieldValue = (SPFieldUserValue)userField.GetFieldValue(listItem["electrical_proj_manager"].ToString());
user = fieldValue.User;
else
LogIssue(listItem.Web, null, contextId, string.Format("Field not available : {0}", fieldName));
return user;
/// <summary>
/// Attempts the copy process.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <returns>True if it successfully processed, false otherwise.</returns>
private bool AttemptCopyProcess(SPListItem listItem)
if (listItem.ParentList.Title != "Enquiry_Template")
LogIssue(listItem.Web, null, "List Id : " + listItem.ID, "ListItem titles is not Enquiry_Template, aborting.");
return false;
var finalNum = "15-" + new Random().Next(0, 9999).ToString("D4");
this.Initialize(listItem, finalNum);
if (this.noBid != "Yes")
LogIssue(listItem.Web, null, "List Id : " + listItem.ID, "The noBid field does not equal Yes, aborting.");
return false;
this.CopyFiles(listItem.Web, finalNum);
this.CreateFolders(listItem.Web);
return true;
/// <summary>
/// Copies the files.
/// </summary>
/// <param name="web">The web.</param>
/// <param name="finalNum">The final number.</param>
private void CopyFiles(SPWeb web, string finalNum)
LogIssue(web, null, "Web Id : " + web.ID, "Setting the copying of files ...");
var mechanicalQuoteList = web.Lists["Quotation Analysis Mechanical"];
var electricalQuoteList = web.Lists["Quotation Analysis Electrical"];
var tenderSummarList = web.Lists["TenderSummaryLib"];
var estimatingList = web.Lists["EstimatingRFI"];
var tenderSheduleList = web.Lists["Tender and Drawing Schedule"];
var tenderPricingList = web.Lists["Est_Tender_Pricing_Document"];
var url1 = mechanicalQuoteList.RootFolder.ServerRelativeUrl;
var url = electricalQuoteList.RootFolder.ServerRelativeUrl;
var url2 = tenderSummarList.RootFolder.ServerRelativeUrl;
var urlA = estimatingList.RootFolder.ServerRelativeUrl;
var urlB = tenderSheduleList.RootFolder.ServerRelativeUrl;
var urlC = tenderPricingList.RootFolder.ServerRelativeUrl;
var foldername1 = string.Empty;
var foldername = string.Empty;
var foldername2 = string.Empty;
var foldernameA = string.Empty;
var foldernameB = string.Empty;
var foldernameC = string.Empty;
var folder1 = web.Folders[url1 + "/" + foldername1];
var folder = web.Folders[url + "/" + foldername];
var folder2 = web.Folders[url2 + "/" + foldername2];
var folderA = web.Folders[urlA + "/" + foldernameA];
var folderB = web.Folders[urlB + "/" + foldernameB];
var folderC = web.Folders[urlC + "/" + foldernameC];
if (!folder1.Exists && !folder.Exists && !folder2.Exists && !folderA.Exists && !folderB.Exists && !folderC.Exists)
var folders1 = web.GetFolder(url1).SubFolders;
var folders = web.GetFolder(url).SubFolders;
var folders2 = web.GetFolder(url2).SubFolders;
var foldersA = web.GetFolder(urlA).SubFolders;
var foldersB = web.GetFolder(urlB).SubFolders;
var foldersC = web.GetFolder(urlC).SubFolders;
folders1.Add(foldername1);
folders.Add(foldername);
folders2.Add(foldername2);
foldersA.Add(foldernameA);
foldersB.Add(foldernameB);
foldersC.Add(foldernameC);
var file1 = web.GetFile(web.Site.Url + TemplateUrl1);
var file = web.GetFile(web.Site.Url + TemplateUrl);
var file2 = web.GetFile(web.Site.Url + TemplateUrl2);
var fileA = web.GetFile(web.Site.Url + RfiTemplateUrl);
var fileB = web.GetFile(web.Site.Url + DrawingTemplateUrl);
var fileC = web.GetFile(web.Site.Url + TenderReturnTemplateUrl);
if (file1 != null && file != null && file2 != null && fileA != null && fileB != null && fileC != null)
var fileName = string.Format("{0}/{1}{2}", folder1.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 1 {0} to {1}...", file1.Name, fileName);
var byteArray1 = file1.OpenBinary();
var uploadedFile1 = folder1.Files.Add(fileName, byteArray1, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 1 Uploaded with new ID of {0}", uploadedFile1.Item.ID);
this.EventFiringEnabled = false;
var listitem1 = uploadedFile1.Item;
listitem1["Name"] = this.projectName;
listitem1["EnquiryNo"] = finalNum;
listitem1["Project_Name"] = this.projectName;
listitem1["Tender_Received"] = this.tenderReceived;
listitem1["Tender_Return"] = this.tenderReturn;
listitem1["Quotation_Analysis_Mech_Url"] = "https://my site url/Quotation%20Analysis%20Mechanical/Forms/DispForm.aspx?ID=" + listitem1.ID;
listitem1.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 1.");
fileName = string.Format("{0}/{1}{2}", folder.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 2 {0} to {1}...", file.Name, fileName);
var byteArray = file.OpenBinary();
var uploadedFile = folder.Files.Add(fileName, byteArray, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 2 Uploaded with new ID of {0}", uploadedFile.Item.ID);
this.EventFiringEnabled = false;
var listitem = uploadedFile.Item;
listitem["Name"] = this.projectName;
listitem["EnquiryNo"] = finalNum;
listitem["Project_Name"] = this.projectName;
listitem["Tender_Received"] = this.tenderReceived;
listitem["Tender_Return"] = this.tenderReturn;
listitem["Quotation_Analysis_Elec_Url"] = "https://my site url/Quotation%20Analysis%20Electrical/Forms/DispForm.aspx?ID=" + listitem.ID;
listitem.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 2.");
fileName = string.Format("{0}/{1}{2}", folderA.ServerRelativeUrl, this.projectName, ".docx");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 3 {0} to {1}...", fileA.Name, fileName);
var byteArrayA = fileA.OpenBinary();
var uploadedFileA = folderA.Files.Add(fileName, byteArrayA, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 3 Uploaded with new ID of {0}", uploadedFileA.Item.ID);
this.EventFiringEnabled = false;
var listitemA = uploadedFileA.Item;
listitemA["Name"] = this.projectName;
listitemA["EnquiryNo"] = finalNum;
listitemA["Project_Name"] = this.projectName;
listitemA["Date"] = this.docDate;
listitemA["Description"] = this.description;
listitemA["ProjectNo"] = this.projectNumber;
listitemA["RFIUrl"] = "https://my site url/EstimatingRFI/Forms/DispForm.aspx?ID=" + listitemA.ID;
listitemA.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 3.");
fileName = string.Format("{0}/{1}{2}", folderB.ServerRelativeUrl, this.projectName, ".docx");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 4 {0} to {1}...", fileB.Name, fileName);
var byteArrayB = fileB.OpenBinary();
var uploadedFileB = folderB.Files.Add(fileName, byteArrayB, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 4 Uploaded with new ID of {0}", uploadedFileB.Item.ID);
this.EventFiringEnabled = false;
var listitemB = uploadedFileB.Item;
listitemB["Name"] = this.projectName;
listitemB["EnquiryNo"] = finalNum;
listitemB["Project_Name"] = this.projectName;
listitemB["Date"] = this.docDate;
listitemB["Description"] = this.description;
listitemB["ProjectNo"] = this.projectNumber;
listitemB["DrawingURL"] = "https://my site url/Tender%20and%20Drawing%20Schedule/Forms/DispForm.aspx?ID=" + listitemB.ID;
listitemB.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 4.");
fileName = string.Format("{0}/{1}{2}", folderC.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 5 {0} to {1}...", fileC.Name, fileName);
var byteArrayC = fileC.OpenBinary();
var uploadedFileC = folderC.Files.Add(fileName, byteArrayC, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 5 Uploaded with new ID of {0}", uploadedFileC.Item.ID);
this.EventFiringEnabled = false;
var listitemC = uploadedFileC.Item;
listitemC["Name"] = this.projectName;
listitemC["EnquiryNo"] = finalNum;
listitemC["Project_Name"] = this.projectName;
listitemC["Date"] = this.docDate;
listitemC["Description"] = this.description;
listitemC["ProjectNo"] = this.projectNumber;
listitemC["PricingURL"] = "https://my site url/Est_Tender_Pricing_Document/Forms/DispForm.aspx?ID=" + listitemC.ID;
listitemC.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 5.");
fileName = string.Format("{0}/{1}{2}", folder2.ServerRelativeUrl, this.projectName, ".xlsm");
LogIssue(web, null, "Web Id : " + web.ID, "Copying file 5 {0} to {1}...", file2.Name, fileName);
var byteArray2 = file2.OpenBinary();
var uploadedFile2 = folder2.Files.Add(fileName, byteArray2, true);
LogIssue(web, null, "Web Id : " + web.ID, "File 6 Uploaded with new ID of {0}", uploadedFile2.Item.ID);
this.EventFiringEnabled = false;
var listitem2 = uploadedFile2.Item;
listitem2["Name"] = this.projectName;
listitem2["EnquiryNo"] = finalNum;
listitem2["Project_Name"] = this.projectName;
listitem2["Date"] = this.docDate;
listitem2["Team"] = this.team;
listitem2["Estimator_Electrical"] = this.electrical;
listitem2["Estimator_Mechanical"] = this.mechanical;
listitem2["Status"] = this.status;
listitem2["Tender_Received"] = this.tenderReceived;
listitem2["Tender_Return"] = this.tenderReturn;
listitem2["Sector"] = this.sector;
listitem2["Design_Build"] = this.designBuild;
listitem2["Build_Type"] = this.buildType;
listitem2["Service_Prog_Start"] = this.serviceProgramStart;
listitem2["Service_Prog_Completion"] = this.serviceProgramCompletion;
listitem2["Client_1"] = this.client1;
listitem2["Client_2"] = this.client2;
listitem2["Client_3"] = this.client3;
listitem2["Client_4"] = this.client4;
listitem2["Consultant"] = this.consultant;
listitem2["Pre-construction_Prog_Start"] = this.preConstructionProgramStart;
listitem2["Pre-construction_Prog_End"] = this.preConstructionProgramEnd;
listitem2["Tender_Summary_Url"] = "https://my site url/TenderSummaryLib/Forms/DispForm.aspx?ID=" + listitem2.ID;
listitem2.SystemUpdate(false);
this.EventFiringEnabled = true;
LogIssue(web, null, "Web Id : " + web.ID, "Copied file 6.");
/// <summary>
/// Creates the folders.
/// </summary>
/// <param name="web">The web.</param>
private void CreateFolders(SPWeb web)
var projectListId = web.Lists.Add(this.projectName.Replace(' ', '_'), string.Empty, SPListTemplateType.DocumentLibrary);
var projectList = web.Lists[projectListId];
projectList.OnQuickLaunch = true; // The document library will appear in Quick Launch bar.
CreateFolder(projectList, "1.Tender Documents");
CreateFolder(projectList, "2. Electrical");
CreateFolder(projectList, "3. Mechanical");
CreateFolder(projectList, "4. Correspondance");
CreateFolder(projectList, "5. Settlement Meeting Docs");
CreateFolder(projectList, "6. Tender Return Docs");
CreateFolder(projectList, "7. Tender Handover");
projectList.Update();
/// <summary>
/// Initializes the specified list item.
/// </summary>
/// <param name="listItem">The list item.</param>
/// <param name="finalNum">The final number.</param>
private void Initialize(SPListItem listItem, string finalNum)
var contextId = string.Format("List:{0}, Id:{1}", listItem.ParentList.Title, listItem.ID);
this.noBid = AssignField(listItem, "Bid", contextId);
this.projectName = AssignField(listItem, "Project_Name", contextId);
var teamlookup = AssignField(listItem, "Team", contextId);
var lookupParts = teamlookup.Split(new[] { ";#" }, StringSplitOptions.None);
this.team = lookupParts[1];
this.description = AssignField(listItem, "Description", contextId);
this.status = AssignField(listItem, "enquiry_status", contextId);
this.electrical = AssignUserField(listItem, "electrical_proj_manager", contextId);
this.mechanical = AssignUserField(listItem, "mechanical_proj_manager", contextId);
this.docDate = AssignDateField(listItem, "Date", contextId);
this.tenderReceived = AssignDateField(listItem, "Tender_Received", contextId);
this.tenderReturn = AssignDateField(listItem, "Tender_Return", contextId);
this.preConstructionProgramStart = AssignDateField(listItem, "Pre-construction_Prog_Start", contextId);
this.preConstructionProgramEnd = AssignDateField(listItem, "Pre-construction_Prog_End", contextId);
this.sector = AssignField(listItem, "Sector", contextId);
this.designBuild = AssignField(listItem, "Design_Build", contextId);
this.buildType = AssignField(listItem, "Build_Type", contextId);
this.serviceProgramStart = AssignDateField(listItem, "Service_Prog_Start", contextId);
this.serviceProgramCompletion = AssignDateField(listItem, "Service_Prog_Completion", contextId);
this.client1 = AssignField(listItem, "Client_1", contextId);
this.client2 = AssignField(listItem, "Client_2", contextId);
this.client3 = AssignField(listItem, "Client_3", contextId);
this.client4 = AssignField(listItem, "Client_4", contextId);
this.consultant = AssignField(listItem, "Consultant", contextId);
if (this.status == "Won")
this.projectNumber = string.Format("15-{0}-{1}", this.team, new Random().Next(0, 9999).ToString("D4"));
if (this.status == "Active" || this.status == "Closed")
this.projectNumber = "No Project No";
listItem["ProjectNo"] = this.projectNumber;
listItem["EnquiryNo"] = finalNum;
listItem.Web.AllowUnsafeUpdates = true;
listItem.SystemUpdate(false);Hi,
In this forum we mainly discuss questions and feedbacks about Office client products, as your question is about SharePoint 2013, I suggest you post this thread in SharePoint forum:
https://social.technet.microsoft.com/Forums/office/en-US/home?category=sharepoint
The reason why we recommend posting appropriately is you will get the most qualified pool of respondents, and other partners who read the forums regularly can either share their knowledge or learn from your interaction with us. Thank you for your understanding.
Regards,
Melon Chen
TechNet Community Support
It's recommended to download and install
Configuration Analyzer Tool (OffCAT), which is developed by Microsoft Support teams. Once the tool is installed, you can run it at any time to scan for hundreds of known issues in Office
programs. Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
[email protected] -
IPlanet authentication over SSL
I've written a when_compare_replace plugin for out 9.0.2.0 OID server to perform user authentication against our iPlanet LDAP server for portal users. Authentication works great as is shown in the plugin souce below but it is being done in the clear, with no encryption on any of the data.
I've been looking and looking for ways to do the DBMS_LDAP.simple_bind_s over a secure connection and have come up with nothing. Our LDAP server has a SSL port running and performes authentication for other C and Java applications over an encrypted connection.
I've been trying to get the DBMS_LDAP.open_ssl command to work but I'm lost when it comes to the wallets. Why does the client need a wallet with a certificate to establish a secure connection? If we have to use a wallet with a certificate, what certificate do we use? Do we need to get a cert for the OID server so we can perform encrypted authentication?
Below is the full PL/SQL source of my OID plugin. It works as is for clear text authentication but this is not acceptable for a production system.
PACKAGE BODY PLUGIN_WHEN_COMPARE_REPLACE AS
--Writen by Eric Dalquist, [email protected] - 07/01/2003 for use by Michigan
--Technological University. This code may be freely used and modified as
--long as the original author's name, email address and creation date are
--included.
PROCEDURE WHEN_COMPARE_REPLACE
ldapplugincontext IN ODS.plugincontext,
result OUT INTEGER,
dn IN VARCHAR2,
attrname IN VARCHAR2,
attrval IN VARCHAR2,
rc OUT INTEGER,
errormsg OUT VARCHAR2
IS
local_session DBMS_LDAP.session;
local_bind_return PLS_INTEGER;
local_ldap_host VARCHAR(256);
local_ldap_port PLS_INTEGER;
remote_session DBMS_LDAP.session;
remote_bind_return PLS_INTEGER;
remote_ldap_host VARCHAR(256);
remote_ldap_port PLS_INTEGER;
remote_ssl_results PLS_INTEGER;
search_attributes DBMS_LDAP.STRING_COLLECTION;
search_return PLS_INTEGER;
search_result DBMS_LDAP.MESSAGE;
search_entry DBMS_LDAP.MESSAGE;
search_entries PLS_INTEGER;
MTU_userid VARCHAR(16);
MTU_dn VARCHAR(256);
retval PLS_INTEGER;
--DEBUGING VARIABLES
auth_location VARCHAR(16);
auth_server VARCHAR(256);
auth_port PLS_INTEGER;
context_data VARCHAR(2048);
BEGIN
remote_ldap_host := 'test1.mtu.edu';
remote_ldap_port := 389;
--Exceptions make fall-through authentication much more difficult
--Turn them off.
DBMS_LDAP.USE_EXCEPTION := FALSE;
--Move this into the local auth section later
--Cut down on proccessing time to save CPU
FOR l_counter IN 1..ldapplugincontext.COUNT LOOP
IF l_counter = 1 THEN
local_ldap_host := ldapplugincontext(l_counter);
ELSIF l_counter = 2 THEN
local_ldap_port := ldapplugincontext(l_counter);
END IF;
--Debuging purposes only
IF l_counter = ldapplugincontext.COUNT THEN
context_data := context_data || ldapplugincontext(l_counter);
ELSE
context_data := context_data || ldapplugincontext(l_counter) || ', ';
END IF;
END LOOP;
IF attrname = 'userpassword' THEN
remote_session := DBMS_LDAP.init(remote_ldap_host, remote_ldap_port);
--Instead of putting it in a STRING_COLLECTION first just extract
--the first element (MTU userid) right away
MTU_userid := DBMS_LDAP.explode_dn(dn, 1)(0);
--Find the users MTU dn based on their user id
search_attributes(1) := 'michigantechuniqueidentifier';
search_return := DBMS_LDAP.search_s
remote_session,
'ou=people,dc=mtu,dc=edu',
DBMS_LDAP.SCOPE_SUBTREE,
'(&(uid=' || MTU_userid || ')(objectclass=posixaccount))',
search_attributes,
0,
search_result
rc := search_return;
--Get the number of entries found for the user id
search_entries := DBMS_LDAP.count_entries(remote_session, search_result);
IF search_return = DBMS_LDAP.SUCCESS AND search_entries = 1 THEN
--for debuging
auth_location := 'remote';
auth_server := remote_ldap_host;
auth_port := remote_ldap_port;
--Retrieve the MTU dn from the search results
search_entry := DBMS_LDAP.first_entry(remote_session, search_result);
MTU_dn := DBMS_LDAP.get_dn(remote_session, search_entry);
--Perform a simple bind against the remote LDAP server with the MTU dn and
--password passed to us.
remote_bind_return := DBMS_LDAP.simple_bind_s(remote_session, MTU_dn, attrval);
rc := remote_bind_return;
--If the bind was successful unbind from the server.
IF remote_bind_return = DBMS_LDAP.SUCCESS THEN
retval := DBMS_LDAP.unbind_s(remote_session);
END IF;
ELSIF search_entries < 1 THEN
--for debuging
auth_location := 'local';
auth_server := local_ldap_host;
auth_port := local_ldap_port;
--If the user does not exist on the remote LDAP server
--attempt to authenticate it with the local LDAP server
local_session := DBMS_LDAP.init(local_ldap_host, local_ldap_port);
local_bind_return := DBMS_LDAP.simple_bind_s(local_session, dn, attrval);
rc := local_bind_return;
IF local_bind_return = DBMS_LDAP.success THEN
retval := DBMS_LDAP.unbind_s(local_session);
END IF;
ELSE
--for debuging
auth_location := 'none';
--Too many results returned
rc := DBMS_LDAP.RESULTS_TOO_LARGE;
END IF;
--the value of 'result' determines if the user is authenticated or not
IF rc = DBMS_LDAP.SUCCESS THEN
result := DBMS_LDAP.COMPARE_TRUE;
ELSE
result := DBMS_LDAP.COMPARE_FALSE;
END IF;
errormsg := DBMS_LDAP.err2string(rc);
ELSE
-- Do what WHEN_COMPARE_REPLACE would have done????
rc := DBMS_LDAP.SUCCESS;
-- Return false if unsure that the user should be authenticated
result := DBMS_LDAP.COMPARE_FALSE;
errormsg := 'Not sure what I should have done here :-)';
--Correct behavior is probably to do a search based on the DN for
--the specified attribute and then compare the passed value to the
--found value but until logs show this procedure is used for
--anything other than password authentication the functionality is
--going to be left out.
END IF;
INSERT INTO WHEN_COMPARE_REPLACE_LOG VALUES
to_char(sysdate, 'Month DD, YYYY HH24:MI:SS'),
dn,
attrname,
attrval,
MTU_userid,
MTU_dn,
result,
rc,
errormsg,
'No Exception - Auth From: ' || auth_location,
auth_server,
auth_port,
context_data
COMMIT;
EXCEPTION
WHEN OTHERS THEN
--An exception was raised
rc := SQLCODE;
errormsg := SUBSTR(SQLERRM, 1, 255);
--Return false so authentication can't happen
result := DBMS_LDAP.COMPARE_FALSE;
INSERT INTO WHEN_COMPARE_REPLACE_LOG VALUES
to_char(sysdate, 'Month DD, YYYY HH24:MI:SS'),
dn,
attrname,
attrval,
MTU_userid,
MTU_dn,
result,
rc,
errormsg,
'Exception - Auth From: ' || auth_location,
auth_server,
auth_port,
context_data
COMMIT;
END;
END PLUGIN_WHEN_COMPARE_REPLACE;I've written a when_compare_replace plugin for out 9.0.2.0 OID server to perform user authentication against our iPlanet LDAP server for portal users. Authentication works great as is shown in the plugin souce below but it is being done in the clear, with no encryption on any of the data.
I've been looking and looking for ways to do the DBMS_LDAP.simple_bind_s over a secure connection and have come up with nothing. Our LDAP server has a SSL port running and performes authentication for other C and Java applications over an encrypted connection.
I've been trying to get the DBMS_LDAP.open_ssl command to work but I'm lost when it comes to the wallets. Why does the client need a wallet with a certificate to establish a secure connection? If we have to use a wallet with a certificate, what certificate do we use? Do we need to get a cert for the OID server so we can perform encrypted authentication?
Below is the full PL/SQL source of my OID plugin. It works as is for clear text authentication but this is not acceptable for a production system.
PACKAGE BODY PLUGIN_WHEN_COMPARE_REPLACE AS
--Writen by Eric Dalquist, [email protected] - 07/01/2003 for use by Michigan
--Technological University. This code may be freely used and modified as
--long as the original author's name, email address and creation date are
--included.
PROCEDURE WHEN_COMPARE_REPLACE
ldapplugincontext IN ODS.plugincontext,
result OUT INTEGER,
dn IN VARCHAR2,
attrname IN VARCHAR2,
attrval IN VARCHAR2,
rc OUT INTEGER,
errormsg OUT VARCHAR2
IS
local_session DBMS_LDAP.session;
local_bind_return PLS_INTEGER;
local_ldap_host VARCHAR(256);
local_ldap_port PLS_INTEGER;
remote_session DBMS_LDAP.session;
remote_bind_return PLS_INTEGER;
remote_ldap_host VARCHAR(256);
remote_ldap_port PLS_INTEGER;
remote_ssl_results PLS_INTEGER;
search_attributes DBMS_LDAP.STRING_COLLECTION;
search_return PLS_INTEGER;
search_result DBMS_LDAP.MESSAGE;
search_entry DBMS_LDAP.MESSAGE;
search_entries PLS_INTEGER;
MTU_userid VARCHAR(16);
MTU_dn VARCHAR(256);
retval PLS_INTEGER;
--DEBUGING VARIABLES
auth_location VARCHAR(16);
auth_server VARCHAR(256);
auth_port PLS_INTEGER;
context_data VARCHAR(2048);
BEGIN
remote_ldap_host := 'test1.mtu.edu';
remote_ldap_port := 389;
--Exceptions make fall-through authentication much more difficult
--Turn them off.
DBMS_LDAP.USE_EXCEPTION := FALSE;
--Move this into the local auth section later
--Cut down on proccessing time to save CPU
FOR l_counter IN 1..ldapplugincontext.COUNT LOOP
IF l_counter = 1 THEN
local_ldap_host := ldapplugincontext(l_counter);
ELSIF l_counter = 2 THEN
local_ldap_port := ldapplugincontext(l_counter);
END IF;
--Debuging purposes only
IF l_counter = ldapplugincontext.COUNT THEN
context_data := context_data || ldapplugincontext(l_counter);
ELSE
context_data := context_data || ldapplugincontext(l_counter) || ', ';
END IF;
END LOOP;
IF attrname = 'userpassword' THEN
remote_session := DBMS_LDAP.init(remote_ldap_host, remote_ldap_port);
--Instead of putting it in a STRING_COLLECTION first just extract
--the first element (MTU userid) right away
MTU_userid := DBMS_LDAP.explode_dn(dn, 1)(0);
--Find the users MTU dn based on their user id
search_attributes(1) := 'michigantechuniqueidentifier';
search_return := DBMS_LDAP.search_s
remote_session,
'ou=people,dc=mtu,dc=edu',
DBMS_LDAP.SCOPE_SUBTREE,
'(&(uid=' || MTU_userid || ')(objectclass=posixaccount))',
search_attributes,
0,
search_result
rc := search_return;
--Get the number of entries found for the user id
search_entries := DBMS_LDAP.count_entries(remote_session, search_result);
IF search_return = DBMS_LDAP.SUCCESS AND search_entries = 1 THEN
--for debuging
auth_location := 'remote';
auth_server := remote_ldap_host;
auth_port := remote_ldap_port;
--Retrieve the MTU dn from the search results
search_entry := DBMS_LDAP.first_entry(remote_session, search_result);
MTU_dn := DBMS_LDAP.get_dn(remote_session, search_entry);
--Perform a simple bind against the remote LDAP server with the MTU dn and
--password passed to us.
remote_bind_return := DBMS_LDAP.simple_bind_s(remote_session, MTU_dn, attrval);
rc := remote_bind_return;
--If the bind was successful unbind from the server.
IF remote_bind_return = DBMS_LDAP.SUCCESS THEN
retval := DBMS_LDAP.unbind_s(remote_session);
END IF;
ELSIF search_entries < 1 THEN
--for debuging
auth_location := 'local';
auth_server := local_ldap_host;
auth_port := local_ldap_port;
--If the user does not exist on the remote LDAP server
--attempt to authenticate it with the local LDAP server
local_session := DBMS_LDAP.init(local_ldap_host, local_ldap_port);
local_bind_return := DBMS_LDAP.simple_bind_s(local_session, dn, attrval);
rc := local_bind_return;
IF local_bind_return = DBMS_LDAP.success THEN
retval := DBMS_LDAP.unbind_s(local_session);
END IF;
ELSE
--for debuging
auth_location := 'none';
--Too many results returned
rc := DBMS_LDAP.RESULTS_TOO_LARGE;
END IF;
--the value of 'result' determines if the user is authenticated or not
IF rc = DBMS_LDAP.SUCCESS THEN
result := DBMS_LDAP.COMPARE_TRUE;
ELSE
result := DBMS_LDAP.COMPARE_FALSE;
END IF;
errormsg := DBMS_LDAP.err2string(rc);
ELSE
-- Do what WHEN_COMPARE_REPLACE would have done????
rc := DBMS_LDAP.SUCCESS;
-- Return false if unsure that the user should be authenticated
result := DBMS_LDAP.COMPARE_FALSE;
errormsg := 'Not sure what I should have done here :-)';
--Correct behavior is probably to do a search based on the DN for
--the specified attribute and then compare the passed value to the
--found value but until logs show this procedure is used for
--anything other than password authentication the functionality is
--going to be left out.
END IF;
INSERT INTO WHEN_COMPARE_REPLACE_LOG VALUES
to_char(sysdate, 'Month DD, YYYY HH24:MI:SS'),
dn,
attrname,
attrval,
MTU_userid,
MTU_dn,
result,
rc,
errormsg,
'No Exception - Auth From: ' || auth_location,
auth_server,
auth_port,
context_data
COMMIT;
EXCEPTION
WHEN OTHERS THEN
--An exception was raised
rc := SQLCODE;
errormsg := SUBSTR(SQLERRM, 1, 255);
--Return false so authentication can't happen
result := DBMS_LDAP.COMPARE_FALSE;
INSERT INTO WHEN_COMPARE_REPLACE_LOG VALUES
to_char(sysdate, 'Month DD, YYYY HH24:MI:SS'),
dn,
attrname,
attrval,
MTU_userid,
MTU_dn,
result,
rc,
errormsg,
'Exception - Auth From: ' || auth_location,
auth_server,
auth_port,
context_data
COMMIT;
END;
END PLUGIN_WHEN_COMPARE_REPLACE; -
If you need to FTP with PL/SQL...
If you need to perform FTP from within PL/SQL and your database version has the UTL_TCP package, here is a free package you can use. The source code is hopefully documented well enough for you to tell what's going on and how to use the functions. Suggestions on improving the code are welcome, and I can provide limited support via email for what I've written, but I would encourage anyone who uses the code to modify/fix it according to their needs. If you modify the code, I respectfully request that you leave intact the authorship and note comments at the beginning of the package.
Please note that I have not rigorously tested this code, but it has successfully transferred files in both directions in the limited tests that I have performed.
-- Copy the code below and run it in your favorite SQL editor --
CREATE OR REPLACE PACKAGE FTP IS
Simplified FTP client API using UTL_TCP package
Author: Alan Wessman, Brigham Young University
Note: This FTP client attempts to adhere to the protocol and advice found at:
http://cr.yp.to/ftp.html
No warranties are made regarding the correctness of this code.
Notes:
1. Most of these functions will raise UTL_TCP.NETWORK_ERROR if the connection
is not open or is reset during the network transaction. They will also
raise VALUE_ERROR if the server response is ill-formed or a buffer is
too small to hold data. (Most buffers in this package are defined as
VARCHAR2(32767) to avoid size limitations; reduce this if memory overhead
is a concern.)
2. "Verbose mode" can be enabled/disabled by changing the default value of
the vDebug variable in the package body. Setting vDebug to TRUE will
cause a session transcript to be output to DBMS_OUTPUT.
3. The following is an example of how this package might be used:
declare
c utl_tcp.connection;
vresp varchar2(32767);
vbuf varchar2(32767);
vresp_code number;
vremote_host varchar2(32) := 'some.hostname.com';
vusername varchar2(8) := 'username';
vpassword varchar2(8) := 'password';
begin
dbms_output.put_line( 'Opening session...' );
vresp_code := ftp.open_session( c,
vremote_host,
vusername,
vpassword,
vresp,
5 );
vresp_code := ftp.put( c,
'/home/somebody',
'local.test',
'remote.test',
vresp );
vresp_code := ftp.remote_command( c, 'CHMOD 660 remote.test' );
vresp_code := ftp.chdir( c, '/home/somebody/subdir' );
vresp_code := ftp.pwd( c );
vresp_code := ftp.get( c,
'/home/somebody',
'new_file.test',
'another_remote_file.test',
vresp );
vresp_code := ftp.close_session( c );
dbms_output.put_line( 'Closed session.' );
exception
when others then dbms_output.put_line( sqlcode || ':' || sqlerrm );
end;
Function: Open_Session
Description: Begins an FTP session with the remote server.
Parameters:
conn OUT parameter that contains the connection info; to be passed
in to subsequent commands to maintain session state.
host Name or IP address of remote server
username User ID to use for login
password Password to use for login
response OUT parameter; buffer for server replies
timeout_secs Number of seconds for TCP timeout. Pass in NULL to disable
timeout (wait forever for responses). Pass in 0 (zero) for
no wait.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if host parameter is incorrect or if
some other networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Open_Session( conn OUT NOCOPY UTL_TCP.Connection,
host IN VARCHAR2,
username IN VARCHAR2,
password IN VARCHAR2,
response OUT VARCHAR2,
timeout_secs IN NUMBER DEFAULT 60 ) RETURN NUMBER;
Function: Get
Description: Retrieves a file on the remote server and stores its contents in
a VARCHAR2 buffer.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
buf OUT parameter; buffer for retrieved file contents
remote_path Pathname (including file name) indicating location of remote
file to be retrieved
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed or buf is
too small for file contents.
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
buf OUT VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Get
Description: Retrieves a file on the remote server and stores its contents in
a local file. Assumes an open file handle and does not close it.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
local_file IN OUT parameter; UTL_FILE file handle for input file. File
is assumed to be open for writing.
remote_path Pathname (including file name) indicating location of remote
file to be retrieved
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed or buf is
too small for file contents.
May raise any of the UTL_FILE exceptions if file write operations
fail. See UTL_FILE documentation for additional details.
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
local_file IN OUT UTL_FILE.File_Type,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Get
Description: Retrieves a file on the remote server and stores its contents in
a local file. Opens and closes local file automatically.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
local_path Pathname of local directory in which to store the retrieved
file's contents
local_filename Name of local file in which to store retrieved file's contents
(creates new file or overwrites existing file)
remote_path Pathname (including file name) indicating location of remote
file to be retrieved
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed or buf is
too small for file contents.
May raise any of the UTL_FILE exceptions if file open, write, or
close operations fail. See UTL_FILE documentation for additional
details.
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
local_path IN VARCHAR2,
local_filename IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Put
Description: Stores data as a file on the remote server
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
buf IN parameter; contains data to upload
remote_path Pathname (including file name) indicating location of remote
file to be created/overwritten
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
buf IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Put
Description: Uploads a local file to the remote server. Assumes an open file
handle and does not close it.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
local_file IN OUT parameter; UTL_FILE file handle for input file. File
is assumed to be open for reading.
remote_path Pathname (including file name) indicating location of remote
file to be created/overwritten.
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
May raise any of the UTL_FILE exceptions if file read operations
fail. See UTL_FILE documentation for additional details.
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
local_file IN OUT UTL_FILE.File_Type,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Put
Description: Uploads a local file to the remote server. Opens and closes local
file automatically.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
local_path Pathname of local directory in which file to upload exists.
local_filename Name of local file to upload.
remote_path Pathname (including file name) indicating location of remote
file to be created/overwritten.
response OUT parameter; buffer for server replies.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
May raise any of the UTL_FILE exceptions if file open, read, or
close operations fail. See UTL_FILE documentation for additional
details.
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
local_path IN VARCHAR2,
local_filename IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER;
Function: Remote_Command
Description: Sends an arbitrary command to the server via the SITE command.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
command Command and parameter(s) to send to the server, e.g.
'CHMOD 600 foo.txt'
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Remote_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
command IN VARCHAR2 ) RETURN NUMBER;
Function: Chdir
Description: Changes current working directory on remote server to specified
path.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
remote_path Path on remote server to change to.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Chdir( conn IN OUT NOCOPY UTL_TCP.Connection,
remote_path IN VARCHAR2 ) RETURN NUMBER;
Function: Pwd
Description: Prints current working directory (on remote server) to debugging
output if debugging is turned on.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
Return value: 0 (zero) if operation is successful; FTP error code if operation
is not successful.
Exceptions: May raise UTL_TCP.NETWORK_ERROR if some networking error occurs.
May raise VALUE_ERROR if server response is ill-formed.
FUNCTION Pwd( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER;
Function: Close_Session
Description: Closes the TCP connection to the remote server.
Parameters:
conn IN OUT parameter that contains the connection info; to be
passed in to subsequent commands to maintain session state.
Return value: 0 (zero)
Exceptions: None raised.
FUNCTION Close_Session( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER;
Function: Close_All_Sessions
Description: Closes all currently open TCP connections.
Parameters: None.
Return value: 0 (zero)
Exceptions: None raised.
FUNCTION Close_All_Sessions RETURN NUMBER;
END FTP;
CREATE OR REPLACE PACKAGE BODY FTP IS
vDebug BOOLEAN := TRUE;
FATAL_ERROR EXCEPTION;
PROCEDURE Debug( msg IN VARCHAR2 ) IS
BEGIN
IF vDebug THEN
DBMS_OUTPUT.Put_Line( msg );
END IF;
END Debug;
FUNCTION Get_Response( conn IN OUT NOCOPY UTL_TCP.Connection,
buf IN OUT VARCHAR2 ) RETURN NUMBER IS
vLen NUMBER;
vCode NUMBER;
vResp VARCHAR2(32767);
BEGIN
vLen := UTL_TCP.READ_LINE( conn, vResp );
Debug( vResp );
-- If TO_NUMBER below fails, let the exception propagate to calling proc
vCode := TO_NUMBER( SUBSTR( vResp, 1, 3 ) );
vResp := SUBSTR( vResp, 4 );
buf := buf || SUBSTR( vResp, 2 );
IF SUBSTR( vResp, 1, 1 ) = '-' THEN
LOOP
vLen := UTL_TCP.READ_LINE( conn, vResp );
Debug( vResp );
<<Get_Code>>
BEGIN
vCode := TO_NUMBER( SUBSTR( vResp, 1, 3 ) );
vResp := SUBSTR( vResp, 4 );
IF SUBSTR( vResp, 1, 1 ) = ' ' THEN
buf := buf || SUBSTR( vResp, 2 );
EXIT;
END IF;
EXCEPTION WHEN VALUE_ERROR THEN NULL;
END Get_Code;
buf := buf || vResp;
END LOOP;
END IF;
RETURN vCode;
END Get_Response;
FUNCTION Do_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
cmd IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResult NUMBER := 0;
BEGIN
vResult := UTL_TCP.WRITE_LINE( conn, cmd );
vResult := Get_Response( conn, response );
RETURN vResult;
END Do_Command;
FUNCTION Parse_Port_Number( port_string IN VARCHAR2 ) RETURN NUMBER IS
vResult NUMBER;
vNew_Port_String VARCHAR2(32767);
BEGIN
-- This stuff parses out the port number encoding from the server reply
-- Reply is in the format xyzh1,h2,h3,h4,p1,p2xyz
-- xyz = possible character data (server-dependent, may not exist)
-- h1-h4 = server IP elements; ignore since we know the host already
-- p1,p2 = port number encoding (port number = p1 * 256 + p2 )
vNew_Port_String := TRANSLATE( port_string, '0123456789', '0000000000' );
vNew_Port_String := SUBSTR( port_string,
INSTR( vNew_Port_String, '0' ),
INSTR( vNew_Port_String, '0', -1 ) -
INSTR( vNew_Port_String, '0' ) + 1 );
vNew_Port_String := SUBSTR( vNew_Port_String,
INSTR( vNew_Port_String, ',', 1, 4 ) + 1 );
vResult := 256 * TO_NUMBER( SUBSTR( vNew_Port_String,
1,
INSTR( vNew_Port_String, ',' ) - 1 ) );
vResult := vResult + TO_NUMBER( SUBSTR( vNew_Port_String,
INSTR( vNew_Port_String, ',' ) + 1 ) );
RETURN vResult;
-- Allow VALUE_ERROR to propagate
END Parse_Port_Number;
FUNCTION Open_Session( conn OUT NOCOPY UTL_TCP.Connection,
host IN VARCHAR2,
username IN VARCHAR2,
password IN VARCHAR2,
response OUT VARCHAR2,
timeout_secs IN NUMBER DEFAULT 60 ) RETURN NUMBER IS
vResp_Code NUMBER;
vGarbage NUMBER; -- For calling functions when we don't care about return val
BEGIN
conn := UTL_TCP.OPEN_CONNECTION( host,
21,
tx_timeout => timeout_secs );
vResp_Code := Get_Response( conn, response );
IF vResp_Code = 220 THEN
vResp_Code := Do_Command( conn, 'USER ' || username, response );
IF vResp_Code IN ( 331, 332 ) THEN
vResp_Code := Do_Command( conn, 'PASS ' || password, response );
IF vResp_Code NOT IN ( 202, 230 ) THEN
RAISE FATAL_ERROR;
END IF;
ELSE
RAISE FATAL_ERROR;
END IF;
END IF;
vResp_Code := Do_Command( conn, 'TYPE I', response );
Debug( 'Logged into ' || conn.remote_host || ' at port ' || conn.remote_port );
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error opening session:' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vGarbage := Close_Session( conn );
RETURN vResp_Code;
END Open_Session;
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
buf OUT VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResp VARCHAR2(32767);
vResp_Code NUMBER;
vNew_Conn UTL_TCP.Connection;
vNew_Port NUMBER;
BEGIN
-- do PASV
vResp_Code := Do_Command( conn, 'PASV', response );
IF vResp_Code = 227 THEN
<<Switch_Port>>
BEGIN
vNew_Port := Parse_Port_Number( response );
vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
vNew_Port,
tx_timeout => conn.tx_timeout );
Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
vResp_Code := Do_Command( conn, 'RETR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
IF vResp_Code <> 150 THEN
RAISE FATAL_ERROR;
END IF;
<<Get_Download>>
BEGIN
LOOP
vResp := vResp || UTL_TCP.GET_LINE( vNew_Conn, FALSE );
END LOOP;
EXCEPTION
WHEN UTL_TCP.END_OF_INPUT THEN NULL;
END Get_Download;
vResp_Code := Close_Session( vNew_Conn );
vResp_Code := Get_Response( conn, response );
IF vResp_Code BETWEEN 400 AND 599 THEN
RAISE FATAL_ERROR;
END IF;
EXCEPTION
WHEN OTHERS THEN
Debug( SQLERRM );
RAISE FATAL_ERROR;
END Switch_Port;
ELSE
RAISE FATAL_ERROR;
END IF;
vResp_Code := Close_Session( vNew_Conn );
buf := vResp;
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error getting ' || remote_path || ':' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vResp_Code := Close_Session( vNew_Conn );
RETURN vResp_Code;
WHEN OTHERS THEN
Debug( vResp_Code || ': ' || SQLERRM );
RETURN vResp_Code;
END Get;
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
local_file IN OUT UTL_FILE.File_Type,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResp VARCHAR2(32767);
vResp_Code NUMBER := -1;
vNew_Conn UTL_TCP.Connection;
vNew_Port NUMBER;
BEGIN
-- do PASV
vResp_Code := Do_Command( conn, 'PASV', response );
IF vResp_Code = 227 THEN
<<Switch_Port>>
BEGIN
vNew_Port := Parse_Port_Number( response );
vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
vNew_Port,
tx_timeout => conn.tx_timeout );
Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
vResp_Code := Do_Command( conn, 'RETR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
IF vResp_Code <> 150 THEN
RAISE FATAL_ERROR;
END IF;
<<Get_Download>>
BEGIN
LOOP
vResp := UTL_TCP.GET_LINE( vNew_Conn, FALSE );
UTL_FILE.Put( local_file, vResp );
END LOOP;
EXCEPTION
WHEN UTL_TCP.END_OF_INPUT THEN NULL;
END Get_Download;
vResp_Code := Close_Session( vNew_Conn );
vResp_Code := Get_Response( conn, response );
IF vResp_Code BETWEEN 400 AND 599 THEN
RAISE FATAL_ERROR;
END IF;
EXCEPTION
WHEN OTHERS THEN
Debug( SQLERRM );
RAISE FATAL_ERROR;
END Switch_Port;
ELSE
RAISE FATAL_ERROR;
END IF;
vResp_Code := Close_Session( vNew_Conn );
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error getting ' || remote_path || ':' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vResp_Code := Close_Session( vNew_Conn );
RETURN vResp_Code;
WHEN OTHERS THEN
Debug( vResp_Code || ': ' || SQLERRM );
RETURN vResp_Code;
END Get;
FUNCTION Get( conn IN OUT NOCOPY UTL_TCP.Connection,
local_path IN VARCHAR2,
local_filename IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vFile UTL_FILE.File_Type;
vResult NUMBER := -1;
BEGIN
vFile := UTL_FILE.FOPEN( local_path, local_filename, 'w' );
vResult := Get( conn, vFile, remote_path, response );
UTL_FILE.FCLOSE( vFile );
RETURN vResult;
EXCEPTION WHEN OTHERS THEN
IF UTL_FILE.IS_OPEN( vFile ) THEN
UTL_FILE.FCLOSE( vFile );
END IF;
RAISE;
END Get;
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
buf IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResp VARCHAR2(32767);
vResp_Code NUMBER;
vNew_Conn UTL_TCP.Connection;
vNew_Port NUMBER;
BEGIN
-- do PASV
vResp_Code := Do_Command( conn, 'PASV', response );
IF vResp_Code = 227 THEN
<<Switch_Port>>
BEGIN
vNew_Port := Parse_Port_Number( response );
vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
vNew_Port,
tx_timeout => conn.tx_timeout );
Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
vResp_Code := Do_Command( conn, 'STOR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
IF vResp_Code <> 150 THEN
RAISE FATAL_ERROR;
END IF;
vResp_Code := UTL_TCP.WRITE_TEXT( vNew_Conn, buf );
UTL_TCP.FLUSH( vNew_Conn );
vResp_Code := Close_Session( vNew_Conn );
vResp_Code := Get_Response( conn, response );
IF vResp_Code BETWEEN 400 AND 599 THEN
RAISE FATAL_ERROR;
END IF;
EXCEPTION
WHEN OTHERS THEN
Debug( SQLERRM );
RAISE FATAL_ERROR;
END Switch_Port;
ELSE
RAISE FATAL_ERROR;
END IF;
vResp_Code := Close_Session( vNew_Conn );
response := vResp;
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error putting ' || remote_path || ':' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vResp_Code := Close_Session( vNew_Conn );
RETURN vResp_Code;
WHEN OTHERS THEN
Debug( vResp_Code || ': ' || SQLERRM );
RETURN vResp_Code;
END Put;
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
local_file IN OUT UTL_FILE.File_Type,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vResp VARCHAR2(32767);
vResp_Code NUMBER;
vNew_Conn UTL_TCP.Connection;
vNew_Port NUMBER;
vNew_Port_String VARCHAR2(32767);
BEGIN
-- do PASV
vResp_Code := Do_Command( conn, 'PASV', response );
IF vResp_Code = 227 THEN
<<Switch_Port>>
BEGIN
vNew_Port := Parse_Port_Number( response );
vNew_Conn := UTL_TCP.OPEN_CONNECTION( conn.remote_host,
vNew_Port,
tx_timeout => conn.tx_timeout );
Debug( 'Data connection: ' || vNew_Conn.remote_host || ':' || vNew_Conn.remote_port );
vResp_Code := Do_Command( conn, 'STOR ' || REPLACE( remote_path, CHR(12), CHR(0) ), response );
IF vResp_Code <> 150 THEN
RAISE FATAL_ERROR;
END IF;
<<Get_Download>>
BEGIN
LOOP
UTL_FILE.Get_Line( local_file, vResp );
vResp_Code := UTL_TCP.WRITE_LINE( vNew_Conn, vResp );
END LOOP;
EXCEPTION
WHEN NO_DATA_FOUND THEN NULL;
END Get_Download;
vResp_Code := Close_Session( vNew_Conn );
vResp_Code := Get_Response( conn, response );
IF vResp_Code BETWEEN 400 AND 599 THEN
RAISE FATAL_ERROR;
END IF;
EXCEPTION
WHEN OTHERS THEN
Debug( SQLERRM );
RAISE FATAL_ERROR;
END Switch_Port;
ELSE
RAISE FATAL_ERROR;
END IF;
vResp_Code := Close_Session( vNew_Conn );
RETURN 0;
EXCEPTION
WHEN FATAL_ERROR THEN
Debug( 'Fatal error putting ' || remote_path || ':' );
Debug( ' Code: ' || vResp_Code );
Debug( ' Response: ' || response );
vResp_Code := Close_Session( vNew_Conn );
RETURN vResp_Code;
WHEN OTHERS THEN
Debug( vResp_Code || ': ' || SQLERRM );
RETURN vResp_Code;
END Put;
FUNCTION Put( conn IN OUT NOCOPY UTL_TCP.Connection,
local_path IN VARCHAR2,
local_filename IN VARCHAR2,
remote_path IN VARCHAR2,
response OUT VARCHAR2 ) RETURN NUMBER IS
vFile UTL_FILE.File_Type;
vResult NUMBER;
BEGIN
vFile := UTL_FILE.FOPEN( local_path, local_filename, 'r' );
vResult := Put( conn, vFile, remote_path, response );
UTL_FILE.FCLOSE( vFile );
RETURN vResult;
EXCEPTION WHEN OTHERS THEN
IF UTL_FILE.IS_OPEN( vFile ) THEN
UTL_FILE.FCLOSE( vFile );
END IF;
RAISE;
END Put;
FUNCTION Remote_Command( conn IN OUT NOCOPY UTL_TCP.Connection,
command IN VARCHAR2 ) RETURN NUMBER IS
vResp_Code NUMBER;
vResponse VARCHAR2(32767);
BEGIN
vResp_Code := Do_Command( conn, 'SITE ' || command, vResponse );
IF vResp_Code BETWEEN 500 AND 599 THEN
RETURN vResp_Code;
END IF;
RETURN 0;
END Remote_Command;
FUNCTION Chdir( conn IN OUT NOCOPY UTL_TCP.Connection,
remote_path IN VARCHAR2 ) RETURN NUMBER IS
vResp_Code NUMBER;
vResponse VARCHAR2(32767);
BEGIN
vResp_Code := Do_Command( conn, 'CWD ' || REPLACE( remote_path, CHR(12), CHR(0) ), vResponse );
IF vResp_Code BETWEEN 500 AND 599 THEN
RETURN vResp_Code;
END IF;
RETURN 0;
END Chdir;
FUNCTION Pwd( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER IS
vResp_Code NUMBER;
vResponse VARCHAR2(32767);
BEGIN
vResp_Code := Do_Command( conn, 'PWD', vResponse );
IF vResp_Code BETWEEN 500 AND 599 THEN
RETURN vResp_Code;
END IF;
RETURN 0;
END Pwd;
FUNCTION Close_Session( conn IN OUT NOCOPY UTL_TCP.Connection ) RETURN NUMBER IS
BEGIN
IF conn.remote_host IS NULL THEN
RETURN 0;
END IF;
Debug( 'Closing connection on ' || conn.remote_host || ':' || conn.remote_port );
UTL_TCP.Close_Connection( conn );
RETURN 0;
EXCEPTION
WHEN UTL_TCP.NETWORK_ERROR THEN RETURN 0;
END Close_Session;
FUNCTION Close_All_Sessions RETURN NUMBER IS
BEGIN
UTL_TCP.Close_All_Connections;
RETURN 0;
END Close_All_Sessions;
END FTP;Here's another PL/SQL package that will FTP ASCII text files. It assumes that you have proper permissions on the remote host and simply want to transfer one or more text files, not perform any other miscellaneous commands.
Also, from what I have read, in 9i UTL_FILE supports reading and writing of binary data so an FTP client could be written to transfer either ASCII or BINARY files.
Regards,
Russ
CREATE OR REPLACE PACKAGE BRNC_FTP_PKG
AS
* PL/SQL FTP Client
* Created by: Russ Johnson, Braun Consulting
* www.braunconsult.com
* OVERVIEW
* This package uses the standard packages UTL_FILE and UTL_TCP to perform
* client-side FTP functionality (PUT and GET) for text files as defined in
* the World Wide Web Consortium's RFC 959 document - http://www.w3.org/Protocols/rfc959/
* The procedures and functions in this package allow single or multiple file transfer using
* standard TCP/IP connections.
* LIMITATIONS
* Currently the API is limited to transfer of ASCII text files only. This is
* primarily because UTL_FILE only supports text I/O, but also because the original
* design was for creating text files from data in the Oracle database, then transferring the file to a remote host.
* Furthermore, the API does not support SSH/Secure FTP or connection through a proxy server.
* Keep in mind that FTP passes the username/password combo in plain text over TCP/IP.
* DB versions - 8i (8.1.x) and above. 8.0.x may work if it has the SYS.UTL_TCP package.
* Note: Since UTL_FILE is used for the client-side I/O, this package is also limited to
* transfer of files that exist in directories available to UTL_FILE for read/write.
* These directories are defined by the UTL_FILE_DIR parameter in the init.ora file.
* USAGE
* Three functions are available for FTP - PUT, GET, and FTP_MULTIPLE. FTP_MULTIPLE takes
* a table of records that define the files to be transferred (filename, directory, etc.).
* That table can have 1 record or multiple records. The PUT and GET functions are included
* for convenience to FTP one file at a time. PUT and GET return true if the file is transferred
* successfully and false if it fails. FTP_MULTIPLE returns true if no batch-level errors occur
* (such as an invalid host, refused connection, or invalid login information). It also takes the
* table of file records IN and passes it back OUT. Each record contains individual error information.
* EXAMPLE
* Transfer multiple files - 1 GET and 2 PUT from a Windows machine to a host (assuming UNIX here).
* Display any errors that occur.
* DECLARE
* v_username VARCHAR2(40) := 'rjohnson';
* v_password VARCHAR2(40) := 'password';
* v_hostname VARCHAR2(255) := 'ftp.oracle.com';
* v_error_message VARCHAR2(1000);
* b_put BOOLEAN;
* t_files BRNC_FTP_PKG.t_ftp_rec; -- Declare our table of file records
* BEGIN
* t_files(1).localpath := 'd:\oracle\utl_file\outbound';
* t_files(1).filename := 'myfile1.txt';
* t_files(1).remotepath := '/home/oracle/text_files';
* t_files(1).transfer_mode := 'PUT';
* t_files(2).localpath := 'd:\oracle\utl_file\inbound';
* t_files(2).filename := 'incoming_file.xml';
* t_files(2).remotepath := '/home/oracle/xml_files';
* t_files(2).transfer_mode := 'GET';
* t_files(3).localpath := 'd:\oracle\utl_file\outbound';
* t_files(3).filename := 'myfile2.txt';
* t_files(3).remotepath := '/home';
* t_files(3).transfer_mode := 'PUT';
* b_put := BRNC_FTP_PKG.FTP_MULTIPLE(v_error_message,
* t_files,
* v_username,
* v_password,
* v_hostname);
* IF b_put = TRUE
* THEN
* FOR i IN t_files.FIRST..t_files.LAST
* LOOP
* IF t_files.EXISTS(i)
* THEN
* DBMS_OUTPUT.PUT_LINE(t_files(i).status||' | '||
* t_files(i).error_message||' | '||
* to_char(t_files(i).bytes_transmitted)||' | '||
* to_char(t_files(i).trans_start,'YYYY-MM-DD HH:MI:SS')||' | '||
* to_char(t_files(i).trans_end,'YYYY-MM-DD HH:MI:SS'));
* END IF;
* END LOOP;
* ELSE
* DBMS_OUTPUT.PUT_LINE(v_error_message);
* END IF;
* EXCEPTION
* WHEN OTHERS
* THEN
* DBMS_OUTPUT.PUT_LINE(SQLERRM);
* END;
* CREDITS
* The W3C's RFC 959 that describes the FTP process.
* http://www.w3c.org
* Much of the PL/SQL code in this package was based on Java code written by
* Bruce Blackshaw of Enterprise Distributed Technologies Ltd. None of that code
* was copied, but the objects and methods greatly helped my understanding of the
* FTP Client process.
* http://www.enterprisedt.com
* VERSION HISTORY
* 1.0 11/19/2002 Unit-tested single and multiple transfers between disparate hosts.
* Exceptions
ctrl_exception EXCEPTION;
data_exception EXCEPTION;
* Constants - FTP valid response codes
CONNECT_CODE CONSTANT PLS_INTEGER := 220;
USER_CODE CONSTANT PLS_INTEGER := 331;
LOGIN_CODE CONSTANT PLS_INTEGER := 230;
PWD_CODE CONSTANT PLS_INTEGER := 257;
PASV_CODE CONSTANT PLS_INTEGER := 227;
CWD_CODE CONSTANT PLS_INTEGER := 250;
TSFR_START_CODE1 CONSTANT PLS_INTEGER := 125;
TSFR_START_CODE2 CONSTANT PLS_INTEGER := 150;
TSFR_END_CODE CONSTANT PLS_INTEGER := 226;
QUIT_CODE CONSTANT PLS_INTEGER := 221;
SYST_CODE CONSTANT PLS_INTEGER := 215;
TYPE_CODE CONSTANT PLS_INTEGER := 200;
* FTP File record datatype
* Elements:
* localpath - full directory name in which the local file resides or will reside
* Windows: 'd:\oracle\utl_file'
* UNIX: '/home/oracle/utl_file'
* filename - filename and extension for the file to be received or sent
* changing the filename for the PUT or GET is currently not allowed
* Examples: 'myfile.dat' 'myfile20021119.xml'
* remotepath - full directory name in which the local file will be sent or the
* remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
* filetype - reserved for future use, ignored in code
* transfer_mode - 'PUT' or 'GET'
* status - status of the transfer. 'ERROR' or 'SUCCESS'
* error_message - meaningful (hopefully) error message explaining the reason for failure
* bytes_transmitted - how many bytes were sent/received
* trans_start - date/time the transmission started
* trans_end - date/time the transmission ended
TYPE r_ftp_rec IS RECORD(localpath VARCHAR2(255),
filename VARCHAR2(255),
remotepath VARCHAR2(255),
filetype VARCHAR2(20),
transfer_mode VARCHAR2(5),
status VARCHAR2(40),
error_message VARCHAR2(255),
bytes_transmitted NUMBER,
trans_start DATE,
trans_end DATE);
* FTP File Table - used to store many files for transfer
TYPE t_ftp_rec IS TABLE of r_ftp_rec INDEX BY BINARY_INTEGER;
* Internal convenience procedure for creating passive host IP address
* and port number.
PROCEDURE CREATE_PASV(p_pasv_cmd IN VARCHAR2,
p_pasv_host OUT VARCHAR2,
p_pasv_port OUT NUMBER);
* Function used to validate FTP server responses based on the
* code passed in p_code. Reads single or multi-line responses.
FUNCTION VALIDATE_REPLY(p_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_code IN PLS_INTEGER,
p_reply OUT VARCHAR2)
RETURN BOOLEAN;
* Function used to validate FTP server responses based on the
* code passed in p_code. Reads single or multi-line responses.
* Overloaded because some responses can have 2 valid codes.
FUNCTION VALIDATE_REPLY(p_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_code1 IN PLS_INTEGER,
p_code2 IN PLS_INTEGER,
p_reply OUT VARCHAR2)
RETURN BOOLEAN;
* Procedure that handles the actual data transfer. Meant
* for internal package use. Returns information about the
* actual transfer.
PROCEDURE TRANSFER_ASCII(u_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_pasv_host IN VARCHAR2,
p_pasv_port IN PLS_INTEGER,
p_transfer_mode IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE);
* Function to handle FTP of many files.
* Returns TRUE if no batch-level errors occur.
* Returns FALSE if a batch-level error occurs.
* Parameters:
* p_error_msg - error message for batch level errors
* p_files - BRNC_FTP_PKG.t_ftp_rec table type. Accepts
* list of files to be transferred (may be any combination of PUT or GET)
* returns the table updated with transfer status, error message,
* bytes_transmitted, transmission start date/time and transmission end
* date/time
* p_username - username for FTP server
* p_password - password for FTP server
* p_hostname - hostname or IP address of server Ex: 'ftp.oracle.com' or '127.0.0.1'
* p_port - port number to connect on. FTP is usually on 21, but this may be overridden
* if the server is configured differently.
FUNCTION FTP_MULTIPLE(p_error_msg OUT VARCHAR2,
p_files IN OUT t_ftp_rec,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
p_port IN PLS_INTEGER DEFAULT 21)
RETURN BOOLEAN;
* Convenience function for single-file PUT
* Parameters:
* p_localpath - full directory name in which the local file resides or will reside
* Windows: 'd:\oracle\utl_file'
* UNIX: '/home/oracle/utl_file'
* p_filename - filename and extension for the file to be received or sent
* changing the filename for the PUT or GET is currently not allowed
* Examples: 'myfile.dat' 'myfile20021119.xml'
* p_remotepath - full directory name in which the local file will be sent or the
* remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
* p_username - username for FTP server
* p_password - password for FTP server
* p_hostname - FTP server IP address or host name Ex: 'ftp.oracle.com' or '127.0.0.1'
* v_status - status of the transfer. 'ERROR' or 'SUCCESS'
* v_error_message - meaningful (hopefully) error message explaining the reason for failure
* n_bytes_transmitted - how many bytes were sent/received
* d_trans_start - date/time the transmission started
* d_trans_end - date/time the transmission ended
* p_port - port number to connect to, default is 21
* p_filetype - always set to 'ASCII', reserved for future use, ignored in code
FUNCTION PUT(p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_remotepath IN VARCHAR2,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE,
p_port IN PLS_INTEGER DEFAULT 21,
p_filetype IN VARCHAR2 := 'ASCII')
RETURN BOOLEAN;
* Convenience function for single-file GET
* Parameters:
* p_localpath - full directory name in which the local file resides or will reside
* Windows: 'd:\oracle\utl_file'
* UNIX: '/home/oracle/utl_file'
* p_filename - filename and extension for the file to be received or sent
* changing the filename for the PUT or GET is currently not allowed
* Examples: 'myfile.dat' 'myfile20021119.xml'
* p_remotepath - full directory name in which the local file will be sent or the
* remote file exists. Should be in UNIX format regardless of FTP server - '/one/two/three'
* p_username - username for FTP server
* p_password - password for FTP server
* p_hostname - FTP server IP address or host name Ex: 'ftp.oracle.com' or '127.0.0.1'
* v_status - status of the transfer. 'ERROR' or 'SUCCESS'
* v_error_message - meaningful (hopefully) error message explaining the reason for failure
* n_bytes_transmitted - how many bytes were sent/received
* d_trans_start - date/time the transmission started
* d_trans_end - date/time the transmission ended
* p_port - port number to connect to, default is 21
* p_filetype - always set to 'ASCII', reserved for future use, ignored in code
FUNCTION GET(p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_remotepath IN VARCHAR2,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE,
p_port IN PLS_INTEGER DEFAULT 21,
p_filetype IN VARCHAR2 := 'ASCII')
RETURN BOOLEAN;
END BRNC_FTP_PKG;
CREATE OR REPLACE PACKAGE BODY BRNC_FTP_PKG
AS
** Create the passive host IP and port number to connect to
PROCEDURE CREATE_PASV(p_pasv_cmd IN VARCHAR2,
p_pasv_host OUT VARCHAR2,
p_pasv_port OUT NUMBER)
IS
v_pasv_cmd VARCHAR2(30) := p_pasv_cmd; --Host and port to connect to for data transfer
n_port_dec NUMBER;
n_port_add NUMBER;
BEGIN
p_pasv_host := REPLACE(SUBSTR(v_pasv_cmd,1,INSTR(v_pasv_cmd,',',1,4)-1),',','.');
n_port_dec := TO_NUMBER(SUBSTR(v_pasv_cmd,INSTR(v_pasv_cmd,',',1,4)+1,(INSTR(v_pasv_cmd,',',1,5)-(INSTR(v_pasv_cmd,',',1,4)+1))));
n_port_add := TO_NUMBER(SUBSTR(v_pasv_cmd,INSTR(v_pasv_cmd,',',1,5)+1,LENGTH(v_pasv_cmd)-INSTR(v_pasv_cmd,',',1,5)));
p_pasv_port := (n_port_dec*256) + n_port_add;
EXCEPTION
WHEN OTHERS
THEN
--DBMS_OUTPUT.PUT_LINE(SQLERRM);
RAISE;
END CREATE_PASV;
** Read a single or multi-line reply from the FTP server and validate
** it against the code passed in p_code.
** Return TRUE if reply code matches p_code, FALSE if it doesn't or error
** occurs
** Send full server response back to calling procedure
FUNCTION VALIDATE_REPLY(p_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_code IN PLS_INTEGER,
p_reply OUT VARCHAR2)
RETURN BOOLEAN
IS
n_code VARCHAR2(3) := p_code;
n_byte_count PLS_INTEGER;
v_msg VARCHAR2(255);
n_line_count PLS_INTEGER := 0;
BEGIN
LOOP
v_msg := UTL_TCP.GET_LINE(p_ctrl_con);
n_line_count := n_line_count + 1;
IF n_line_count = 1
THEN
p_reply := v_msg;
ELSE
p_reply := p_reply || SUBSTR(v_msg,4);
END IF;
EXIT WHEN INSTR(v_msg,'-',1,1) <> 4;
END LOOP;
IF to_number(SUBSTR(p_reply,1,3)) = n_code
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
p_reply := SQLERRM;
RETURN FALSE;
END VALIDATE_REPLY;
** Reads a single or multi-line reply from the FTP server
** Return TRUE if reply code matches p_code1 or p_code2,
** FALSE if it doesn't or error occurs
** Send full server response back to calling procedure
FUNCTION VALIDATE_REPLY(p_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_code1 IN PLS_INTEGER,
p_code2 IN PLS_INTEGER,
p_reply OUT VARCHAR2)
RETURN BOOLEAN
IS
v_code1 VARCHAR2(3) := to_char(p_code1);
v_code2 VARCHAR2(3) := to_char(p_code2);
v_msg VARCHAR2(255);
n_line_count PLS_INTEGER := 0;
BEGIN
LOOP
v_msg := UTL_TCP.GET_LINE(p_ctrl_con);
n_line_count := n_line_count + 1;
IF n_line_count = 1
THEN
p_reply := v_msg;
ELSE
p_reply := p_reply || SUBSTR(v_msg,4);
END IF;
EXIT WHEN INSTR(v_msg,'-',1,1) <> 4;
END LOOP;
IF to_number(SUBSTR(p_reply,1,3)) IN(v_code1,v_code2)
THEN
RETURN TRUE;
ELSE
RETURN FALSE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
p_reply := SQLERRM;
RETURN FALSE;
END VALIDATE_REPLY;
** Handles actual data transfer. Responds with status, error message, and
** transfer statistics.
** Potential errors could be with connection or file i/o
PROCEDURE TRANSFER_ASCII(u_ctrl_con IN OUT UTL_TCP.CONNECTION,
p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_pasv_host IN VARCHAR2,
p_pasv_port IN PLS_INTEGER,
p_transfer_mode IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE)
IS
u_data_con UTL_TCP.CONNECTION;
u_filehandle UTL_FILE.FILE_TYPE;
v_tsfr_mode VARCHAR2(3) := p_transfer_mode;
v_mode VARCHAR2(1);
v_tsfr_cmd VARCHAR2(10);
v_buffer VARCHAR2(32767);
v_localpath VARCHAR2(255) := p_localpath;
v_filename VARCHAR2(255) := p_filename;
v_host VARCHAR2(20) := p_pasv_host;
n_port PLS_INTEGER := p_pasv_port;
n_bytes NUMBER;
v_msg VARCHAR2(255);
v_reply VARCHAR2(1000);
v_err_status VARCHAR2(20) := 'ERROR';
BEGIN
/** Initialize some of our OUT variables **/
v_status := 'SUCCESS';
v_error_message := ' ';
n_bytes_transmitted := 0;
IF UPPER(v_tsfr_mode) = 'PUT'
THEN
v_mode := 'r';
v_tsfr_cmd := 'STOR ';
ELSIF UPPER(v_tsfr_mode) = 'GET'
THEN
v_mode := 'w';
v_tsfr_cmd := 'RETR ';
END IF;
/** Open data connection on Passive host and port **/
u_data_con := UTL_TCP.OPEN_CONNECTION(v_host,n_port);
/** Open the local file to read and transfer data **/
u_filehandle := UTL_FILE.FOPEN(v_localpath,v_filename,v_mode);
/** Send the STOR command to tell the server we're going to upload a file **/
n_bytes := UTL_TCP.WRITE_LINE(u_ctrl_con,v_tsfr_cmd||v_filename);
IF VALIDATE_REPLY(u_ctrl_con,TSFR_START_CODE1,TSFR_START_CODE2,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
d_trans_start := SYSDATE;
IF UPPER(v_tsfr_mode) = 'PUT'
THEN
LOOP
BEGIN
UTL_FILE.GET_LINE(u_filehandle,v_buffer);
EXCEPTION
WHEN NO_DATA_FOUND
THEN
EXIT;
END;
n_bytes := UTL_TCP.WRITE_LINE(u_data_con,v_buffer);
n_bytes_transmitted := n_bytes_transmitted + n_bytes;
END LOOP;
ELSIF UPPER(v_tsfr_mode) = 'GET'
THEN
LOOP
BEGIN
v_buffer := UTL_TCP.GET_LINE(u_data_con,TRUE);
/** Sometimes the TCP/IP buffer sends null data **/
/** we only want to receive the actual data **/
IF v_buffer IS NOT NULL
THEN
UTL_FILE.PUT_LINE(u_filehandle,v_buffer);
n_bytes := LENGTH(v_buffer);
n_bytes_transmitted := n_bytes_transmitted + n_bytes;
END IF;
EXCEPTION
WHEN UTL_TCP.END_OF_INPUT
THEN
EXIT;
END;
END LOOP;
END IF;
/** Flush the buffer on the data connection **/
--UTL_TCP.FLUSH(u_data_con);
d_trans_end := SYSDATE;
/** Close the file **/
UTL_FILE.FCLOSE(u_filehandle);
/** Close the Data Connection **/
UTL_TCP.CLOSE_CONNECTION(u_data_con);
/** Verify the transfer succeeded **/
IF VALIDATE_REPLY(u_ctrl_con,TSFR_END_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
EXCEPTION
WHEN ctrl_exception
THEN
v_status := v_err_status;
v_error_message := v_reply;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.invalid_path
THEN
v_status := v_err_status;
v_error_message := 'Directory '||v_localpath||' is not available to UTL_FILE. Check the init.ora file for valid UTL_FILE directories.';
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.invalid_operation
THEN
v_status := v_err_status;
IF UPPER(v_tsfr_mode) = 'PUT'
THEN
v_error_message := 'The file '||V_filename||' in the directory '||v_localpath||' could not be opened for reading.';
ELSIF UPPER(v_tsfr_mode) = 'GET'
THEN
v_error_message := 'The file '||V_filename||' in the directory '||v_localpath||' could not be opened for writing.';
END IF;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.read_error
THEN
v_status := v_err_status;
v_error_message := 'The system encountered an error while trying to read '||v_filename||' in the directory '||v_localpath;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.write_error
THEN
v_status := v_err_status;
v_error_message := 'The system encountered an error while trying to write to '||v_filename||' in the directory '||v_localpath;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN UTL_FILE.internal_error
THEN
v_status := v_err_status;
v_error_message := 'The UTL_FILE package encountered an unexpected internal system error.';
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
WHEN OTHERS
THEN
v_status := v_err_status;
v_error_message := SQLERRM;
IF UTL_FILE.IS_OPEN(u_filehandle)
THEN
UTL_FILE.FCLOSE(u_filehandle);
END IF;
UTL_TCP.CLOSE_CONNECTION(u_data_con);
END TRANSFER_ASCII;
** Handles connection to host and FTP of multiple files
** Files can be any combination of PUT and GET
FUNCTION FTP_MULTIPLE(p_error_msg OUT VARCHAR2,
p_files IN OUT t_ftp_rec,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
p_port IN PLS_INTEGER DEFAULT 21)
RETURN BOOLEAN
IS
v_username VARCHAR2(30) := p_username;
v_password VARCHAR2(30) := p_password;
v_hostname VARCHAR2(30) := p_hostname;
n_port PLS_INTEGER := p_port;
u_ctrl_con UTL_TCP.CONNECTION;
n_byte_count PLS_INTEGER;
n_first_index NUMBER;
v_msg VARCHAR2(250);
v_reply VARCHAR2(1000);
v_pasv_host VARCHAR2(20);
n_pasv_port NUMBER;
invalid_transfer EXCEPTION;
BEGIN
p_error_msg := 'FTP Successful'; --Assume the overall transfer will succeed
/** Attempt to connect to the host machine **/
u_ctrl_con := UTL_TCP.OPEN_CONNECTION(v_hostname,n_port);
IF VALIDATE_REPLY(u_ctrl_con,CONNECT_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** Send username **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'USER '||v_username);
IF VALIDATE_REPLY(u_ctrl_con,USER_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** Send password **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'PASS '||v_password);
IF VALIDATE_REPLY(u_ctrl_con,LOGIN_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** We should be logged in, time to transfer all files **/
FOR i IN p_files.FIRST..p_files.LAST
LOOP
IF p_files.EXISTS(i)
THEN
BEGIN
/** Change to the remotepath directory **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'CWD '||p_files(i).remotepath);
IF VALIDATE_REPLY(u_ctrl_con,CWD_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** Switch to IMAGE mode **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'TYPE I');
IF VALIDATE_REPLY(u_ctrl_con,TYPE_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
/** Get a Passive connection to use for data transfer **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'PASV');
IF VALIDATE_REPLY(u_ctrl_con,PASV_CODE,v_reply) = FALSE
THEN
RAISE ctrl_exception;
END IF;
CREATE_PASV(SUBSTR(v_reply,INSTR(v_reply,'(',1,1)+1,INSTR(v_reply,')',1,1)-INSTR(v_reply,'(',1,1)-1),v_pasv_host,n_pasv_port);
/** Transfer Data **/
IF UPPER(p_files(i).transfer_mode) = 'PUT'
THEN
TRANSFER_ASCII(u_ctrl_con,
p_files(i).localpath,
p_files(i).filename,
v_pasv_host,
n_pasv_port,
p_files(i).transfer_mode,
p_files(i).status,
p_files(i).error_message,
p_files(i).bytes_transmitted,
p_files(i).trans_start,
p_files(i).trans_end);
ELSIF UPPER(p_files(i).transfer_mode) = 'GET'
THEN
TRANSFER_ASCII(u_ctrl_con,
p_files(i).localpath,
p_files(i).filename,
v_pasv_host,
n_pasv_port,
p_files(i).transfer_mode,
p_files(i).status,
p_files(i).error_message,
p_files(i).bytes_transmitted,
p_files(i).trans_start,
p_files(i).trans_end);
ELSE
RAISE invalid_transfer; -- Raise an exception here
END IF;
EXCEPTION
WHEN ctrl_exception
THEN
p_files(i).status := 'ERROR';
p_files(i).error_message := v_reply;
WHEN invalid_transfer
THEN
p_files(i).status := 'ERROR';
p_files(i).error_message := 'Invalid transfer method. Use PUT or GET.';
END;
END IF;
END LOOP;
/** Send QUIT command **/
n_byte_count := UTL_TCP.WRITE_LINE(u_ctrl_con,'QUIT');
/** Don't need to validate QUIT, just close the connection **/
UTL_TCP.CLOSE_CONNECTION(u_ctrl_con);
RETURN TRUE;
EXCEPTION
WHEN ctrl_exception
THEN
p_error_msg := v_reply;
UTL_TCP.CLOSE_ALL_CONNECTIONS;
RETURN FALSE;
WHEN OTHERS
THEN
p_error_msg := SQLERRM;
UTL_TCP.CLOSE_ALL_CONNECTIONS;
RETURN FALSE;
END FTP_MULTIPLE;
** Convenience function for single-file PUT
** Formats file information for FTP_MULTIPLE function and calls it.
FUNCTION PUT(p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_remotepath IN VARCHAR2,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE,
p_port IN PLS_INTEGER DEFAULT 21,
p_filetype IN VARCHAR2 := 'ASCII')
RETURN BOOLEAN
IS
t_files t_ftp_rec;
v_username VARCHAR2(30) := p_username;
v_password VARCHAR2(50) := p_password;
v_hostname VARCHAR2(100) := p_hostname;
n_port PLS_INTEGER := p_port;
v_err_msg VARCHAR2(255);
b_ftp BOOLEAN;
BEGIN
t_files(1).localpath := p_localpath;
t_files(1).filename := p_filename;
t_files(1).remotepath := p_remotepath;
t_files(1).filetype := p_filetype;
t_files(1).transfer_mode := 'PUT';
b_ftp := FTP_MULTIPLE(v_err_msg,
t_files,
v_username,
v_password,
v_hostname,
n_port);
IF b_ftp = FALSE
THEN
v_status := 'ERROR';
v_error_message := v_err_msg;
RETURN FALSE;
ELSIF b_ftp = TRUE
THEN
v_status := t_files(1).status;
v_error_message := t_files(1).error_message;
n_bytes_transmitted := t_files(1).bytes_transmitted;
d_trans_start := t_files(1).trans_start;
d_trans_end := t_files(1).trans_end;
RETURN TRUE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
v_status := 'ERROR';
v_error_message := SQLERRM;
RETURN FALSE;
--DBMS_OUTPUT.PUT_LINE(SQLERRM);
END PUT;
** Convenience function for single-file GET
** Formats file information for FTP_MULTIPLE function and calls it.
FUNCTION GET(p_localpath IN VARCHAR2,
p_filename IN VARCHAR2,
p_remotepath IN VARCHAR2,
p_username IN VARCHAR2,
p_password IN VARCHAR2,
p_hostname IN VARCHAR2,
v_status OUT VARCHAR2,
v_error_message OUT VARCHAR2,
n_bytes_transmitted OUT NUMBER,
d_trans_start OUT DATE,
d_trans_end OUT DATE,
p_port IN PLS_INTEGER DEFAULT 21,
p_filetype IN VARCHAR2 := 'ASCII')
RETURN BOOLEAN
IS
t_files t_ftp_rec;
v_username VARCHAR2(30) := p_username;
v_password VARCHAR2(50) := p_password;
v_hostname VARCHAR2(100) := p_hostname;
n_port PLS_INTEGER := p_port;
v_err_msg VARCHAR2(255);
b_ftp BOOLEAN;
BEGIN
t_files(1).localpath := p_localpath;
t_files(1).filename := p_filename;
t_files(1).remotepath := p_remotepath;
t_files(1).filetype := p_filetype;
t_files(1).transfer_mode := 'GET';
b_ftp := FTP_MULTIPLE(v_err_msg,
t_files,
v_username,
v_password,
v_hostname,
n_port);
IF b_ftp = FALSE
THEN
v_status := 'ERROR';
v_error_message := v_err_msg;
RETURN FALSE;
ELSIF b_ftp = TRUE
THEN
v_status := t_files(1).status;
v_error_message := t_files(1).error_message;
n_bytes_transmitted := t_files(1).bytes_transmitted;
d_trans_start := t_files(1).trans_start;
d_trans_end := t_files(1).trans_end;
RETURN TRUE;
END IF;
EXCEPTION
WHEN OTHERS
THEN
v_status := 'ERROR';
v_error_message := SQLERRM;
RETURN FALSE;
--DBMS_OUTPUT.PUT_LINE(SQLERRM);
END GET;
END BRNC_FTP_PKG;
/ -
Unable to send report output to printer when using RUN_REPORT_OBJECT in 10g
Hello All,
When I try to send my report output to a file from my form(10g), I get 'FRM-41213: Unable to connect to report server'. I can sucessfully send my report to printer when I set the REPORT_DESTYPE to 'PRINTER'.Here is the code from my when-button-pressed trigger.
Am I missing something?
declare
repid REPORT_OBJECT;
v_rep VARCHAR2(100);
rep_status VARCHAR2(20);
BEGIN
repid := find_report_object('PWRR_CTRL_TYP_MAINT');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_SERVER,'rep_ipkcaf7vm');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_EXECUTION_MODE,BATCH);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_COMM_MODE,SYNCHRONOUS);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESTYPE,FILE);
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_DESFORMAT,'DFLT');
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,'C:\TEST1.doc');
v_rep := RUN_REPORT_OBJECT(repid);
rep_status := REPORT_OBJECT_STATUS(v_rep);
WHILE rep_status in ('RUNNING','OPENING_REPORT','ENQUEUED')
LOOP
rep_status := report_object_status(v_rep);
END LOOP;
IF rep_status = 'FINISHED' THEN
msg_alert('Report print successfully', 'I', FALSE);
ELSE
msg_alert('Error when running report', 'I', FALSE);
END IF;
END;
Thanks,
AnnaHi,
its because
SET_REPORT_OBJECT_PROPERTY(repid,REPORT_FILENAME,'C:\TEST1.doc');
references the report rdf pr rep file to run, not the output file. The Reports output file is always specified with DESNAME
Frank -
XP Pro, DELL Latitude D520, Duo... 2 gig RAM, and plenty hdd, stock video chipset (naturally -.-)
After much scouring... i have run into a program on my drive called MRT.exe coupled in the same folder with a MRTSTUB.exe (not case sensative)... I never use iexplore, and immediately remove it from my machine shortly after any fresh installation of XP, and download firefox... other than that, the other things i do online are not likely to have allowed this in, and hijackthis seems to refer to it as a BHO... it came in through firefox guys... it records input, manipulates other programs (firefox), has no visible window and no log in the process manager... however, procedes to take up huge portions of page file memory. Naturally while on firefox... it reroutes me every chance it gets to one of those stupid search pages providing "enhanced searchability for the EXACT product,concept,idea,question that i am looking for -.-" just thought you guys might wanna know... mr t. funny guy -.-
''(Below content copied from [/questions/778647] - TonyE)''
This is a continuation of the last post I had up, it is basically a web site redirect virus that seems to pull up a new window at various times, or while I click on several google searches will intermitantly redirect me to a tizag.com website, or other various search falsity websites...
After several hours of work put into trying to find this bug, removing smaller useless bugs from my system, and so on... I still have the bug on the computer... Now I have taken the liberty of running a process analyzer and stopping the analyzer once the bug started affecting my google, and have a dump of all the processes running, firefox related (since it redirects me it must reach into the firefox.exe process somewhere along the line), and would like to share that with you.
I posted it in the troubleshooting section as it won't fit into this section... and i don't have a troubleshooting information option in my help menu anyhow.
If you can help me figure out which process is being performed here that is unusual as far as firefox content goes, I can search through the memory stacks of those processes and trace this bug back to it's origin... helping myself and you guys in the future.SECOND HALF:
04:54:09,6170592 firefox.exe 2636 CreateFileMapping C:\WINDOWS\system32\MSIMTF.dll SUCCESS SyncType: SyncTypeOther
04:54:09,6171930 firefox.exe 2636 CloseFile C:\WINDOWS\system32\MSIMTF.dll SUCCESS
04:54:09,6197042 firefox.exe 2636 WriteFile C:\Documents and Settings\Owner\Local Settings\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\Cache\_CACHE_001_ SUCCESS Offset: 979 712, Length: 464
04:54:09,6444761 firefox.exe 2636 LockFile C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\content-prefs.sqlite SUCCESS Exclusive: True, Offset: 1 073 741 824, Length: 1, Fail Immediately: True
04:54:09,6446292 firefox.exe 2636 LockFile C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\content-prefs.sqlite SUCCESS Exclusive: False, Offset: 1 073 741 826, Length: 510, Fail Immediately: True
04:54:09,6447773 firefox.exe 2636 UnlockFileSingle C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\content-prefs.sqlite SUCCESS Offset: 1 073 741 824, Length: 1
04:54:09,6449999 firefox.exe 2636 QueryOpen C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\content-prefs.sqlite-journal NAME NOT FOUND
04:54:09,6451782 firefox.exe 2636 QueryStandardInformationFile C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\content-prefs.sqlite SUCCESS AllocationSize: 8 192, EndOfFile: 7 168, NumberOfLinks: 1, DeletePending: False, Directory: False
04:54:09,6454503 firefox.exe 2636 ReadFile C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\content-prefs.sqlite SUCCESS Offset: 24, Length: 16
04:54:09,6456271 firefox.exe 2636 UnlockFileSingle C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\content-prefs.sqlite SUCCESS Offset: 1 073 741 826, Length: 510
04:54:09,6469113 firefox.exe 2636 LockFile C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\signons.sqlite SUCCESS Exclusive: True, Offset: 1 073 741 824, Length: 1, Fail Immediately: True
04:54:09,6470602 firefox.exe 2636 LockFile C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\signons.sqlite SUCCESS Exclusive: False, Offset: 1 073 741 826, Length: 510, Fail Immediately: True
04:54:09,6472061 firefox.exe 2636 UnlockFileSingle C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\signons.sqlite SUCCESS Offset: 1 073 741 824, Length: 1
04:54:09,6474053 firefox.exe 2636 QueryOpen C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\signons.sqlite-journal NAME NOT FOUND
04:54:09,6475706 firefox.exe 2636 QueryStandardInformationFile C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\signons.sqlite SUCCESS AllocationSize: 12 288, EndOfFile: 11 264, NumberOfLinks: 1, DeletePending: False, Directory: False
04:54:09,6477201 firefox.exe 2636 ReadFile C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\signons.sqlite SUCCESS Offset: 24, Length: 16
04:54:09,6479226 firefox.exe 2636 UnlockFileSingle C:\Documents and Settings\Owner\Application Data\Mozilla\Firefox\Profiles\314qtu41.default\signons.sqlite SUCCESS Offset: 1 073 741 826, Length: 510
04:54:09,6489971 firefox.exe 2636 QueryOpen C:\WINDOWS\system32\MSIMTF.dll SUCCESS CreationTime: 14.04.2008 07:00:00, LastAccessTime: 22.01.2011 04:54:09, LastWriteTime: 14.04.2008 07:00:00, ChangeTime: 26.09.2009 19:55:19, AllocationSize: 159 744, EndOfFile: 159 232, FileAttributes: A
04:54:09,6491722 firefox.exe 2636 CreateFile C:\WINDOWS\system32\MSIMTF.dll SUCCESS Desired Access: Execute/Traverse, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened
04:54:09,6493061 firefox.exe 2636 CreateFileMapping C:\WINDOWS\system32\MSIMTF.dll SUCCESS SyncType: SyncTypeCreateSection, PageProtection: PAGE_EXECUTE
04:54:09,6493192 firefox.exe 2636 QueryStandardInformationFile C:\WINDOWS\system32\MSIMTF.dll SUCCESS AllocationSize: 159 744, EndOfFile: 159 232, NumberOfLinks: 1, DeletePending: False, Directory: False
04:54:09,6493399 firefox.exe 2636 CreateFileMapping C:\WINDOWS\system32\MSIMTF.dll SUCCESS SyncType: SyncTypeOther
04:54:09,6494751 firefox.exe 2636 CloseFile C:\WINDOWS\system32\MSIMTF.dll SUCCESS
04:54:09,6500151 firefox.exe 2636 QueryOpen C:\WINDOWS\system32\MSIMTF.dll SUCCESS CreationTime: 14.04.2008 07:00:00, LastAccessTime: 22.01.2011 04:54:09, LastWriteTime: 14.04.2008 07:00:00, ChangeTime: 26.09.2009 19:55:19, AllocationSize: 159 744, EndOfFile: 159 232, FileAttributes: A
04:54:09,6501802 firefox.exe 2636 CreateFile C:\WINDOWS\system32\MSIMTF.dll SUCCESS Desired Access: Execute/Traverse, Synchronize, Disposition: Open, Options: Synchronous IO Non-Alert, Non-Directory File, Attributes: n/a, ShareMode: Read, Delete, AllocationSize: n/a, OpenResult: Opened
04:54:09,6503090 firefox.exe 2636 CreateFileMapping C:\WINDOWS\system32\MSIMTF.dll SUCCESS SyncType: SyncTypeCreateSection, PageProtection: PAGE_EXECUTE
04:54:09,6503204 firefox.exe 2636 QueryStandardInformationFile C:\WINDOWS\system32\MSIMTF.dll SUCCESS AllocationSize: 159 744, EndOfFile: 159 232, NumberOfLinks: 1, DeletePending: False, Directory: False
04:54:09,6503411 firefox.exe 2636 CreateFileMapping C:\WINDOWS\system32\MSIMTF.dll SUCCESS SyncType: SyncTypeOther
04:54:09,6504746 firefox.exe 2636 CloseFile C:\WINDOWS\system32\MSIMTF.dll SUCCESS
04:54:09,6588123 firefox.exe 2636 Thread Exit SUCCESS Thread ID: 3540, User Time: 0.0000000, Kernel Time: 0.0000000
04:54:09,6602960 firefox.exe 2636 RegOpenKey HKLM\Software\Speedbit\Download Accelerator SUCCESS Desired Access: Query Value
04:54:09,6603373 firefox.exe 2636 RegQueryValue HKLM\SOFTWARE\SpeedBit\Download Accelerator\Log SUCCESS Type: REG_DWORD, Length: 4, Data: 0
04:54:09,6603714 firefox.exe 2636 RegCloseKey HKLM\SOFTWARE\SpeedBit\Download Accelerator SUCCESS -
How can I delete a dir which has sub-dir's ?
Dear list,
Can some one send me a link or send me a code example of how to delete all the sub- directories in a specified directory. My dir has sub-directories which contain files!
If I use the java.io package I must loop all the sub- directories, and java.io.File.delete() wont delete a dir when it contains files, so I will have to go into each sub-dir and delete the files before deleting the sub-dir. This is going to be a lot of code, and YES ! I am a little lazy!
Is there a java package, with a method, where I can just delete a dir, which just deletes it and ALL its contents ?
regards
BB// Delete an empty directory
boolean success = (new File("directoryName")).delete();
if (!success) {
// Deletion failed
}If the directory is not empty, it is necessary to first recursively delete all files and subdirectories in the directory. Here is a method that will delete a non-empty directory. // Deletes all files and subdirectories under dir.
// Returns true if all deletions were successful.
// If a deletion fails, the method stops attempting to delete and returns false.
public static boolean deleteDir(File dir) {
if (dir.isDirectory()) {
String[] children = dir.list();
for (int i=0; i<children.length; i++) {
boolean success = deleteDir(new File(dir, children));
if (!success) {
return false;
// The directory is now empty so delete it
return dir.delete(); -
How to create a more general install package for an AIR app?
Hi,
I have been using the ADT to compile an exe of my AIR app along with some other files I want to distribute. Problem is, I would like to do more general install actions (e.g. copy a bunch of files to the users Documents directory, copy a file to the local store, install fonts etc). Right now I achieve some of these by copying stuff from the application directory on the first run, but that is rather kludgy. Currently I am looking at using InstallShield or InstallAnywhere to do what I want out of the can, but I thought I'd see if anyone has some more AIR-friendly suggestions...
Thanks!In my case I managed to work around the issues we were having by doing a configuration pass on the first run of the app. That means I had to basically put all the data I needed in my assets directory using the ADT compiler, then determine if it is a first run as follows:
var locationPrefsObj:SharedObject = SharedObject.getLocal("PrefsObj");
if ( !locationPrefsObj.data.hasOwnProperty("appCreatedDate")
|| ( locationPrefsObj.data.appCreatedDate != File.applicationDirectory.creationDate.toString() ) )
firstRun();
else {
initConfig();
// initialize an existing config
The firstRun function will obviously be very bespoke, but you need to set the SharedObject at the end of it to make sure it doesn't get called every time.
// this function is only run straight after an install
private function firstRun():void {
var success:Boolean = false;
// do your first run stuff here and mark success=true if you are happy
if ( success ) {
// set the appCreatedDate - then a future install can identify dirt left by the previous install
var locationPrefsObj:SharedObject = SharedObject.getLocal("PrefsObj");
locationPrefsObj.data.appCreatedDate = File.applicationDirectory.creationDate.toString();
locationPrefsObj.flush();
Other gotchas I hit:
(1) You can copy things from the assets folder no problem, but to move or delete anything (so as not to leave lots of extra stuff hanging around), you need to (a) run with administrator privileges on Vista and w7 (the elevation happens automatically if you leave the "Run after install" box checked on an ADT install), and (b) work around the Flash security model that says you can't delete anything from a subdirectory of Program Files under any circumstances. I got around this by something like:
// delete a file
new File(File.applicationDirectory.resolvePath("assets/fileToBeDeleted").nativePath).deleteFi le();
It's a bit nasty as it violates the security model, but until ADT lets you put stuff in two install locations I can't see another way to clean up the install properly.
(2) I tried to install fonts (using VB and other stuff), but it is a real mess - the models in all different flavours of Windows seem to be different. I gave up as our software could get around it another way ...
Hope that helps! -
Using a for-each for a CallObject
Hello everyone,
i am having trouble to get the following scenario to work:
1. SQL Call is prepared and called
2. Branch with a condition whether there is a payment related to an invoice
3. For-Each record of the resultset a cancellation will be called by using a B1Objectcall with cancellation method
The for-each is configurated like this:
/vpf:Msg/vpf:Body/vpf:Payload[@Role='C']/jdbc:ResultSet/jdbc:Row
The path is configurated like this:
/vpf:Msg/vpf:Body/vpf:Payload[./@id='atom36']/jdbc:ResultSet[./@rowCount>'0']
My problem is the preparation of the xsl-transformation to access the DocEntry of each record. This is my xml.
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:b1e="urn:com.sap.b1i.sim:b1event" xmlns:b1ie="urn:com.sap.b1i.sim:b1ievent" xmlns:b1im="urn:com.sap.b1i.sim:b1imessage" xmlns:bfa="urn:com.sap.b1i.bizprocessor:bizatoms" xmlns:jdbc="urn:com.sap.b1i.adapter:jdbcadapter" xmlns:rfc="urn:sap-com:document:sap:rfc:functions" xmlns:sim="urn:com.sap.b1i.sim:entity" xmlns:utils2="com.sap.b1i.bpc_tools.Utilities" xmlns:vpf="urn:com.sap.b1i.vplatform:entity" xmlns:xci="urn:com.sap.b1i.xcellerator:intdoc" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" bfa:force="" vpf:force="" jdbc:force="" rfc:force="" b1ie:force="" b1e:force="" xci:force="" sim:force="" utils2:force="" b1im:force="">
<xsl:output method="xml" encoding="UTF-8" indent="yes"/>
<xsl:param name="atom"/>
<xsl:param name="sessionid"/>
<xsl:variable name="msg" select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='S']"/>
<xsl:variable name="msg2" select="/vpf:Msg/vpf:Body/vpf:Payload[@Role='C']/jdbc:ResultSet/jdbc:Row"/>
<xsl:variable name="vpSender" select="/vpf:Msg/vpf:Header/vpf:Sender/@Id"/>
<xsl:variable name="vpObject" select="/vpf:Msg/vpf:Header/vpf:Sender/@ObjId"/>
<xsl:variable name="vpReceiver" select="/vpf:Msg/vpf:Header/vpf:ReceiverList/vpf:Receiver[./@handover='P']/@Id"/>
<xsl:variable name="vpSysId" select="/vpf:Msg/vpf:Header/vpf:Variables/vpf:var[./@id='SysId']/@value"/>
<xsl:template match="/">
<Msg xmlns="urn:com.sap.b1i.vplatform:entity">
<xsl:copy-of select="/vpf:Msg/@*"/>
<xsl:copy-of select="/vpf:Msg/vpf:Header"/>
<Body>
<xsl:copy-of select="/vpf:Msg/vpf:Body/*"/>
<Payload Role="X" id="{$atom}">
<xsl:call-template name="transform"/>
</Payload>
</Body>
</Msg>
</xsl:template>
<xsl:template name="transform">
<Value xmlns="">
<xsl:value-of select="$msg2/DocEntry"/>
</Value>
</xsl:template>
</xsl:stylesheet>
This is the inbound message on the path:
<Msg xmlns="urn:com.sap.b1i.vplatform:entity" MessageId="14123112452456040534C0A800138613" BeginTimeStamp="20141231124524" logmsg="0000" SubMessageId="" status="success" owntst="false" test="true">
<Header>
<IPO Id="INB_IQ_INTQ_ASYN_QS" tid="14123109281856033321C0A80013BACE" />
<IPO Id="PRC_QS" tid="14123109281856033506C0A8001381B0" />
<msglog step="Default message log" always="false" b1ifactive="true" />
<Resumption>
<starter ipo="/vP.0010000000.in_IQ/com.sap.b1i.vplatform.runtime/INB_IQ_INTQ_ASYN_QS/INB_IQ_INTQ_ASYN_QS.ipo/proc" />
<restart id="processing" q="Q.PRC_QS.0010000000" s="S.sap.DRFISQueuertFIS" u="14123112231756033345C0A800139613.4" />
</Resumption>
<ProcStream>S.sap.DRFISQueuertFIS</ProcStream>
<Sender Id="0010000000" ObjId="sap.DetailReportFIS" />
<Successor Id="" Mode="" />
<Identification Ident="Queue/Stream" IdPar="n.a." />
<nsList>
<ns id="b1mb" ns="http://tempuri.org/" />
</nsList>
<ReceiverList>
<Receiver Id="0010000000" filter="" />
</ReceiverList>
<Retrieval type="Handover" />
<Outbound type="Void" channel="VOID" />
<vBIU Id="sap.DRFISQueue" ver="1.0.0" SId="sap.Files" filter="" phase="" />
<Variables>
<var id="userid" value="no_authentication" />
<var id="username" value="no_authentication" />
<var id="SysId" value="0010000117" />
</Variables>
<Properties />
<SysTypeProperties type="B1if" offline="" snd="0010000000" rcv="receiverdummy" ssystype="B1i.20" rsystype="" />
<LocalProperties type="B1if" biu="sap.DRFISQueue" snd="0010000000" rcv="receiverdummy" sid="sap.Files" offline="" />
<VarProperties>
<property call="callb1obj.bfd" atom="atom3" id="SysId" value="#0010000117" />
<property call="callsql.bfd" atom="atom36" id="SysId" value="#0010000117" />
</VarProperties>
</Header>
<Body>
<Payload Role="T" Type="Queue" add="sap.DetailReportFIS" />
<Payload Role="S">
<Document xmlns="">
<row>
<BuchungsID>47662</BuchungsID>
<Datum>15.12.2014</Datum>
<VertragspartnerID>61</VertragspartnerID>
<Firmenname>Software Integrator</Firmenname>
<KreditorenID>K123456</KreditorenID>
<Kreditor>Intrum Justitia AG</Kreditor>
<ForderungsID>9015</ForderungsID>
<Rechnungsnummer>121</Rechnungsnummer>
<Buchungstyp>DEBTCLAIM_REVOKE</Buchungstyp>
<Buchungstext>Forderungsruecknahme</Buchungstext>
<Waehrung>CHF</Waehrung>
<Nettobetrag>-7560.00</Nettobetrag>
<MwStSatz>0</MwStSatz>
<MwStBetrag>0</MwStBetrag>
<Bruttobetrag>-7560.00</Bruttobetrag>
<Verrechnungsposition>n</Verrechnungsposition>
</row>
</Document>
</Payload>
<Payload Role="X" id="atom35">
<row xmlns="">
<Value>SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')</Value>
<Value2>Update OINV set U_sapSTORNF = '1' WHERE DocEntry = '121'</Value2>
</row>
</Payload>
<Payload Role="C" id="atom36" system="0010000117" mode="single" method="Automatic detection by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false" compatibilityMode="true" delimiter=";" sql="SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')" disable-output-escaping="false">
<ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1">
<Row>
<DocNum>163</DocNum>
</Row>
</ResultSet>
</Payload>
<Payload Role="C" id="atom48" status="ok" input="atom35" queue="Q.INB_IQ_INTQ_ASYN_QS.0010000000" stream="sap.DRFISQueue3" />
<Payload Role="X" id="atom33">
<row xmlns="">
<Value>163</Value>
</row>
</Payload>
</Body>
</Msg>Hello everyone,
THis is how my stuff looks now:
i have tried the above named solutions but i think, that as soon as i am checking the inbound parameter of the for-each it says something like that:
- <ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1">
- <Row>
<DocNum>163</DocNum>
</Row>
</ResultSet>
While in the path i have got a such inbound parameter:
the code just shows the sql call and the X Role of atom33 where i am using the personal tag
- <Payload Role="C" id="atom36" system="0010000117" mode="single" method="Automatic detection by key word(Automatic detection by key word)" plr="4" dbtype="SQL" blockExecution="false" compatibilityMode="true" delimiter=";" sql="SELECT T0.DocNum FROM ORCT T0 WHERE T0.Canceled ='N' AND T0.DocNum IN (SELECT T1.DocNum FROM ORCT T0 INNER JOIN RCT2 T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OINV T2 ON T1.DocEntry = T2.DocNum WHERE T2.DocNum = '121')" disable-output-escaping="false">
- <ResultSet xmlns="urn:com.sap.b1i.adapter:jdbcadapter" rowCount="1">
- <Row>
<DocNum>163</DocNum>
</Row>
</ResultSet>
</Payload>
<Payload Role="C" id="atom48" status="ok" input="atom35" queue="Q.INB_IQ_INTQ_ASYN_QS.0010000000" stream="sap.DRFISQueue3" />
- <Payload Role="X" id="atom33">
<DocId xmlns="">163</DocId>
</Payload>
</Body>
This is my call object configuration
This message is the Key Value:
/vpf:Msg/vpf:Body/vpf:Payload[./@Role='X' and ./@id='atom33']/DocId
This is my atom33:
<xsl:for-each select="/vpf:Msg/vpf:Body/vpf:Payload[./@Role='C' and ./@id='atom36']/jdbc:ResultSet/jdbc:Row">
<DocId xmlns="">
<xsl:value-of select="jdbc:DocNum"/>
</DocId>
</xsl:for-each>
When checking the message of the join inbound it shows the following:
So it seems that at some point i am completely losing some inbound message (such as the atom33).
- <Msg xmlns="urn:com.sap.b1i.vplatform:entity">
- <Body>
- <Payload Role="X" id="atom56">
<DocId2 xmlns="" />
</Payload>
- <Payload Role="C" id="atom55" system="0010000117">
<B1CallResult status="failure" b1login="Technical User" method="Synchronous Cancel" objectid="24" payload="atom56" keyname="DocEntry" keyvalue="" />
</Payload>
</Body>
</Msg>
This is the atom56 config, which is just a tryout. Or do I use a wrong payload in my call object?
Help is greatly appreciated.
Regards Simon -
Problem OIM OID Ldap Sync Configuration in 11g.
Hi Team,
I am doing OIM and OID LDAP Sync configuration There It is failed in "Configuration Process" Step.
and also in weblogic OIM Maganaged server in ADMIN mode not in running mode.
please find the both logs.
*********************************Weblogic Logs**********************************************
Enter username to boot WebLogic server:weblogic
Enter password to boot WebLogic server:
<28-Sep-2012 14:07:44 o'clock BST> <Info> <Management> <BEA-141107> <Version: We
bLogic Server 10.3.5.0 Fri Apr 1 20:20:06 PDT 2011 1398638 >
<28-Sep-2012 14:07:47 o'clock BST> <Notice> <WebLogicServer> <BEA-000365> <Serve
r state changed to STARTING>
<28-Sep-2012 14:07:47 o'clock BST> <Info> <WorkManager> <BEA-002900> <Initializi
ng self-tuning thread pool>
<28-Sep-2012 14:07:48 o'clock BST> <Notice> <Log Management> <BEA-170019> <The s
erver log file E:\Oracle\Middleware\user_projects\domains\IAM_domain\servers\oim
server1\logs\oimserver1.log is opened. All server side log events will be writ
ten to this file.>
28-Sep-2012 14:07:56 oracle.security.am.common.nap.util.NAPLogger log
SEVERE: Failed to communicate with any of configured Access Server, ensure that
it is up and running.
<28-Sep-2012 14:07:57 o'clock BST> <Notice> <Security> <BEA-090082> <Security in
itializing using security realm myrealm.>
<28-Sep-2012 14:08:04 o'clock BST> <Notice> <WebLogicServer> <BEA-000365> <Serve
r state changed to STANDBY>
<28-Sep-2012 14:08:04 o'clock BST> <Notice> <WebLogicServer> <BEA-000365> <Serve
r state changed to STARTING>
<28-Sep-2012 14:08:20 o'clock BST> <Warning> <oracle.jps.upgrade> <JPS-06003> <C
annot migrate credential folder/key ADF/anonymous#oimBpelCredKey.Reason oracle.s
ecurity.jps.service.credstore.CredentialAlreadyExistsException: JPS-01007: The c
redential with map ADF and key anonymous#oimBpelCredKey already exists..>
<28-Sep-2012 14:08:21 o'clock BST> <Warning> <oracle.adf.share.ADFContext> <BEA-
000000> <Automatically initializing a DefaultContext for getCurrent.
Caller should ensure that a DefaultContext is proper for this use.
Memory leaks and/or unexpected behaviour may occur if the automatic initializati
on is performed improperly.
This message may be avoided by performing initADFContext before using getCurrent
To see the stack trace for thread that is initializing this, set the logging lev
el of oracle.adf.share.ADFContext to FINEST>
<28-Sep-2012 14:08:24 o'clock BST> <Error> <Deployer> <BEA-149205> <Failed to in
itialize the application 'oim [Version=11.1.1.3.0]' due to error oracle.iam.plat
form.utils.OIMAppInitializationException:
OIM application intialization failed because of the following reasons:
oim-config.xml was not found in MDS Repository.
Unable to find keystore ".xldatabasekey" in <DOMAIN_HOME>/config/fmwconfig/.
Password for OIMSchemaPassword is not seeded in CSF.
Password for xell is not seeded in CSF.
Password for DataBaseKey is not seeded in CSF.
Password for JMSKey is not seeded in CSF.
Password for .xldatabasekey is not seeded in CSF.
Password for default-keystore.jks is not seeded in CSF.
Password for SOAAdminPassword is not seeded in CSF.
oracle.iam.platform.utils.OIMAppInitializationException:
OIM application intialization failed because of the following reasons:
oim-config.xml was not found in MDS Repository.
Unable to find keystore ".xldatabasekey" in <DOMAIN_HOME>/config/fmwconfig/.
Password for OIMSchemaPassword is not seeded in CSF.
Password for xell is not seeded in CSF.
Password for DataBaseKey is not seeded in CSF.
Password for JMSKey is not seeded in CSF.
Password for .xldatabasekey is not seeded in CSF.
Password for default-keystore.jks is not seeded in CSF.
Password for SOAAdminPassword is not seeded in CSF.
at oracle.iam.platform.utils.OIMAppInitializationListener.preStart(OIMAp
pInitializationListener.java:145)
at weblogic.application.internal.flow.BaseLifecycleFlow$PreStartAction.r
un(BaseLifecycleFlow.java:282)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
120)
at weblogic.application.internal.flow.BaseLifecycleFlow$LifecycleListene
rAction.invoke(BaseLifecycleFlow.java:199)
Truncated. see log file for complete stacktrace
Caused By: oracle.iam.platform.utils.OIMAppInitializationException:
OIM application intialization failed because of the following reasons:
oim-config.xml was not found in MDS Repository.
Unable to find keystore ".xldatabasekey" in <DOMAIN_HOME>/config/fmwconfig/.
Password for OIMSchemaPassword is not seeded in CSF.
Password for xell is not seeded in CSF.
Password for DataBaseKey is not seeded in CSF.
Password for JMSKey is not seeded in CSF.
Password for .xldatabasekey is not seeded in CSF.
Password for default-keystore.jks is not seeded in CSF.
Password for SOAAdminPassword is not seeded in CSF.
at oracle.iam.platform.utils.OIMAppInitializationListener.preStart(OIMAp
pInitializationListener.java:145)
at weblogic.application.internal.flow.BaseLifecycleFlow$PreStartAction.r
un(BaseLifecycleFlow.java:282)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(Authenticate
dSubject.java:321)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:
120)
at weblogic.application.internal.flow.BaseLifecycleFlow$LifecycleListene
rAction.invoke(BaseLifecycleFlow.java:199)
Truncated. see log file for complete stacktrace
>
<28-Sep-2012 14:08:24 o'clock BST> <Warning> <Munger> <BEA-2156203> <A version a
ttribute was not found in element application in the deployment descriptor in E:
\Oracle\Middleware\Oracle_IDM1\server\apps\spml-xsd.ear/META-INF/application.xml
. A version attribute is required, but this version of the Weblogic Server will
assume that the JEE5 is used. Future versions of the Weblogic Server will reject
descriptors that do not specify the JEE version.>
<28-Sep-2012 14:08:24 o'clock BST> <Warning> <Munger> <BEA-2156203> <A version a
ttribute was not found in element application in the deployment descriptor in E:
\Oracle\Middleware\user_projects\domains\IAM_domain\servers\oim_server1\tmp\_WL_
user\spml-xsd\s8d2b9/META-INF/application.xml. A version attribute is required,
but this version of the Weblogic Server will assume that the JEE5 is used. Futur
e versions of the Weblogic Server will reject descriptors that do not specify th
e JEE version.>
<28-Sep-2012 14:08:24 o'clock BST> <Emergency> <Deployer> <BEA-149259> <Server '
oim_server1' in cluster 'OIM_Cluster' is being brought up in administration stat
e due to failed deployments.>
Loading xalan.jar for XPathAPI.
14:08:30 INFO [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default
(self-tuning)'] -
----------------- NEXAWEB SERVER LICENSE ------------------
- Customer ID : 122
- License type : Enterprise
- Max unique IPs : unlimited
- Max XUL sessions : unlimited
- Max CPUs/server : unlimited
- Clustering allowed : true
- Expiration date : none
Nexaweb Technologies Inc.(C)2000-2004. All Rights Reserved.
Nexaweb Technologies Inc.
10 Canal Park
Cambridge, MA 02141
Tel: 617.577.8100. Email: [email protected]
14:08:31 INFO [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default
(self-tuning)'] - Clustering is OFF.
14:08:31 INFO [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default
(self-tuning)'] - Servlet Engine: WebLogic Server 10.3.5.0 Fri Apr 1 20:20:06 PD
T 2011 1398638 Oracle WebLogic Server Module Dependencies 10.3 Thu Mar 3 14:37:5
2 PST 2011 Oracle WebLogic Server on JRockit Virtual Edition Module Dependencies
10.3 Thu Feb 3 16:30:47 EST 2011
14:08:31 INFO [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default
(self-tuning)'] - Servlet API Version: 2.5
14:08:31 INFO [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default
(self-tuning)'] - Nexaweb Server Info = Nexaweb Server 3.3.1072
14:08:31 INFO [[STANDBY] ExecuteThread: '2' for queue: 'weblogic.kernel.Default
(self-tuning)'] - Nexaweb Server initialized successfully.
<28-Sep-2012 14:08:34 o'clock BST> <Notice> <Log Management> <BEA-170027> <The S
erver has established connection with the Domain level Diagnostic Service succes
sfully.>
<28-Sep-2012 14:08:34 o'clock BST> <Notice> <Cluster> <BEA-000197> <Listening fo
r announcements from cluster using unicast cluster messaging>
<28-Sep-2012 14:08:34 o'clock BST> <Notice> <Cluster> <BEA-000133> <Waiting to s
ynchronize with other running members of OIM_Cluster.>
<28-Sep-2012 14:09:04 o'clock BST> <Notice> <Server> <BEA-002613> <Channel "Defa
ult[2]" is now listening on 127.0.0.1:14000 for protocols iiop, t3, CLUSTER-BROA
DCAST, ldap, snmp, http.>
<28-Sep-2012 14:09:04 o'clock BST> <Notice> <Server> <BEA-002613> <Channel "Defa
ult[3]" is now listening on 0:0:0:0:0:0:0:1:14000 for protocols iiop, t3, CLUSTE
R-BROADCAST, ldap, snmp, http.>
<28-Sep-2012 14:09:04 o'clock BST> <Notice> <Server> <BEA-002613> <Channel "Defa
ult[1]" is now listening on fe80:0:0:0:0:5efe:a2f:f22a:14000 for protocols iiop,
t3, CLUSTER-BROADCAST, ldap, snmp, http.>
<28-Sep-2012 14:09:04 o'clock BST> <Warning> <Server> <BEA-002611> <Hostname "UK
SHWTOAP03A.skandia.co.uk", maps to multiple IP addresses: 10.47.242.42, 0:0:0:0:
0:0:0:1>
<28-Sep-2012 14:09:04 o'clock BST> <Notice> <Server> <BEA-002613> <Channel "Defa
ult" is now listening on 10.47.242.42:14000 for protocols iiop, t3, CLUSTER-BROA
DCAST, ldap, snmp, http.>
<28-Sep-2012 14:09:04 o'clock BST> <Notice> <WebLogicServer> <BEA-000330> <Start
ed WebLogic Managed Server "oim_server1" for domain "IAM_domain" running in Prod
uction Mode>
<28-Sep-2012 14:09:04 o'clock BST> <Notice> <WebLogicServer> <BEA-000365> <Serve
r state changed to ADMIN>
<28-Sep-2012 14:09:04 o'clock BST> <Notice> <WebLogicServer> <BEA-000360> <Serve
r started in ADMIN mode>
**********************************OIM OID Ldap Sync Configuration Logs****************************
[2012-09-28T14:49:11.171+01:00] [as] [NOTIFICATION] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [[
[OIM_CONFIG] Updating Ldap Sync Configuration
[2012-09-28T14:49:11.171+01:00] [as] [TRACE:16] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: LdapSync] [SRC_METHOD: configurationLdap] ENTRY
[2012-09-28T14:49:11.171+01:00] [as] [TRACE] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: oracle.as.install.oim.config.util.LdapSync] [SRC_METHOD: configurationLdap] Create the Database connection
[2012-09-28T14:49:11.171+01:00] [as] [TRACE:16] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: LdapSync] [SRC_METHOD: createDBConnection] ENTRY
[2012-09-28T14:49:11.296+01:00] [as] [TRACE] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: oracle.as.install.oim.config.util.LdapSync] [SRC_METHOD: configurationLdap] isLIBOVD:true
[2012-09-28T14:49:11.312+01:00] [as] [TRACE:16] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: LdapSync] [SRC_METHOD: closeDBConnection] ENTRY
[2012-09-28T14:49:11.312+01:00] [as] [TRACE:16] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: LdapSync] [SRC_METHOD: closeDBConnection] RETURN
[2012-09-28T14:49:11.312+01:00] [as] [TRACE:16] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: LdapSync] [SRC_METHOD: configurationLdap] RETURN
[2012-09-28T14:49:11.312+01:00] [as] [NOTIFICATION] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [[
Updated LDAP Server Details in mds schema
[2012-09-28T14:49:11.312+01:00] [as] [TRACE:16] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: LdapSync] [SRC_METHOD: configurationLdap] RETURN
[2012-09-28T14:49:11.812+01:00] [as] [NOTIFICATION] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [OIM_CONFIG] Updated LDAPContainerRules.xml.
[2012-09-28T14:49:11.812+01:00] [as] [TRACE:16] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [SRC_CLASS: mdsMetadata] [SRC_METHOD: loadEventhandler] RETURN
[2012-09-28T14:49:14.687+01:00] [as] [NOTIFICATION] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [[
[OIM_CONFIG] Created jobs using seedSchedulerData. Log location C:\Program Files\Oracle\Inventory\logs
[2012-09-28T14:49:14.687+01:00] [as] [ERROR] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] File not found[[
java.io.FileNotFoundException: File not found
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:117)
at java.util.jar.JarFile.<init>(JarFile.java:135)
at java.util.jar.JarFile.<init>(JarFile.java:72)
at oracle.as.install.oim.config.util.RoleSODJarUtil.updateFile(RoleSODJarUtil.java:32)
at oracle.as.install.oim.config.OIMConfigManager.configureOIM(OIMConfigManager.java:783)
at oracle.as.install.oim.config.OIMConfigManager.doExecute(OIMConfigManager.java:538)
at oracle.as.install.engine.modules.configuration.client.ConfigAction.execute(ConfigAction.java:335)
at oracle.as.install.engine.modules.configuration.action.TaskPerformer.run(TaskPerformer.java:87)
at oracle.as.install.engine.modules.configuration.action.TaskPerformer.startConfigAction(TaskPerformer.java:104)
at oracle.as.install.engine.modules.configuration.action.ActionRequest.perform(ActionRequest.java:15)
at oracle.as.install.engine.modules.configuration.action.RequestQueue.perform(RequestQueue.java:63)
at oracle.as.install.engine.modules.configuration.standard.StandardConfigActionManager.start(StandardConfigActionManager.java:158)
at oracle.as.install.engine.modules.configuration.boot.ConfigurationExtension.kickstart(ConfigurationExtension.java:81)
at oracle.as.install.engine.modules.configuration.ConfigurationModule.run(ConfigurationModule.java:83)
at java.lang.Thread.run(Thread.java:662)
[2012-09-28T14:49:14.687+01:00] [as] [NOTIFICATION] [] [oracle.as.provisioning] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] [[
[OIM_CONFIG] Failed configuration step Configure OIM Server
[2012-09-28T14:49:14.702+01:00] [as] [ERROR] [] [oracle.as.install.engine.modules.configuration.standard.StandardConfigActionManager] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] One or More configurations failed. Exiting
[2012-09-28T14:49:14.702+01:00] [as] [NOTIFICATION] [] [oracle.as.install.engine.modules.statistics] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] Install Adapter: Mark End for:CONFIG
[2012-09-28T14:49:14.702+01:00] [as] [NOTIFICATION] [] [oracle.as.install.engine.modules.statistics] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] Install Adapter: Mark End for:INTERVIEW
[2012-09-28T14:49:14.702+01:00] [as] [NOTIFICATION] [] [oracle.as.install.engine.modules.statistics] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] Install Adapter: Mark End for:INSTALL
[2012-09-28T14:49:14.702+01:00] [as] [NOTIFICATION] [] [oracle.as.install.engine.modules.statistics] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] Install Adapter: Mark End for:COPY
[2012-09-28T14:49:14.702+01:00] [as] [NOTIFICATION] [] [oracle.as.install.engine.modules.statistics] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] Install Adapter: Mark End for:LINK
[2012-09-28T14:49:14.765+01:00] [as] [NOTIFICATION] [] [oracle.as.install.engine] [tid: 12] [ecid: 0000JcD8obD9pYjpp0_AiY1GPQHh000003,0] Setting valueOf(IS CONFIGURATION SUCCESSFUL) to:false. Value obtained from:USER
[2012-09-28T15:11:21.461+01:00] [as] [NOTIFICATION] [] [oracle.as.install.engine] [tid: 11] [ecid: 0000JcD2jfD9pYjpp0_AiY1GPQHh000002,0] Setting valueOf(IS CONFIGURATION SUCCESSFUL) to:false. Value obtained from:USER
[2012-09-28T15:11:27.914+01:00] [as] [NOTIFICATION] [] [oracle.as.install.engine] [tid: 11] [ecid: 0000JcD2jfD9pYjpp0_AiY1GPQHh000002,0] Setting valueOf(IS CONFIGURATION SUCCESSFUL) to:false. Value obtained from:USER
Regards,
Ravi.Your log files too give some hint... Please verify whether following files like .xldatabasekey are present in your environment:-
OIM application intialization failed because of the following reasons:
oim-config.xml was not found in MDS Repository.
Unable to find keystore ".xldatabasekey" in <DOMAIN_HOME>/config/fmwconfig/.
Password for OIMSchemaPassword is not seeded in CSF.
Password for xell is not seeded in CSF.
Password for DataBaseKey is not seeded in CSF.
Password for JMSKey is not seeded in CSF.
Password for .xldatabasekey is not seeded in CSF.
Password for default-keystore.jks is not seeded in CSF.
Password for SOAAdminPassword is not seeded in CSF.
I doubt whether OIM is properly installed in your environment otherwise .xldatabasekey would have been present in <DOMAIN_HOME>/config/fmwconfig..
Also, as far as Weblogic starting in ADMIN mode is concerned, you may try to do the following...
ps -eaf| grep AdminServer
Kill the process
Then remove the lok file. i.e. Lock files...
rm -rf /home/oracle/Oracle/Middleware/user_projects/domains/oimdomain/servers/oim_server1/tmp/*oim_server1.lok*
rm -rf /home/oracle/Oracle/Middleware/user_projects/domains/oimdomain/servers/soa_server1/tmp/*soa_server1.lok*
rm -rf /home/oracle/Oracle/Middleware/user_projects/domains/oimdomain/servers/AdminServer/tmp/*AdminServer.lok*
After that
Take the backup of /home/oracle/Oracle/Middleware/user_projects/domains/<DOMAIN_HOME>/servers/AdminServer/data/ldap/ldapfiles (I mean CUT this folder and save it in Backup folder..
Share the result with us....
Maybe you are looking for
-
Why can't my Lion airport utility find any of my routers?
I recently installed Lion on my 2008 MBP. Now the new airport utility cannot find any of my routers. However, my G5 leopard imac can still see my airport express and airport extreme routers. All I see on my MBP is a globe with an orange circle and th
-
and it wont stop help me ****** Windows XP none
-
"Heredoc" syntax is a feature of PHP that has been around for quite some time (since its inception, as far as I know). However, it still goes unsupported in Dreamweaver! If you're unfamiliar with it, read about it here: http://www.php.net/manual/en/l
-
Can I reorder a printed book without Iphoto?
I made a book in iphoto with pictures of my kids, but I am also about to sell my imac. Some family members would like a copy, but can't give me the money for the book before the sale. Is there a way I can call apple prints to reorder the book like a
-
Hi, I will perform backup data for a Catalyst switch failure. SNMP agent feature is enabled on the switch, and the switch is configured the following configuration: snmp-server ifindex persist Should I backup nvram:ifIndex-table from the switch fo