Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB.NET script works in 'test map' but not in 'run time' 1

Status
Not open for further replies.

GISbatchu

Programmer
Aug 22, 2005
9
US
Hello all,

I am a newbie. I am using a scripting functoid with VB.NET script in BizTalk Server 2004. The script executes fine when i use the 'Test Map' mode. But when I actually run my project using Receive/Send ports....it does not. The VB.NET is not installed alongwith BizTalk....is VB.NET required to be installed alongwith BizTalk to execute VB.NET script?

Thanks
Kiran
 
Well you need to have the .NET Framework installed on your Server. You dont need any Development Environments installed on your Server.

Can you post the error Message in your EventLog? That would be helpful to analyze your error.

Did you script inside your Functoid? Or are you calling an external .dll? If you are using an external .dll make sure you have installed your .dll in the GAC! Other than that I need to see your error Message to be able to help you!
 
Thats the weird part...I checked in event log and there is no error message of any sort. It goes through fine when I actually run it but the script does not work since the output does not contain what it should. Just for test purposes, I used this code in a scripting functoid connecting two string fields in a map using inline VB.NET (no external assembly).

Public Function TestInline(ByVal param1 As String) As String
Return "Test"
End Function

When I test the map using 'Test Map' the output field contains the value 'Test' in the appropriate field. But when i actually run my project (i.e. placing a file in the receive location)...that output field is empty in the output....and there is no error message of any sort. I guess if it works with 'Test Map', it should work in run time but i have no clue why this is happening.

any more ideas?

Thanks for your time
Kiran
 
Without seeing your Project its hard to help. Maybe you want to try this to get some more Information concerning your error:
Put your code in an external helper class and wrap it with a try catch block. Throw an exception in your catch block, to make sure you will get an EventLog entry when an error occures. You could also write some of your values to the eventLog or a Tracing Library or even a file so you can actually have a look at them.

You might gain some more Information on your Problem then.


Stephan
 
Stephan,

I don't know what the problem was but i deleted the whole project and recreated everything. Now the VB.NET script works but only if i do not use any keywords. for e.g. I am using the following Inline VB.NET script (no external assembly)
'------------------------
Dim strStreetName as string
Dim strStreetType as string
Public Function SplitStreetName(ByVal param1 As String) As String
Dim i as integer
Dim aryTextFile() as string

aryTextFile = param1.Split(" ")
strStreetName = ""
strStreetType = ""
For i=0 To UBound(aryTextFile)
if i < UBound(aryTextFile) Then
strStreetName = strStreetName + " " + aryTextFile(i)
end if
if i = UBound(aryTextFile) Then
strStreetType = aryTextFile(i)
End if
Next i
Return strStreetName
End Function
'----------------------------------

When i 'Test Map' it...the compiler gives an error saying 'UBound is not declared'. Isn't UBound a keyword in VB.NET and shouldn't it be automatically recognized as such by the compiler? I have this same problem when i use 'MsgBox' too.

Thanks
Kiran
 
Hi,
first of all never use MsgBox in a Server Environment! Not even to just print out some variables! Never ever do that! Its a server environment and as soon as pop up a msgbox the coplete process comes to a halt till some user presses a button! Again, Never ever do that!
As I said before, if you need values for debugging reasons write it in the eventLog, in a Tracing Library, write a file or even use the Debug.WriteLine to see the values.

The scripting functoid only allows very easy and small parts of code. My advice is to always use an external assembly and to refernce that from your project. In an external assembly you can code the whole range of any .NET language. Just remember to place the dll Files of your helper assemblies in the GAC.

For example in every Project I create there are a couple of external assemblys providing helper functions to me. (there is an Orchestration Helper, an Mapping Helper,.....)
 
Stephan,

As you can see I am a novice programmer but I surely am learning every day to be a better one. Your tips/suggestions have been very helpful.

Thanks
Kiran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top