Generate dummy XML for an empty input text file

Hi All,
i know when XI gets an empty input text file, it does not generate a send message for it in sender communication channel.
in my scenario, if i get a file with data, i have to generate an XML message for it using file content conversion - this i have done...........
but if i get an empty text file, then i have to generate a dummy XML send message for it for my BPM.......
<b>Has anybody generated a dummy XML message for an empty input file........please respond only if you have practically generated a XML message in SXMB_MONI for an empty input text file.</b>
Thanks,
Rajeev Gupta

Hi All,
i made a J2EE adapter module to generate dummy xml for empty file.....but when i give a file with data in it, then my adapter module is called..... but when i give an empty file, then my adapter module is not called.........
so if somebody has practically generated a dummy XML for an empty file by any method, please tell.
Thanks,
Rajeev Gupta

Similar Messages

  • How to create empty text file on target system for empty source text file

    Hi All,
    I have an issue in handling empty file in the Text (FCC) to Text (FCC) file scenario. Interface picks text file and delivers on target system as text file. I have used FCC in both sender and receiver CCs.
    Interface is working fine if the source file is not empty. If the source text file is empty (zero Bytes), interface has to delivery an empty text file on target system.  I have setup empty file handling options correctly on both CCs.
    But when I tried with an empty file I am getting the error message 'Parsing an empty source. Root element expected!'.
    Could you please suggest me what I need to do to create an empty text file on target system from empty source text file?
    Thanks in Advance....
    Regards
    Sreeni

    >
    Sreenivasulu Reddy jonnavarapu wrote:
    > Hi All,
    >
    > I have an issue in handling empty file in the Text (FCC) to Text (FCC) file scenario. Interface picks text file and delivers on target system as text file. I have used FCC in both sender and receiver CCs.
    > Interface is working fine if the source file is not empty. If the source text file is empty (zero Bytes), interface has to delivery an empty text file on target system.  I have setup empty file handling options correctly on both CCs.
    >
    > But when I tried with an empty file I am getting the error message 'Parsing an empty source. Root element expected!'.
    >
    > Could you please suggest me what I need to do to create an empty text file on target system from empty source text file?
    >
    > Thanks in Advance....
    >
    > Regards
    > Sreeni
    the problem is that when there is an empty file there is no XML for parsing available. Hence in case you are using a mapping it will fail.
    What ideally you should do is to have a module that will check if the file is empty and if so write out an XML as you want with no values in the content/fields.
    Or the next choice would be to have a java mapping to handle this requirement. I guess that on an empty file the java mapping will go to an exception which you can handle to write out your logic/processing

  • SAP generating invalid XML for ORDERS05 IDOC

    We have XI 3.0 SP 20 installed here.
    I just started working with XI/PI, so bear with me if this has been asked - I already searched SAP for a note on this and couldn't find one.
    We have integrated sales orders into another system - we have SAP generating an IDOC to be sent when a sales order is created.  We use XI to route it to a 3rd party provider.
    The problem that is occuring is that if an item on the order has an ampersand in the description, the system receiving it tells us that the XML is in error.  In examining the message, it is in error as it doesn't properly escape the ampersand.
    Is there a workaround or patch for this?
    Also - it's not XI that is complaining about the issue, it's our 3rd party provider that is.
    Edited by: Bruce Hartley on Dec 22, 2010 9:34 AM

    Stefan and Abhishek;
    I read the blog - and unless SAP support does not have a fix for issue, I'm not going to use the suggestion in the blog for the exact reasons pointed out by Stefan in the most recent comment.  I have opened a case for this with SAP support and when I get a resolution on it that is not covered by the blog post I will post it here.
    To me, this should work out of the box by SAP and I shouldn't have to write code to work around it.  We're not doing anything fancy or special, we just want to send the order to the 3rd party system via an IDOC interface.  If I was generating the XML by myself, then I would have to convert the stuff.
    I don't think we have < or > in our item descriptions, but I'm sure we have quote characters in there as well.
    We have other systems we use XML with and we did have this issue a long time ago and since I was the one doing the programming and had total control over the process, I was the one who had to fix it - so at least I was aware of it.

  • Generate prov.xml for Creative Cloud. Return Code 27

    We're trying to follow this guide (Creative Cloud Help | Using Adobe Provisioning Toolkit Enterprise Edition) to serialize a package (or something). We're stuck on generating prov.xml. My best attempt at an entry is:
    C:\Program Files (x86)\Common Files\Adobe\OOBE\PDApp\CCP\utilities\APTEE>adobe_prtk.exe --tool=VolumeSerialize --generate --serial=xxxx-xxxx-xxxx-xxxx-xxxx-xxxx --regsuppress=ss --eulasuppress --locales=en_US --provfilepath=C:\Program Fil
    es (x86)\Common Files\Adobe\OOBE\PDApp\CCP
    It says half of this is optional, but I'm skeptical.
    Anyway, I'm getting return code 27. This indicates that it is unable to edit the prov.xml file specified. I didn't specify a prov.xml file, I'm trying to make one. The syntax I'm using differs from what I found on the page I linked, as that was giving me syntax errors. I lifted this off someone else's code. I've tried just about every variation I can think of. Any help would be appreciated.
    This is on Windows

    One of these links may help
    http://helpx.adobe.com/creative-cloud/packager.html
    http://forums.adobe.com/community/download_install_setup/creative_suite_enterprise_deploym ent

  • Help:i need a code for making a new text file then adding 1 blank line

    i have done makng load, edit and save for a command line text editor. now my problem is, i dont know how to make a new blank text file and store it on the current directory. and i need to have that new text have 1 blank line with full of white space. help please.

    PrintWriter pw = new PrintWriter(new BufferedWriter(new FileWriter("NewBlankTextFile.txt")));
    pw.println("                                                                                                                                         ");
    pw.close();

  • Ascii character 129 for newline in the text file

    Hi there,
    I have java program that makes JDBC connection and reads through a table, write a column in text file, after each column puts delimiter "|"and after each row prints in the next line.
    This is the code below.
    public void queryRecords() {
             Statement stmt           = null;
            ResultSet rset           = null;
            try {
                  stmt = con.createStatement();
                  int numRows = 0;
                File file           = new File("/tmp/temp.txt");
                FileWriter writer   = new FileWriter(file, false);
                BufferedWriter pw      = new BufferedWriter(writer);
                rset = stmt.executeQuery("SELECT * FROM mytable");
                ResultSetMetaData rsmd = rset.getMetaData();
                int colCount = rsmd.getColumnCount();
                while (rset.next()) {
                    for (int i = 1;i <= colCount; i++) {
                        String st = rsmd.getColumnTypeName(i);
                        if (st.equals("DATE")) {
                            Date d1 = rset.getTimestamp(i);
                            pw.write(d1 + "|");
                        } else {
                            Object o1 = rset.getObject(i);
                            if (o1 != null) {
                                pw.write(o1 + DELIM);
                            } else {
                                pw.write(DELIM);
                    pw.newLine();
                pw.close();
                 rset.close();
                 stmt.close();When i open this Temp.txt file in notepad i see ascii character 129 (rectangular box) instead of the new line. But when i print the file i have each row in a separate line.
    Why could this be happening??
    Please help...

    hi,
    Try PrintWriter instead :
    File file = new File("D:/testing.txt");
            //FileWriter writer   = new FileWriter(file, false);
            //BufferedWriter pw      = new BufferedWriter(writer);
            PrintWriter pw = new PrintWriter(file);
            pw.print("aaa");
            pw.print("|");
            pw.print("aaa");
         public static void main(String[] args) throws Exception {
              File file = new File("/test/test.txt");
            //FileWriter writer   = new FileWriter(file, false);
            //BufferedWriter pw      = new BufferedWriter(writer);
            PrintWriter pw = new PrintWriter(file);
            pw.print("aaa");
            pw.print("|");
            pw.print("aaa");
            pw.print("|");
            pw.print("aaa");
            pw.println();
            pw.print("aaa");
            pw.print("|");
            pw.print("aaa");
            pw.print("|");
            pw.print("aaa");
            pw.close();
         }hth

  • Update XERegistry.xml for my custom positional flat file

    Hi,
    I believe we need to add entry into XERegistry.xml for the new parser and upload the .ecs file, can anybody confirm? If so, what information do we need to enter ? In the document definition, what do we need to put in "Identification Start Position" and "Identification End Position"
    Thanks
    John

    Anuj,
    What you said makes sense, but somehow I could not make it work even with the invoice example shipped with Oracle B2B, INVOIC01.ecs and Invoice01.dat under samples/positional directory.
    I am using a Java program to read the data file and drop on a JMS queue Oracle B2B is listening. I am seeing the following trace in the log file, it seems that Oracle B2B knows it is a non-XML file.
    On the other hand, I have already made a X12 example work.
    May I send the log and other files to you to review?
    Thanks
    John
    BTW, still trying to understand how B2B identify the document. The parser uses the InitialFileDetect to get the initial information, what is the GroupNode for? Do I need to match those information (DocControlNumber, DocTypeID) when I create my document as well as the version and document type in the B2B console?
    <msg time="2011-09-22T09:55:45.949-04:00" comp_id="soa_server1" type="TRACE" level="1" host_id="uxpnwg001a0015.cbp.dhs.gov" host_addr="10.159.25.110" module="oracle.soa.b2b.engine" tid="weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@15d19258" user="weblogic" ecid="72a52121dd40d94a:afeea16:1323f8126ee:-8000-00000000001c3f99" rid="0">
    <attr name="SRC_CLASS" value="oracle.tip.b2b.system.DiagnosticService" />
    <attr name="APP" value="soa-infra" />
    <attr name="SRC_METHOD" value="synchedLog_J" />
    <txt>oracle.tip.b2b.document.pff.PFFDocumentPlugin:identifyIncomingDocument Enter</txt>
    </msg>
    - <msg time="2011-09-22T09:55:45.949-04:00" comp_id="soa_server1" type="TRACE" level="1" host_id="uxpnwg001a0015.cbp.dhs.gov" host_addr="10.159.25.110" module="oracle.soa.b2b.engine" tid="weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@15d19258" user="weblogic" ecid="72a52121dd40d94a:afeea16:1323f8126ee:-8000-00000000001c3f99" rid="0">
    <attr name="SRC_CLASS" value="oracle.tip.b2b.system.DiagnosticService" />
    <attr name="APP" value="soa-infra" />
    <attr name="SRC_METHOD" value="synchedLog_J" />
    <txt>oracle.tip.b2b.document.pff.PFFDocumentPlugin:identifyIncomingDocument iDoc ECS = /soa/b2b/PositionalFlatFile/SAP IDoc/SAP IDoc type/INVOICEDoc/INVOIC01.ecs</txt>
    </msg>
    - <msg time="2011-09-22T09:55:45.949-04:00" comp_id="soa_server1" type="TRACE" level="1" host_id="uxpnwg001a0015.cbp.dhs.gov" host_addr="10.159.25.110" module="oracle.soa.b2b.engine" tid="weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@15d19258" user="weblogic" ecid="72a52121dd40d94a:afeea16:1323f8126ee:-8000-00000000001c3f99" rid="0">
    <attr name="SRC_CLASS" value="oracle.tip.b2b.system.DiagnosticService" />
    <attr name="APP" value="soa-infra" />
    <attr name="SRC_METHOD" value="synchedLog_J" />
    <txt>oracle.tip.b2b.document.pff.PFFDocumentPlugin:identifyIncomingDocument non-XML Payload</txt>
    </msg>
    - <msg time="2011-09-22T09:55:45.949-04:00" comp_id="soa_server1" type="TRACE" level="1" host_id="uxpnwg001a0015.cbp.dhs.gov" host_addr="10.159.25.110" module="oracle.soa.b2b.engine" tid="weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@15d19258" user="weblogic" ecid="72a52121dd40d94a:afeea16:1323f8126ee:-8000-00000000001c3f99" rid="0">
    <attr name="SRC_CLASS" value="oracle.tip.b2b.system.DiagnosticService" />
    <attr name="APP" value="soa-infra" />
    <attr name="SRC_METHOD" value="synchedLog_J" />
    <txt>oracle.tip.b2b.document.pff.PFFDocumentPlugin:identifyIncomingDocument start pos = -1</txt>
    </msg>
    - <msg time="2011-09-22T09:55:45.949-04:00" comp_id="soa_server1" type="TRACE" level="1" host_id="uxpnwg001a0015.cbp.dhs.gov" host_addr="10.159.25.110" module="oracle.soa.b2b.engine" tid="weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@15d19258" user="weblogic" ecid="72a52121dd40d94a:afeea16:1323f8126ee:-8000-00000000001c3f99" rid="0">
    <attr name="SRC_CLASS" value="oracle.tip.b2b.system.DiagnosticService" />
    <attr name="APP" value="soa-infra" />
    <attr name="SRC_METHOD" value="synchedLog_J" />
    <txt>oracle.tip.b2b.document.pff.PFFDocumentPlugin:identifyIncomingDocument values = {IdentificationStartPosition=0, IdentificationExpressionValue=EDI_DC , TransactionECSFileBlob=/soa/b2b/PositionalFlatFile/SAP IDoc/SAP IDoc type/INVOICEDoc/INVOIC01.ecs, IdentificationEndPosition=10}</txt>
    </msg>
    - <msg time="2011-09-22T09:55:45.949-04:00" comp_id="soa_server1" type="TRACE" level="1" host_id="uxpnwg001a0015.cbp.dhs.gov" host_addr="10.159.25.110" module="oracle.soa.b2b.engine" tid="weblogic.work.j2ee.J2EEWorkManager$WorkWithListener@15d19258" user="weblogic" ecid="72a52121dd40d94a:afeea16:1323f8126ee:-8000-00000000001c3f99" rid="0">
    <attr name="SRC_CLASS" value="oracle.tip.b2b.system.DiagnosticService" />
    <attr name="APP" value="soa-infra" />
    <attr name="SRC_METHOD" value="synchedLog_J" />
    <txt>oracle.tip.b2b.document.pff.PFFDocumentPlugin:identifyIncomingDocument xpath = null</txt>
    </msg>
    Edited by: zchen on Sep 22, 2011 1:11 PM

  • Font Used For Quick Look Plain Text Files?

    Hi,
    Does anyone know what font Leopard uses when you Quick Look a plain text file? It's one that isn't anti-aliased. I can't seem to find it anywhere in my Font Book.

    You could override that with code in userContent.css, either for all websites or for specific websites.
    *http://kb.mozillazine.org/userContent.css
    <pre><nowiki> pre{font-family:monospace!important}
    @-moz-document domain(svn.uni-konstanz.de){
    pre{font-family:monospace!important}
    }</nowiki></pre>

  • Explorer crashing when generating thumbnails view for large (4GB) video (.TS) files

    I am suffering consistent application crashes in Windows Explorer when it tries to generate thumbnails. 
    The error is reported as COM Surrogate has stopped working with an APPCRASH of dllhost.exe in module msvcrt.dll.
    This only but always happens in the following circumstances.  A folder set to view tiles or icons (with thumbnail view option NOT disabled).  This folder contains several sub-folders, each of which contain video files.  As explorer scans the
    folder and its sub-folders, generating thumbnails for each, whenever it encounters a video file (.TS) that is 3.99GB or larger. COM surrogate crashes again.  Closing COM Surrogate will then allow explorer to continue to scan the remaining sub-folders
    until it encounters the next large file. 
    If I subsequently open one of the sub-folders where it crashed trying to generate a thumbnail, and refresh the folder, it will successfully generate a thumbnail for the video file. If I then return to the main folder and change the customization of the sub-folder
    from video to document and back to video, explorer then successfully generates the folder icon with the inset video thumbnail.
    I have tried this in safe mode and the problem persists.
    Can anybody please help as I am pulling my hair out.

    Hi Roger.
    Almost all of my media files are TS, and all of my large (4GB) files are TS files, so I cannot tell if other file types have the same problem.  I did try renaming the TS files to be .mpg (they still play as mpg) but this did not help.
    However, I have downloaded and used ShelleExView and this has proved very useful.  For the benefit of anyone else with a similar problem and using this very useful tool, I will detail the technique I used. 
    First, using ShellExView, I disabled various groups of extensions to identify which, if any, were relevant.  After disabling/enabling each set I performed a system restart to ensure the changes took effect.  This was not actually necessary as restarting
    Windows Explorer (via Task Manager) works equally well (but this loses my customm Taskbar toolbar). 
    Also, before re-opening the folders containing the problem files, I deleted the icon cache (I could have done this manually but chose to use CCleaner's delete Thumbnail Cache option as this was quick and easy).  I then viewed the folders containing
    the problem files, watching to see what effect the changes in ShellExView had made.
    Using ShellExView, I progfessively disabled by Type (e.g. Thumbnail, Icon Handler), then by Company (e.g. non-Microsoft), then by Product (e.g. MS Office, Windows Search).  The result was that I identified the extension that was creating the thumbnails:
    Icaros Thumbnail Provider (installed as part of the K-Lite codec pack).
    Hoping I had found the cause, I removed K-Lite from my system and checked again.  No thumbnails (as expected), but COM Surrogate continued to crash (I have subsequently reinstalled K-Lite as I need this to play my media files).  Further analysys
    with ShellExView then identified a further problem extension: Microsoft's MF MPEG Property Handler. 
    With both extensions (Icaros Thumbnail Provider & MF MPEG Property Handler) disabled, COM Surrogate does not crash.  With either one enabled, but not the other, COM Surrogate crashes.  These two extensions are therefore both individually causing
    the crashes.  This leads me to wonder if they perhaps have something in common (e.g. a dll).
    Although disabling these extensions stops the crashes, I of course alos lose what they provide: file details (e.g. media length etc.) and thumbnails.  So simply disabling them is not a solution.  
    Is it possible to idenitfy what, if anything, they have in common (which may be the true culprit)? 
    Alternatively, are there other ways I can continue to obtain file property information and thumnails without using these extensions?

  • Regarding utility for converting plb to text file

    sir,
    i would like to know if there is any utility to
    convert .plb file(binary file) to text file.
    urgent reply anticipated
    Thanks in advance
    Murthy

    I just wrote one like that a couple of days ago.<?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="text"/>
    <xsl:template match="personInfo">
      <xsl:value-of select="name"/>
      <xsl:text>,</xsl:text>
      <xsl:value-of select="address"/>
      <xsl:text>
    </xsl:text>
    </xsl:template>
    </xsl:stylesheet>

  • Executing methods using an input text file

    Hello all,
    I was just wondering if I could get a little help with giving the input commands to my program through a provided text file. I have already made a stack program and want to test it by feeding it a text file with commands in it. Here is an example of the text that it would contain:
    bluePush 100
    blueIsEmpty
    print
    bluePush 101
    bluePush 102
    bluePush 103
    blueSize
    bluePush 104
    print
    bluePop
    print
    redIsEmpty
    Etc..
    Problem is, I'm not really sure how to make my test file. I've never taken a text file as input before and once it's in, I'm not sure how to parse the commands.
    Any help would be greatly appreciated.
    Thanks,
    Tyler

    You would open the file like such:
      String fileName = "c:\path\to\file.txt";
      BufferedReader input = new BufferedReader(
                               new FileReader(fileName));You would create a loop to read the text, line by line, something like this:
      String line = null;
      while ((line = input.readLine()) != null){
        //... do processing here
      }Inside the while loop, you would parse the string into command and value pairs. Maybe look into StringTokenizer... Something like this:
        //inside while loop
        StringTokenizer parser = new StringTokanizer(line, " ");
        String command = parser.nextToken();
        String value = null;
        if (doesCommandHaveValue(command)) value = nextToken();
        //Determine course of action based on command
    //*** Then have the method doesCommandHaveValue...
    // Returns true if "Push" is found inside of command,
    // since it looks like only push statements have values after them
    private boolean doesCommandHaveValue(String command) {
      return (command.indexOf("Push") != -1);
    }Then mabe do a series of ifs based on command, to call different methods, using the value read in.

  • OSB error while generating business service for FTP adapter Sync Get File

    Hi All
    I am trying to generate a business service from SOA Suite JCA FTP adapter Sync Get File, but i am getting this exception for no reasons (Rest operations list file, get file and put file are working)
    Invalid JCA transport endpoint configuration, exception: java.lang.NullPointerException     Unknown ALSB Conflict.
    Is this a bug in eclipse, can any body help me. Thanks
    Sorry Forgot to mention eclipse version...
    Eclipse Platform
    Version: 3.6.2
    Build id: M20110210-1200

    Ok,
    bcoz of this issue, i had to code the entire interface in OSB console. It runs fine in OSB console (i was able to test it successfully).
    Is this a bug in eclipse or only i am facing this issue? Has anybody tried to create a business service from JCA FTP Get Synchronous jca file?
    <adapter-config name="FTPReadMOMFileOnRMSDB" adapter="FTP Adapter"
         wsdlLocation="../wsdl/FTPReadMOMFileOnRMSDB.wsdl"
         xmlns="http://platform.integration.oracle/blocks/adapter/fw/metadata">
         <connection-factory location="eis/ftp/RMSDBFtpAdapter" />
         <endpoint-interaction portType="SynchRead_ptt"
              operation="SynchRead">
              <interaction-spec
                   className="oracle.tip.adapter.ftp.outbound.FTPReadInteractionSpec">
                   <property name="DeleteFile" value="true" />
                   <property name="PhysicalDirectory" value="/MOMFiles/output" />
                   <property name="FileName" value="*" />
                   <property name="FileType" value="binary" />
              </interaction-spec>
         </endpoint-interaction>
    </adapter-config>
    One more doubt? The PhysicalArchiveDirectory path can be on the FTP server something like: /MOMFiles/archive. Or do i have to use the Put operation to move it to /MOMFiles/archive directory. Currently OSB console and eclipse do not accept FTP path for this parameter and want me to specify a local directory on server. Thanks

  • Server Side Includes for Apache and parsing text files

    I have an old website I used to do zipped up and I decided to set it up on my personal webserver in OS X . I got apache configured to allow server side includes (edited the httpd.conf to all them:
    <Directory />
    Options FollowSymLinks Indexes MultiViews Includes
    AllowOverride None
    </Directory>
    But I can't get the pages to come up. See I have this .shtml page which loads fine and a part of it has this line:
    <!--#include file="news/news.txt" -->
    But it won't parse that txt file and show the html that its formatted in.
    Anyone have any ideas on how to get it to parse that txt file? Even if I load just that txt file it shows raw code not it formatted. Please help.

    Ignore that first reply. I thought I was dealing with server.
    As usual, I fogot to make sure that Includes was in the Options directive for the DOCUMENT_ROOT or VirtualHost. After 10 years, you'd think I'd remember that. I just configged one of my macs to do SSI. Here's the 3 lines that I changed:
    Line 399 (the DOCUMENT_ROOT definition): Options Indexes FollowSymLinks MultiViews Includes
    Line 887 (To use server parsed HTML): AddType text/html .shtml
    Line 888: AddHandler server-parsed .shtml
    apachectl restart
    and off it went!
    Roger

  • Query Ad for computers push to text file and email detail

    Hi Guys,
    I'm really stuck and i know its a basic question.
    I'm trying to get the content of the outfile emailed out to report diskspace
    Both parts work independently and i'm stuck on joining them .
    Any help would be greatly appreciated.
    Thanks
    Get-ADComputer -Filter {name -like "*computer_name*"} | out-file C:\scripts\computers.txt
    $body = Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" -computer (Get-Content "C:\scripts\computers.txt") | Select SystemName,DeviceID,VolumeName,@{Name="Size(GB)";Expression={"{0:N1}" -f($_.size/1gb)}},@{Name="Free
    Space(GB)";Expression={"{0:N1}" -f($_.freespace/1gb)}},@{Name="Free Space(%)";Expression={"{0:P2}" -f(($_.freespace/1gb) / ($_.size/1gb))}} | convertto-html
    $emailFrom = "[email protected]
     $emailTo = "[email protected]"
     $subject = "SQL Server Disk Space Reporting"
     $smtpServer = "any_smtp.address.com"
     $smtp = new-object Net.Mail.SmtpClient($smtpServer)
     $MailMessage = new-object Net.Mail.MailMessage($emailFrom, $emailTo, $subject, $body)
     $MailMessage.IsBodyHtml = $true
     $MailMessage.ReplyTo = "[email protected]"
     $smtp.Send($MailMessage)

    Fred has a good answer but I wanted to simplify this and make is easier to understand.  How we format script makes seeing issues mch easier.  Also using the pipeline makes the code more flexible.
    Review the following:
    $mailprops=@{
    From='[email protected]'
    To='[email protected]'
    Subject='SQL Server Disk Space Reporting'
    SmtpServer='any_smtp.address.com'
    BodyAsHtml=$true
    $body=Get-ADComputer -Filter {name -like "*computer_name*"} |
    Get-WMIObject Win32_LogicalDisk -filter "DriveType=3" -computer $_.Name |
    Select SystemName,
    DeviceID,VolumeName,
    @{Name="Size(GB)";Expression={"{0:N1}" -f($_.size/1gb)}},
    @{Name="Free Space(GB)";Expression={"{0:N1}" -f($_.freespace/1gb)}},
    @{Name="Free Space(%)";Expression={"{0:P2}" -f(($_.freespace/1gb) / ($_.size/1gb))}} |
    ConvertTo-Html | Out-String
    Send-MailMessage @mailprops -Body $body
    Using $mailprops allows us to set a variable block at the beginning of the script or even in an external file.
    Expanding the "select" statement this way makes it easy to see what is being formatted.
    ¯\_(ツ)_/¯

  • Dummy XML not getting generated from empty file by J2EE adapter module

    Hi All,
    i know when XI gets an empty input text file, it does not generate a send message for it in sender communication channel.
    in my scenario, if i get a file with data, i have to generate an XML message for it using file content conversion - this i have done...........
    but if i get an empty text file, then i have to generate a dummy XML send message for it for my BPM.......
    So i made a J2EE adapter module to generate dummy xml for empty file.....<b>when i give a file with data in it, then my adapter module is called..... but when i give an empty file, then my adapter module is not called</b>.........
    <b><i>Can anybody suggest why the module processor is not invoking my customer-adapter module when an empty file is given.............but the module processor is invoking my customer-adapter module when a file with data is given</i>.</b>
    Thanks,
    Rajeev Gupta

    Hi Amit,
    Below is the code of process method which i used:
    <i>public ModuleData process(ModuleContext moduleContext,
      ModuleData inputModuleData)
        throws ModuleException
    Object obj;
    Message msg_audit;
    AuditMessageKey amk;
    try
    File f = new File("/components/XITEMP/sample/PWC/check.txt");
    PrintStream ps;
    if (f.canWrite())
    FileOutputStream fos =new FileOutputStream(f);
    ps = new PrintStream(fos);  
    ps.println("Testing");
    ps.close();
    fos.close(); 
    else
      f = new File("/components/XITEMP/sample/PWC/check4.txt");
      if (f.exists() ==false)
      f.createNewFile();
    obj = inputModuleData.getPrincipalData();
    if (obj!=null)
    msg_audit = (Message)obj;
    amk = new AuditMessageKey(msg_audit.getMessageId(),AuditDirection.OUTBOUND);
    Audit.addAuditLogEntry(amk,AuditLogStatus.SUCCESS,"FileCheck: Module called");
    else
      String str = new String();
    String str1 = new String();     
                  str1="<?xml version=\"1.0\" encoding=\"utf-8\" ?>";
                 str1+="<ns:MT_PWC_RECORD xmlns:ns=\"urn://PWC_SR3_01/PWC/Customer\">";
             str1+="<RECORD_SET>";     
                 str1+="<RECORD>";
             str1+="<RECORD_DATA>BLANK_FILE</RECORD_DATA>";
             str1+="</RECORD>";
             str1+="</RECORD_SET>";
             str1+="</ns:MT_PWC_RECORD>";     
    str=str1; 
    inputModuleData.setPrincipalData(str);
    catch(Exception e)
    try
    File f = new File("/components/XITEMP/sample/PWC/check.txt");
    PrintStream ps;
    if (f.canWrite())
      FileOutputStream fos =new FileOutputStream(f);
      ps = new PrintStream(fos);  
      ps.println(e.toString());
      ps.close();
      fos.close(); 
    catch(Exception ex)
    return inputModuleData;
       }</i>
    in the above methood, i  used file operations at start just to see whether the module is getting invoked or not...so when i give a data file, then the file operations are performed and messages are written in audit log.........but when i give an empty file, then the file operations are not performed - meaning the module is not getting invoked........
    Thanks,
    Rajeev Gupta

Maybe you are looking for