Converting a date such as 1/21/2008 11:09:05 AM to XML Date/Time Format.
You might want to put this code into a MapHelper library, then reference
it from a Scripting Functoid in a BizTalk Map.

<code>
        public static string ConvertDateTimetoXmlDateTime(string inDate)
        {
            try
            {
                DateTime dtIn = DateTime.Parse(inDate);
                return System.Xml.XmlConvert.ToString(dtIn, System.Xml.XmlDateTimeSerializationMode.Local);

            }
            catch
            {
                return "invalid-Date/Time-conversion from value='" + inDate + "'";
            }
        }
</code>

FULL ERROR

Exception: System.ServiceModel.CommunicationException: There was an error while trying to serialize parameter http://tempuri.org/:ExportValuationPolicyNumberResult. The InnerException message was ‘Type ‘TFBIC.RCT.WCFWebServices.ExpressLync.MainStreetValuation’ with data contract name ‘MainStreetValuation:http://schemas.datacontract.org/2004/07/TFBIC.RCT.WCFWebServices.ExpressLync’ is not expected. Add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.’. Please see InnerException for more details. —> System.Runtime.Serialization.SerializationException: Type ‘TFBIC.RCT.WCFWebServices.ExpressLync.MainStreetValuation’ with data contract name ‘MainStreetValuation:http://schemas.datacontract.org/2004/07/TFBIC.RCT.WCFWebServices.ExpressLync’ is not expected. Add any types not known statically to the list of known types – for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

SOLUTION

1. Manually create a proxy to the WCF Service from the command line like so:
svcutil /serializer:XmlSerializer http://localhost:46122/ValuationService.svc

2. Add the [XmlSerializerFormat] to your ServiceContract on the WCF Service

By doing this, we force our WCF Service to use the XmlSerializer rather than the default DataContractSerializer. Note: you?ll need to call the WCF service from you new proxy in your sample code.

We needed to compare a C# date-time in string format to a DB2 TimeStamp format.
Use the DateFormat string below. The six f’s represent the milliseconds.

                    txtResultUpdateTimeStamp.Text =
                                        propResult.PropertyFields.updateTimeStamp.ToString(
                                                    "yyyy-MM-dd-hh:mm:ss.ffffff");

When using HIP (CICS Host-Initiated-Processing) [part of Host Integration Services – or HIS] – you might get the error “Select Error Occurred”. This seemed to happen to me when I was trying to pass a null value back to the HIP (and therefore CICS). It seems to want to have all the fields set to some value other than null. Unfortunately, it doesn’t tell you the field that is causing the problem.

With other errors, sometimes you will get an Event Log message that is more helpful. For example, if CICS tries to send a number that is too large for the .NET type, you will get a message like this:

Event Type: Error
Event Source: HIP Service
Event Category: (7)
Event ID: 815
Date: 2/2/2010
Time: 1:00:29 PM
User: BUILTINAdministrators
Computer: NXWTest08BT1.dev.txfb-ins.com
Description:
(815) A Transaction Integrator flow control module is reporting a failure when converting client user data.
HIP Application: RCTGetReplacementCost

Error Description: (1507) The magnitude of a sending field exceeds that allowed for a receiving field in RqstEstimateNumber in GetReplacementCost.
The size of the number is too large to be placed into the resulting data type. Check for a client application error and correct. If the client application is correct consider modifying the data conversion mapping so that the parameter is converted to a data type capable of accepting the numeric value.

HRESULT: 80020009

EXPLANATION
An error has occurred when converting input user data.
ACTION
Verify that the client program is sending the correct data and that the correct HIP mappings have been administered. Make sure that the Transaction Integrator service has been properly deployed and administered and that the HIP runtime environment has been installed on the system on which the failure occurred. If the problem persists contact Microsoft support.

This can happen if COBOL has for example PIC S9(10), and .NET has an integer. Entering 1111111111 in the number “fits”, but entering 2222222222 does not.

ADSUTIL.VBS

MSDN Documentation here:
MSDN AdsUtil.vbs

According to this TechNet article, you should be able to view, create and delete Virtual Directories in the IIS7 GUI admin tool, but I had difficulties with it.

AdsUtil can be found here: c:inetpubAdminScripts
(on machines running Windows 2008 and IIS7).
It’s a VB/Script (.vbs suffix) and you should always run it with CSCRIPT (the command prompt version of VBScript that causes all output to write to the console rather than popping up message boxes).

Why am I documenting this? I had a case using the BizTalk Deployment Framework (BTDF) from CodePlex where I had deleted a Virtual Application in IIS, but apparently a Virtual Directory was still remaining. When I ran the BTDF deploy function, it told me that the virtual directory already existed. I had to resort to some method of manually deleting it. In theory, with IIS7, we should be able to use APPCMD in c:inetpubAdminScripts, but I had some situations where ADSUTIL showed the VDIR and APPCMD did not.

Testing a Path with ADSUTIL

<code>
c:inetpubAdminScripts>cscript adsutil.vbs ENUM /W3SVC/1/ROOT/TFBIC.RCT.BizTalk
.Orchestrations
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All  rights reserved. 

KeyType                         : (STRING) "IIsWebVirtualDir"
AppRoot                         : (STRING) "/LM/W3SVC/1/ROOT/TFBIC.RCT.BizTalk.O
rchestrations"
AppFriendlyName                 : (STRING) "TFBIC.RCT.BizTalk.Orchestrations"
AppIsolated                     : (INTEGER) 0
Path                            : (STRING) "C:inetpubwwwrootTFBIC.RCT.BizTalk
.Orchestrations"
AuthFlags                       : (INTEGER) 1
AuthBasic                       : (BOOLEAN) False
AuthAnonymous                   : (BOOLEAN) True
AuthNTLM                        : (BOOLEAN) False
AuthMD5                         : (BOOLEAN) False
AuthPassport                    : (BOOLEAN) False
AppPoolId                       : (STRING) "DefaultAppPool"
NTAuthenticationProviders       : (STRING) "Negotiate,NTLM"
</code>

Delete a Virtual Directory with ADSUTIL

<code>
c:inetpubAdminScripts>cscript adsutil.vbs DELETE /W3SVC/1/ROOT/TFBIC.RCT.BizTa
lk.Orchestrations
Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

deleted path W3SVC/1/ROOT/TFBIC.RCT.BizTalk.Orchestrations"
</code>