Can BizTalk validate signatures created with OpenSSL? - biztalk

We use BizTalk to transfer files from one place to another. At the source, the file will be placed in a folder and its corresponding signature file generated using OpenSSL will be placed next to it. We want BizTalk to verify the signature file to see whether the file is intact. We want to do this because the file being read by BizTalk has actually come from a remote source and we need to validate the authenticity.
Can BizTalk do such validation?

Yes. If you can write a C# helper class for it, then yes, BizTalk can call the helper class, from either a map, a pipeline component or Orchestration, and do the validation.

Related

Access Resource File

Can anyone tell how to access resource file in class library asp.net mvc4? I'm building a generic Class Library that I will use it in all my projects. I tried with following code:
HttpContext.GetGlobalResourceObject();
Can anyone tell any other method is there to access the resource file in class library?
Edit based on the comments, including best practices :
To create a Resource file in MVC4 :
In the solution explorer, right click on your project.
Then, you click on "Add", then on "Add ASP.Net folder", and then click on App_GlobalResources.
On the new folder, you right click. Then you add a new Resource File.
You open then this Resource file and can add new resources.
The lefter column is where you set the keys, and the righter one is for the values you have to insert inside it.
Then; it is really easy, you just have to write the following parts of code to access the values you want.
On the c# side, it is :
Resources.NameOfYourResFile.NameOfYourResKey
On the ASP side, assuming that you're using razor, it is :
#Resources.NameOfYourResFile.NameOfYourResKey
Example :
If you have created a a file named "Global.resx", and created the key "ApplicationTitle", which has "My super website" as value, you just have to write the following line of code to put it for example into a string :
string siteTitle = Resources.Global.ApplicationTitle;
and that's it
When you create your resource you have to set the access level from internal (by default) to public. After this you simply can access your resources (if you reference the assembly) by the name of the resource and the static properties generated into them.
I would suggest you to create a new library for Resources
Once you are done making resources key value pairs then add the reference of your Resource Library in to your project. and then you are able to access the resource library in this way
Namespace.ReourceLibraryName.Key
just include System.Web.dll in your class library project and access the resource file just like you would have accessed in the MVC project
HttpContext.GetGlobalResourceObject();
when you add a refrence to this class library project inside your MVC project and run the project this code will be executed in the context of the MVC project and you will get the correct instance of HttpContext.
Note:- directly using HttpContext like this would create problems when you will try to test this application
You can add your resource file any where in your class library, but I think your question is how to use it, If your resource files name is Res1.resx and there is a key in it called message then you can call
Res1.message
from your classes in that library. But you I am sure you would like to use it event from out side the library for that you need to make your resource file public, please refer Visual Studio - Resx File default 'internal' to 'public'
please do let me know if it is the one you need or some thing else?

Calling a web/wcf service from orchestration: adding a generated item vs adding service reference

