SOAP Headers in BizTalk - Marcel's SOA & BPM blog

SOAP Headers in BizTalk

Published Monday, March 09, 2009 6:52 PM

I recently had to do a proof of concept, where I had to connect BizTalk Server to some internal web services. Normally this isn’t a big deal, but now I ran into a problem: the web services expected a SOAP Header. I will spare you the steps that I took and didn’t work. Below is a working solution, although I have some ideas to make it much more flexible.

Step 1. Import the web service definitions in Visual Studio

Add generated items -> Consume WCF Service -> Metadata Exchange (MEX) endpoint -> path to service

This generates the following files

- An orchestration

- Several xds’s

- 2 binding files: the normal binding file and a custom binding file

Step 2. Use the generated items in the project

Basically this means importing the binding file (the ‘normal’ one) and using the xsd’s and generated port (in the generated orchestration) to do what the orchestration should do.

Wcf-SendPort

Step 3. Add SOAP headers

This was the most difficult step, but now I know how to do it, it is actually quite easy and logical.

In the Construct Message shape add a Message Assignment shape to fill the SOAP header.

MessageAssignment

The SOAP header is called ‘WCF.OutboundCustomHeaders’.

msgRelatieLeesReq(WCF.OutboundCustomHeaders) = "<headers><h:header xmlns:h=\"http://schemas.customername.nl/soap\" xmlns=\"http://schemas.customername.nl/soap\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><account>POC</account><naam>POCESB</naam><wachtwoord>pocesb</wachtwoord><bedrijfsnummer>1</bedrijfsnummer><tussenpersoonnummer>0</tussenpersoonnummer></h:header></headers>";

I also had a namespace problem, so I added all the namespaces from the previous project.

I am sure this can be much ‘nicer’ and more flexible. But this works!

P.S. Thanks to Patrick Wellink for pointing me in the right direction.

Opgeslagen onder:

Commentaar:

Geen commentaar

Wat denkt u?

(Verplicht) 
(Verplicht) 
(Optioneel)
(Verplicht) 
CaptchaCube Vraag:


Antwoord: