February 2009 - Posts
Sometimes can occur a validation error some this:
Microsoft.ServiceModel.Channels.Common.XmlReaderParsingException: An error occurred when trying to convert the XML string 20090212 of RFCTYPE RFCTYPE_DATE with length 8 and decimals 0 to a .NET type. Parameter/field name: DATE Error message: The string '20090212' is not a valid AllXsd value
bla… bla..
During import schemas, by default, the value of the EnableSafeTyping property is false. Therefore, values of the SAP data types are converted to strongly typed variables in the Microsoft .NET Framework.
Some SAP fields are:
DATS TIMS NUMC To resolve this problem you can use EnableSafeTyping = true and formatting data as you want or install this hotfix to import new SAP datatypes.
http://support.microsoft.com/kb/954539/en-us
Sometimes can occurred some strange errors during map compiling, same these:
Error 46 Expected class, delegate, enum, interface, or struct c:\ITL\b2bcisco\itl.b2bcisco.maps\Transform_B2B_to_PIP3B2.btm.cs 6 141
Error 48 Invalid token '\' in class, struct, or interface member declaration c:\ITL\b2bcisco\itl.b2bcisco.maps\Transform_B2B_to_PIP3B2.btm.cs 346 30
etc. etc..
Probably you have replace an existing schema , after the map ask you to resolve the new source/dest schema.
Sometime this operation wrong to write on bpm.cs mapping file.
Sample:
GOOD
typeof(ZBAPI_PIP3B2_Schema1.xsd.Z_BAPI_PIP3B2_INBOUND)
BAD
typeof(C:\ITL\b2bcisco\itl.b2bcisco.maps\ZBAPI_PIP3B2_Schema1.xsd.Z_BAPI_PIP3B2_INBOUND))]
, attention to new path!!!! aaaaaaaaaaaaahhhhhhhhhhhhhhhhhhh
To view the cs files you must set HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\7.1\BizTalkProject with a
DWORD value named GenerateCSFiles to 1
Exist the possibility to construct message without a construct message shape.
To do this you can use a simple expression shape and create a construct structure style.
This is a sample:
construct myBizTalkMessage
{
// Use string Variable to load xm
varXML.LoadXml(@<xmlnode>asd asd asd</xmlnode>");
// Assign to BizTalk message
myBizTalkMessage= varXML;
// If there are Distinguished Fields available, then
myBizTalkMessage.xmlnode= "other value";
// // or use XPATH without distinguished field, as you want
xpath(myBizTalkMessage, "//@xmlnode") = "other value";
}
This is useful for some particular cases 
To call a SAP Trfc, after you receive a response from SAP, You must set
Create a message same this
<RfcConfirmTransID xmlns='http://Microsoft.LobServices.Sap/2007/03/RfcApi/'><TransactionalRfcOperationIdentifier />
</RfcConfirmTransID>
Set the TransactionalRfcOperationIdentifier field with the field TransactionalRfcOperationIdentifier of your SAP response message.
Send this message after any Trfc call to SAP.
An error occurred during calling an RFC / TRfc / BAPI to SAP
Incorrect Action http://Microsoft.LobServices.Sap/2007/03/blablabla . Correct the specified Action, or refer to the documentation on the allowed formats for the Actions.
This problem occur for only two reason:
The WCF SAP Adapter using WCF Custom adapter, the important thing is the SOAP Action Header under General Tab in Configuration.
this is a sample of SOAP Header:
<BtsActionMapping xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<Operation Name="Z_BAPI_PIP3B2_INBOUND" Action="http://Microsoft.LobServices.Sap/2007/03/Rfc/Z_BAPI_PIP3B2_INBOUND" />
</BtsActionMapping>
Name parameter correspond to the Operation of the logical orchestration port and Action usually correspond to MessageType without #.
This is default using from adapter wizard.
To be sure to do all correctly you can do that:
Import schema from SAP, after you’ll find a Bindinginfo file to create a physical port on BizTalk from admin console.
Open this file and use the value of action paramenter to rename the operation of orchestration logical port.
Deploy all, create physical port with binding file and configure your orchestration.
You could use a your custom action, to do that write WCF.Action context property:
myMessage(WCF.Action)=”http://myAction/asd.asd.asd”
This is a grate thing to use multiple operation on a single port 
Exception = Details: ErrorCode=RFC_INVALID_HANDLE. AdapterErrorMessage=An exception has occurred on the listener while executing RfcWaitForRequest
There are three reasons for this error type.
First:
You have a connection timeout on WCF-Custom binding port too low
Second:
This error occur because the SAP connection cannot resolve the BizTalk machine.
To test this you must execute SM59 transaction on SAP and execute a test connection.
And Third:
You must include SAP property schemas using by SAP adapter in BizTalk.
Do do that go under resources in you BizTalk Application and add new BizTalk Assembly.
Now select Microsoft.Adapters.SAP.BiztalkPropertySchema.dll under DRIVE:\Program Files\Microsoft BizTalk Adapter Pack\bin
WOW, welcome to the real world hehehehehe 
Open BTSNTvc.exe.config present in you drive:\Program Files\Microsoft BizTalk Server 2006
Insert this configuration and restart Host Instance
<system.diagnostics>
<sources>
<source name="Microsoft.ServiceModel.Channels" switchValue="Warning">
<listeners>
<add name="eventlog" />
</listeners>
</source>
<source name="Microsoft.Adapters.SAP" switchValue="Warning">
<listeners>
<add name="eventlog" />
</listeners>
</source>
</sources>
<sharedListeners>
<add name="eventlog" type="System.Diagnostics.EventLogTraceListener" initializeData="MYAPPLICATIONSAP"/>
</sharedListeners>
<trace autoflush="false" />
</system.diagnostics>
You can view errors on your event viewer.
Execute WCF LOB Adapter SDK SP1 x86.exe
http://www.microsoft.com/DOWNLOADS/details.aspx?familyid=0F8007D7-F0C9-4169-8B9C-BA55F8F4C153&displaylang=en
Execute Microsoft BizTalk Adapter Pack x86.exe
http://www.microsoft.com/DOWNLOADS/details.aspx?familyid=F3EA0659-B0ED-4D5A-891E-53268128A5F0&displaylang=en
You can download them from Microsoft site
Now is necessary to install SAP library:
librfc32u.dll
libsapu16vcXX.dll
This is the original specification from guideline:
BUT!
but you can skip all of them if you install the SAP GUI on the server, you choose….
For two DLL…
SAP client version
Required drivers
6.4
- librfc32u.dll (SAP RFC SDK 6.40 UNICODE). This is available as part of SNOTE* 413708. The instructions to download this are available at http://go.microsoft.com/fwlink/?LinkID=94691.
- DLLs available from SAP as part of the package, UCLIB.SAR. See SNOTE* 785368 (http://go.microsoft.com/fwlink/?LinkID=94692) for more information. This package is available as part of SAP KERNEL 6.40, which is available from the SAP Service Marketplace. While downloading the SAP Kernel, make sure you download the “database independent” version.
- DLLs available from SAP as part of R3DLLINST.zip. This contains Microsoft run-time DLLs and can be downloaded from the SAP site. See SNOTE* 684106 for more information. You can download the .zip file from http://go.microsoft.com/fwlink/?LinkID=94693. This link has an “Attachments” option from where you can download the package.
- If you will be using SAP Secure Network Communications (SNC) to connect to an SAP system, you must also have the relevant DLLs from SAP. These DLLs are different for 32-bit and 64-bit platforms and are available with SNOTE* 352295. You can download the DLLs from http://go.microsoft.com/fwlink/?LinkID=104032. This link has an “Attachments” option from where you can download the package. The names of the DLLs are:
- For 32-bit: gsskrb5.dll, gssntlm.dll
- For 64-bit x86: gx64krb5.dll, gx64ntlm.dll
7.0
- librfc32u.dll (SAP RFC SDK 7.00 UNICODE). This is available as part of SNOTE* 413708. The instructions to download this are available at http://go.microsoft.com/fwlink/?LinkID=94691.
- DLLs available from SAP as part of the package, UCLIB.SAR. See SNOTE* 785368 (http://go.microsoft.com/fwlink/?LinkID=94692) for more information. This package is available as part of SAP KERNEL 7.00, which is available from the SAP Service Marketplace. While downloading the SAP Kernel, make sure you download the “database independent” version.
- DLLs available from SAP as part of R3DLLINST.zip. This contains Microsoft run-time DLLs and can be downloaded from the SAP site. See SNOTE* 684106 for more information. You can download the .zip file from http://go.microsoft.com/fwlink/?LinkID=94693. This link has an “Attachments” option from where you can download the package.
- Libsapu16vc71.dll. This DLL is available in the UCLIB.SAR package available with SAP KERNEL 6.40.
- If you will be using SAP Secure Network Communications (SNC) to connect to an SAP system, you must also have the relevant DLLs from SAP. These DLLs are different for 32-bit and 64-bit platforms and are available with SNOTE* 352295. You can download the DLLs from http://go.microsoft.com/fwlink/?LinkID=104032. This link has an “Attachments” option from where you can download the package. The names of the DLLs are:
- For 32-bit: gsskrb5.dll, gssntlm.dll
- For 64-bit x86: gx64krb5.dll, gx64ntlm.dll
7.1
- librfc32u.dll (SAP RFC SDK 7.10 UNICODE). This is available as part of SNOTE* 413708. The instructions to download this are available at http://go.microsoft.com/fwlink/?LinkID=94691.
- DLLs available from SAP as part of the package, UCLIB.SAR. See SNOTE* 785368 (http://go.microsoft.com/fwlink/?LinkID=94692) for more information. This package is available as part of SAP KERNEL 7.00, which is available from the SAP Service Marketplace. The 7.1 version of the SAP Kernel is not available. While downloading the SAP Kernel, make sure you download the “database independent” version.
- DLLs available from SAP as part of R3DLLINST.zip. This contains Microsoft run-time DLLs and can be downloaded from the SAP site. See SNOTE* 684106 for more information. You can download the .zip file from http://go.microsoft.com/fwlink/?LinkID=94693. This link has an “Attachments” option from where you can download the package.
- Microsoft Visual C++ run-time DLLs required for SAP 7.1 client. These are available from the following links:
- If you will be using SAP Secure Network Communications (SNC) to connect to an SAP system, you must also have the relevant DLLs from SAP. These DLLs are different for 32-bit and 64-bit platforms and are available with SNOTE* 352295. You can download the DLLs from http://go.microsoft.com/fwlink/?LinkID=104032. This link has an “Attachments” option from where you can download the package. The names of the DLLs are:
- For 32-bit: gsskrb5.dll, gssntlm.dll
- For 64-bit x86: gx64krb5.dll, gx64ntlm.dll
* SNOTEs are release notes that accompany fixes released by SAP.
You must retrive all configuration from Notification Services and not from BizTalk Setiings.
Do do that execute this script.
C:\Program Files\Microsoft BizTalk Server 2006\Tracking>cscript ProcessBamNSFiles.vbs -Get config.xml adf.xml <DATABASESERVER> BAMPrimaryImport
Now you can modify in adf.xml file and config.xml all setting, but before copy adf.xml file into newadf.xml file.
Example, to modify address data, enter in newadf.xml file and change the default email address under <SqlExpression> node
<FieldName>From</FieldName>
<SqlExpression>'BAM@microsoft.com'</SqlExpression>
After you che execute the update setting, to do that execute this script.
C:\Program Files\Microsoft BizTalk Server 2006\Tracking>cscript ProcessBamNSFiles.vbs -Update config.xml newadf.xml <DATABASESERVER> BAMPrimaryImport
That’s All 
IIS 7.0 requirements:
Open Command prompt and run this script
To do that select script below, copy and past on command prompt.
start /w pkgmgr /l:log.etw /iu:IIS-WebServerRole;IIS-WebServer;IIS-CommonHttpFeatures;IIS-StaticContent;IIS-DefaultDocument;IIS-DirectoryBrowsing;IIS-HttpErrors;IIS-HttpRedirect;IIS-ApplicationDevelopment;IIS-ASPNET;IIS-NetFxExtensibility;IIS-ASP;IIS-CGI;IIS-ISAPIExtensions;IIS-ISAPIFilter;IIS-ServerSideIncludes;IIS-HealthAndDiagnostics;IIS-HttpLogging;IIS-LoggingLibraries;IIS-RequestMonitor;IIS-HttpTracing;IIS-CustomLogging;IIS-ODBCLogging;IIS-Security;IIS-BasicAuthentication;IIS-WindowsAuthentication;IIS-DigestAuthentication;IIS-ClientCertificateMappingAuthentication;IIS-IISCertificateMappingAuthentication;IIS-URLAuthorization;IIS-RequestFiltering;IIS-IPSecurity;IIS-Performance;IIS-HttpCompressionStatic;IIS-HttpCompressionDynamic;IIS-WebServerManagementTools;IIS-ManagementConsole;IIS-ManagementScriptingTools;IIS-ManagementService;IIS-IIS6ManagementCompatibility;IIS-Metabase;IIS-WMICompatibility;IIS-LegacyScripts;IIS-LegacySnapIn;IIS-FTPPublishingService;IIS-FTPServer;IIS-FTPManagement;WAS-WindowsActivationService;WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI
Now IIS 7.0 is right 
Download and install Microsoft Virtual Server 2005 R2 SP1 - Enterprise Edition from here
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=bc49c7c8-4840-4e67-8dc4-1e6e218acce4
Restart the system
Stop VS 2005 Service
Download and install last Fix from this link
http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=886876b7-e17c-4429-85da-f623506c5f2c
Yep
That’ s Fun! 
public IBaseMessage Execute(IPipelineContext pContext, IBaseMessage inmsg)
{
System.Diagnostics.Trace.WriteLine("Pipeline Replace - " + "Enter in Pipeline - inmsg.BodyPart.Data.Length = " + inmsg.BodyPart.Data.Length);
IBaseMessagePart bodyPart = inmsg.BodyPart;
if (bodyPart != null)
{
Stream originalStrm = bodyPart.GetOriginalDataStream();
if (originalStrm != null)
{
byte [] bytes = new byte[originalStrm.Length];
originalStrm.Position = 0;
originalStrm.Read(bytes, 0, (int)originalStrm.Length);
string mystringdata = Encoding.ASCII.GetString(bytes);
System.Diagnostics.Trace.WriteLine("Pipeline Replace - " + "Replace String");
string StringOUT = "";
StringOUT = mystringdata.Replace("SOMED DATA TO BE REPLACED", "");
System.Diagnostics.Trace.WriteLine("Pipeline Replace - " + StringOUT);
MemoryStream memStream = new MemoryStream();
byte[] data = Encoding.ASCII.GetBytes(StringOUT);
memStream.Write(data, 0, data.Length);
memStream.Position = 0;
System.Diagnostics.Trace.WriteLine("Pipeline Replace - " + "Write data on body");
bodyPart.Data = memStream;
System.Diagnostics.Trace.WriteLine("Pipeline Replace - " + "Data Writed");
}
}
return inmsg;
}
That's All 