 |
|
 |
Error 1 symbol 'BizLog' is already defined; the first definition is in assembly c:\mar\bizlog\bizlog\bin\debug\bizlog.dll
pls help me out
|
|
|
|
 |
|
|
 |
|
 |
Santiago,
Thanks for the article. I am working in VS.2010 and BizTalk 2009. I got a variation of your code to work, but I could not get the object reference (in your code persona.Nombre) to work. What object does your "persona" refer to? I used the Message Name of the Receive_1 Message to successfully write the XML, but I couldn't find the xml elements in order to pick one out and write it as a string. Not sure where I am going wrong. I ended up just writing a string literal for that part.
Marvin
|
|
|
|
 |
|
 |
Hi!
Persona is a Message.
From Orchestration View, you can see a Module called Messages. From there you can create Messages of any type (System.Xml.XmlDocument or based in your own XSD definition)
To see members in that Message (like nombre in persona.nombre) you have to "promote" the fields in the message. You can do this from the Solution Explorer with right button over the xsd and "Show Promotions". From there you can choose wich fields are going to be visible in the proyect.
Hope it helps.
|
|
|
|
 |
|
 |
Santiago,
Thanks, I think that will help alot. I was using the Message object, what I was missing was the "promotion" part. I am sure that will resolve the mystery for me. I had wondered what that function was for.
Thanks again,
Marvin
|
|
|
|
 |
|
|
 |
|
 |
Santiago,
I got it to work, but it didn't quite work the way I thought it would. My 2 lines of code in my expression now look like this:
BTCSClass.WriteValue(InboundMessage(BizTalkUsesNETdll.PropertySchema.MyOnlyChild));
BTCSClass.WriteMessage(InboundMessage);
Where "InboundMessage" is the message name and "MyOnlyChild" is the only element in the schema underneath the root, and it is a simple string of "Margo". The lines do write "Margo" to the log, and also write the content of the XML. However, I was expecting it to look more like this:
BTCSClass.WriteValue(InboundMessage.MyOnlyChild);
BTCSClass.WriteMessage(InboundMessage);
So I'm not sure what I am doing differently. Like I say, it works fine, I just expected the simpler syntax to work.
Thanks again for your help.
mp
|
|
|
|
 |
|
 |
Hi Marv,
I got in mind a couple of reasons for this issue.
The first one is that in my example I got the message from an xsd definition, an maybe, in your case, the message is from an xml...
The second one: could it be in the variable type you choose for your message?
If you click Ctrl + Space in the Expression box, what do you see? Can you see the message variable of InboundMessage only?
Keep in mind that my example is from VS2005 and Biztalk 2006R2, maybe there are differences between both versions...
I am at home now, and I have no Biztalk Enviroment to test. I will try to help you at monday again.
Best regards.
|
|
|
|
 |
|
 |
Thanks, Santiago. No rush on this at all, I am just doing some experimenting to make sure I can make different things work. I haven't got any critical coding I am trying to get in.
Further, it is working fine! I just wanted to make sure I was doing things correctly, but as you well stated, there are so many variables it is hard to predict what is going on.
When I click ctrl+space in the expression, my window shows "InboundMessage" in the form of an envelope, and it also shows references to my .dll Class, the ports for my orchestration, the Biztalk project itself, as well as references to "Microsoft" and "System".
I do get intellisense when I type in "InboundMessage(", so it was easy to find the "MyOnlyChild" node reference.
...anyway, thanks again for revisiting your 2+ year old post, you've done more than enough!
Marvin
|
|
|
|
 |
|
 |
Hi, I have followed exactly all the steps. My orchestration is a simple one moving a file from one location to another location. Then I have the C# class library to write the file to C Drive.
The Log.txt and content.txt files are not written to c drive.
Not sure if it is a permissions problem? I had tried changing the folder permissions and seems like the two files Log.txt and content.txt do not get created in C drive.
Hope you guys can help.
Thanks.
HW
|
|
|
|
 |
