HOWTO biztalk wcf and around it

During my work with BizTalk I love to relax with some games with BizTalk, I love to joke with BizTalk

Just to play and to understand the WCF BizTalk aspects and versioning schemas, now I’ll create a BizTalk WCF round Trip,
a BizTalk Orchestration that expose a WCF port and after that a BizTalk Orchestration that call the BizTalk Orchestration created before and via WCF

I assume that the reader know majors BizTalk aspect yet

You can create a BizTalk WCF service from a orchestration, schema or manually, the procedures are same and the settings too
To make a simple project, get one of these, orchestration
create a BizTalk project  add an orchestration, add two schema and a transformation, same the picture below, you can download this sample HERE

image 

Just to joking revert the nodes in the map

image

 

Set the type modifier of Port Type to Public

image

Save , build, and deploy all

Open WCF BizTalk Publishing Wizard and set the correct Binding for the mission

image

the metadata for WSDL and if you want you can create the receive location  during this step

Select the orchestration, for the schema is the same way

image

Select the project assembly

image

Select Merge all select…. if you want use a unique WCF service for BizTalk orchestration ports, after set namespace as you want and address of WCF service

image

 

Open IIS, create a new application pool
image
and set the identity of application pool under advanced setting to a user that have grant to access to BizTalk BizTalkMgmtDb

select the new virtual directory created from wizard, under advanced setting set the new application pool and test to browse the WCF service .SVC

image

 

These are the most usual errors during its configuration and use

The request matched a wildcard mime map. The request is mapped to the static file handler. If there were different pre-conditions, the request will map to a different handler
this is a typical error, in this case we must check the application pool associated to WCF, and the most important factors are

32bit or 64
you could have a different handler configuration in 32 or 64 bit

.NET Framework, must be 4.0 for BizTalk 2010


[SqlException (0x80131904): Cannot open database “BizTalkMgmtDb” requested by the login. The login failed.

image

The user of application pool associated to WCF service must have grant access to BizTalkMgmtDb, usually I create a specific user


Receive location for address “/SOABizBuzz/WcfService_SOABizBuzz.svc” not found. (The BizTalk receive location may be disabled.)
Must activate receive location


Receive location for address “/SOABizBuzz/WcfService_SOABizBuzz.svc” not found.
The address set in the receive location is wrong

 

 

Create a simple C# windows project, add Services Reference and specify the address of BizTalk WCF service

Remember that the operation name set in the logical port of Orchestration is the method name of the WCF service
image

Create a button in the form a write just the code to call the WCF service, see below

image

Build and execute the sample

image

 

And now the revert!

Create a new BizTalk project, call as you want,
Right click on the project name and select Add Adapter Metadata and select consume WCF Service

image

Select Metadata Exchange for MEX

image

enter the WCF service url and test with Get Button

image

Set namespace and next next

Now you have one orchestration with some artifacts ready to consume, see below

image

and the two schemas, the in and out WCF schemas

and the two binding xml file to create the port under BizTalk Administration console

image

open the BizTalkServiceInstance Orchestration, create two port on the left, the first receive and the second send
add four shape two receive and one send, as picture below

add a request Respond Send Port on the right

image

at the last, to prevent the error of duplicate schema we must change the version of the project

image

the schemas of the first project and second have the same namespace and root node, with the different version in the schemas you can work in BizTalk with the same schema but different version Occhiolino

Remember to specify the documentspecName if you use a XLMReceive Pipeline
Other way is to create a receive Pipeline and specify the schema in disassembler stage

sign the BizTalk Project Build and deploy

Open BizTalk Administration console, right click on your BizTalk application and Import Bindings

Select the the BindingInfo simple file for Basic HTTP binding or Custom Binding for more advanced configuration, for this sample select the more simple

image

Open properties of the new orchestartion and set all binding, I created one receive file port, one send file port and select the port for the HTTP binding to call WCF BizTalk Orchestration

image

 

return to the project and generate a a instance file of the message in , see below

image

image

save the instance result, turn on all BizTalk artifact and paste the file in you directory in

Enter in Out directory and , here we go Occhiolino

I hope to be enough simple in my explanation

have fun with BizTalk!!!

Related blog posts