If I want to call a web service or wcf method from an orchestration, I can do it by either adding a service reference to the project or adding a generated item. What is the advantage of either approach - is there a best practice?
Steef -Jan Wiggers answers a similar question here
TL;DR - Always use the Generated Items wizard.
My 10c - Although the .xsd files imported by Add Service is added as a schema and set to BtsCompile, there are some limitations such as:
Add Service Reference will add the client proxy, which isn't needed in a BizTalk project (and which might 'tempt' your devs to do silly things like using this proxy from a Custom assembly)
Service Reference makes a mess of importing complicated WSDL (e.g. with Generics or dependencies on other Schemas), See Considerations when consuming Web Services
Using the Add Generated Items wizard does extra work for you:
Adds in a Port Type for accessing the service, already preconfigured for the correct message types. Note however that it adds the Port type to a dummy .odx - i.e. don't delete the odx until you've moved the Port type elsewhere.
Allow you to create the Send Port bindings at the same time.
One thing I would recommend with the Wizard, is to create a folder for the WCF reference and always import all the artifacts into the folder (i.e. don't do the usual separation of Schemas from Ports and leave the dummy .odx there as well). This way, if you need to regenerate the items, just delete everything in the folder and start again (sadly, the wizard doesn't have a Update Service Reference equivalent.
Also note that if you do move the generated Schemas and Port Types into a separate assembly, that you will need to change the type modifier access to Public (it is internal by default)

Where and how does the assembly references are serialized or deserialized in Biztalk

I've got stuck with a problem. I've an BizTalk 2010 application which references a Third party Schema dll. Our Architect told us not to directly reference it as it'll take more time to serialize this huge around 9MB dll which will cause Biztalk work more.
Since this Third part dll is a schema dll it'll be deployed to MgmtDb under any of the applications prior any other app deployment. Our orchestration messages has messagetypes which are referenced from this schema dll.
What I want to know is where excatly this serialization of this external dll taking place as the this dll already been deployed and Orchestration instance can reference this against any request messages which comes in.
Do serialization happen for each message which creates an orchestration instance.
Please share your thoughts.
Thanks.
While its true that the referenced assembly will be added into MgmtDB, AFAIK it is only metadata about the assembly and the artifacts in it which is added, e.g.
use BizTalkMgmtDb
select * from dbo.bts_assembly
... dbo.bts_orchestration
... dbo.bt_DocumentSpec
etc.
Possibly he/she is refering to instances of messages created from schema classes in the assembly (and are stored in the messagebox). But the size of the messages will be determined by the size of the data in it, not by the size of the assembly.
Since you seem to need the referenced message schemas, there isn't much option but to reference it in your new project (e.g. unless you have the source to the 3rd party assembly where you could refactor it and split it into several smaller assemblies). The 3rd party assembly needs to be deployed on your BizTalk servers and signed and GACed.
However if this referenced schema assembly also contains other artifacts like custom classes used in orchestrations as variables, these classes will also need to be serializable as soon as the orchestration hits a dehydration point (to avoid this you would need to scope the variables out before the dehydration and / or use an atomic scope to prevent BizTalk from dehydrating at all, but this is generally a bad idea as it will limit scalability)
Your Architect has made an incorrect assumption about when BizTalk performs validation of a Document against its defined Schema.
Validating a large Document against a hefty Schema, such as an EDIFACT or OASIS, can take a lot of resources. BizTalk therefore will not validate an incoming Document against its relevant schema unless you explicitly ask it to do so in the Receive Pipeline. By default, most Pipeline components will have their 'ValidateDocument' property set to 'False'. BizTalk will therefore only perform Document recognition, based on the namespace and root node, and this is done while stream-reading the first couple of hundred bytes of the document stream.
So, you can freely 'reference' the third party DLL, the only performance penalty will be at compile and deployment time. If, for some reason, you need to validate a Document against this Schema, you would need to have it in the Management DB regardless.

ASP.NET - what files store method signature for xml web service?

i find this question tricky but what files store method signature info for xml webservice?
.dll, .asmx, .wsdl, .disco ?
TIA
It goes into a DLL once compiled, but it's in a code file when added to the project (referred to as a proxy class, it's in whatever language your project is). When you add a web reference it's imported this way. Updating the reference updates the .cs (or vb, whatever you're using).
If you want to see what happens, you can generate the code file yourself, see MSDN for details.
So overall: It is WSDL when fetched, converted to a code file when included (or updated), then finally compiled with the rest of your code into the DLL.

Generate webservice from wsdl

This is maybe a really simple question, but I couldn't locate an answer:
For a client I need to HOST a webservice. The client has sent me a wsdl file that the webservice should 'implement'. How do I go about that? I've generated any number of client-rpoxies but this is the other way around. I can use both ASP.NET 2.0 webservices or Windows Communication Foundation.
wsdl.exe /server.
Generates an abstract class for an XML
Web service based on the contracts.
The default is to generate client
proxy classes. When using the
/parameters option, this value is a
element that contains
"server".
You can do a similar thing with svcutil.exe for WCF- something like:
svcutil.exe thewsdl.wsdl /language:c# /out:ITheInterface.cs (I've not tested this).
Edit- John Saunders makes a good point in his answer to favour the WCF approach- I recommend this too.
Actually, you should do this with svcutil.exe, not with wsdl.exe. WSDL.EXE is part of the ASMX web service technology that Microsoft now considers to be "legacy" code, which will not have bugs fixed.
You can do plenty with that WSDL (wissd'le) file.
From doing the WS Class manually to use the Auto Generated class from wsdl.exe
let's imagine that, for your example, you have this WDSL (tooked from WebServiceX.Net)
to create a C# auto generated proxy you go to your command prompt and write:
wsdl /language:cs /protocol:soap /out:C:\myProxyScripts http://www.webservicex.net/TranslateService.asmx?wsdl
Note: inside your C:\Program Files\Microsoft SDKs\Windows\v6.1\Bin folder you will find wsdl.exe or just do a dir /s inside your C:\Program Files\
if you want in Visual Basic, just use /language:vb or /l:vb
/language:
The language to use for the generated proxy class. Choose from 'CS',
'VB', 'JS', 'VJS', 'CPP' or provide a fully-qualified name for a class implementing System.CodeDom.Compiler.CodeDomProvider.
The default
language is 'CS' (CSharp). Short form is '/l:'.
This command will put inside your C:\myProxyScripts the auto generated proxy.
if your using the WSDL file in your computer, just change the URL to your full path, for example
wsdl /language:cs /protocol:soap /out:C:\myProxyScripts C:\myProxyScripts\myWsdlFile.wsdl
Note: your Generated proxy will be called the Service Name, the one you have specified, in our example, as:
<wsdl:service name="TranslateService">
I hope this helps you, understand the WSDL, the Auto Generated Proxies and that you can manage now everything in your end to fulfill your client wishes.
You can use the wsdl utility from microsoft to generate the server interfaces and implement them
Here is a short description of the WSDL utility.
wsdl.exe -
Utility to generate code for xml web service clients and xml web
services
using ASP.NET from WSDL contract files, XSD schemas and .discomap
discovery documents. This tool can be used in conjunction with disco.exe.

Resources