|
 |
Hi,
is the file moved? Have you check out the Event Log for any errors? You can add some Event Log traces communication inside the custom component in order to follow the execution.
Did you select the correct orchestration in the Biztalk Application to move the files instead select the output directory from the Receive Location?
Hope it helps
|
|
|
|
 |
|
 |
For me, the c:\ folder was protected so I changed the code to write to another folder.
I also had to remove the writing to the System Event Log ( System.Diagnostics.EventLog.WriteEntry("BizLog", value);) because that log does not exist for me.
Marvin
|
|
|
|
 |
|
 |
can u tell me how can i handle Exception in Expression window
plz help me in that or i have to do it on External Assembly
thank you
|
|
|
|
 |
|
 |
Hi,
as far as I know, you can´t handle Exceptions inside the code of the Expression Shape with a Try/Catch block.
Maybe other people knows other ways but I only know three ways:
1.Handle the exception inside the external assembly
2.Handle the exception inside the orchestation with a Scope Shape
3.Handle the exception with Enterprise Library (I don´t know how to do this, but I know that is possible and it´s recommended by Microsoft in some cases)
Hope it helps.
Regards.
|
|
|
|
 |
|
 |
I'd like to add a special point about properties with only get accessors that might save someone some time...
I needed to use a .NET assembly I downloaded from the web that was a wrapper for GnuPGP. I created a Console Application to test the wrapper. From the test class I was able to set the public properties I needed. For example:
gpgWrapper.homedirectory = strGnuPGHomeDirectory;
gpgWrapper.passphrase = ""; // for encryption, no passphrase is needed
gpgWrapper.originator = ""; // for encryption, no originator is needed
gpgWrapper.recipient = strGnuPGRecipient;
gpgWrapper.command = Commands.Encrypt;
... before calling the ExecuteCommand method to perform the encryption, but when I tried setting those same properties from BizTalk, I could not see them in Intellisense, yet I could see some of the properties and methods. After wasting half a day trying to solve it on my own, I submitted a new thread in Microsoft Discussions Group for BizTalk General (see, "Problem accessing an external .NET assembly from BizTalk") and Dan Rosanova provided the answer.
It turned out that certain properties in the wrapper only had "set" accessors and no "get" accessors. For example:
public string homedirectory
{
set
{
_homedirectory = value;
_bindirectory = value;
}
}
Surprisingly, I was able to access them in the Console Application, but not BizTalk. Dan's suggestion was to either develop a constructor that would set all the properties I needed, or provide get accessors for each of the properties.
|
|
|
|
 |
|
 |
Santiago,
good blog. I looked for this too and coulnd't find many blogs out there specifically outlining the steps. Luckily I remember an example in the BizTalk Server 2004 Unleashed book that references a .NET assembly, and another in the BizTalk 2006 Recipes book.
However, please check your information. As far as I know, you do NOT need a reference to Microsoft.XLANGs.BaseTypes in your .NET component unless you are going to be receiving or sending a message from/to BizTalk. For example, if your class were only implementing the WriteValue method, then there would be no need to add the reference to Microsoft.XLANGs.BaseTypes.
Can anyone else please confirm this?
|
|
|
|
 |
|
 |
Yes, is right,
if you are not going to receive the whole message, you don´t need to add the Microsoft.XLANGs.BaseTypes assembly. I will modify the post in order to explain this.
Thank you and regards.
|
|
|
|
 |
|
 |
You can also pass in a Message to a .net component as System.Xml.XmlDocument
public void WriteMessage(XmlDocument msg)
{
string mystring = msg.InnerXml;
File.WriteAllText("C:\\content.txt", mystring);
}
so you avoid the extra step of converting it from an XLANGMessage.
Be aware, this might not work as well for multi-part messages.
Cheers,
Brett
|
|
|
|
 |
|
 |
You are right, this way you avoid to reference the XLANG.BaseTypes assembly.
Thank you.
|
|
|
|
 |