Biztalkien

Leonid Ganeline - Microsoft BizTalk Server & WCF

  Home  |   Contact  |   Syndication    |   Login
  62 Posts | 0 Stories | 76 Comments | 13 Trackbacks

News





free counters

Archives

Post Categories

Image Galleries

BizTalk

Friday, July 31, 2009 #

Version 2.1, 2009-08-09
1        How to use this document
To accommodate this document for the specific solution:
·        Create the real names in Appendix or create a separate Dictionary document.  See Instructions in Appendix.
·        Review the text, marked with [TBD] flag, and change it for your case.
The “Naming guidelines for the .NET Framework types” [ http://msdn.microsoft.com/en-us/library/xzf533w0(VS.71).aspx ] are used as a basis of this document. Also see the “Naming Convention” in Wikipedia [ http://en.wikipedia.org/wiki/Identifier_naming_convention ]
Names should be short, sortable, readable, discoverable, and self-described.
The main test for constructing name rule should be in questions:
·        In what kind of places can I see this name?
·        How easily can I work with the name in these places?
Work” means to read, to find, and to understand sense without errors. Usually we work with names in lists. Think about these places like about namespaces in programming languages.
Short names:
  • Create as short as possible name.
  • Use abbreviations only in restricted cases. See article the “Abbreviationshttp://msdn.microsoft.com/en-us/library/141e06ef(VS.71).aspx
  • Use prefixes and suffixes only to differentiate names.
  • If you see one word in several places of the full name, consider this as a bad signal. Try to redesign the terms used in the names.
Sortable:
  • Create “sortable” name. That means using more generic/important part of the name in the leftmost position. For example, prefer the name Folder_20090515 than the name Folder_05_15_2009.
Readable:
  • Use the name case compatible with the well-known practices in programming languages/protocols with respect to upper and lower cases. For instance, the XML namespaces (URL) should be in lower case format, but the other names should be in the Pascal format. See the “Capitalization Styles” article  [http://msdn.microsoft.com/en-us/library/x2dbyw72(VS.71).aspx ]
    If the word with specific case is widely used in company, don’t force to change it to the Pascal format.
  • Decorate infixes, prefixes or suffixes with lower case and with undrscore. For example: TicketBatch_type, Source1 _and_Source2_to_Target, msg_MyRequest.
Discoverable:
  • The name should be discoverable. That means we easily should understand by the name of the artifact where we can find the artifacts or additional information about it. Names should link artifacts. Say, the schemas with XML namespace the http://domain.company.com/solution/project/2009-05-14 definitely should be in the project the Company.Domain.Solution.Project and in assembly the Company.Domain.Solution.Project.dll.
Self-described (Semantics):
  • Create name form the “business point of view” not form the “developer point of view”, especially the name exposed outside solution.
  • Don’t use generic terms in the names. Examples: Send, Receive, Service, Message, Transformation, Schema, Map, Orchestration, BizTalk.
  • Place a frequently used term into the shared dictionary with comment about where do use it and do not use.
  • Several artifacts have the full names (composited names) and short names. Usually we can easily understand what name we use in the specific context.
·        If we need to add one or more logical grouping into the name, use the composited names created with words separated with dot. In specific contexts the separation symbol can be different, like underscore, dash or backslash. Each <…ShortName> can be a composite name. Composite names can be used for each part of the full names, as Company, Domain, Solution, and Project. For example, you can use name the Schemas.Niem for the project short name.
3        General names
3.1       Syntax
<Company>
<Domain>
<Solution> =:
           <Company>.<Domain>.<SolutionShortName>
<Project> =:
           <Solution>.<ProjectShortName>
3.2        Examples
·        Solution name: short name – MySolution,  full name - MyCompany.MyDomain.MySolution
·        Project name: short composite name – Schemas.Niem; full name - MyCompany.MyDomain.MySolution.Schemas.Niem
4        Names inside BizTalk Solutions
We use term the solution in the Visual Studio meaning, it is a name of the solution we see in the Solution Explorer window in the Visual Studio. Sometimes we mix solution and project terms but not in this document.
BizTalk application is named as solution.
<Solution> =:
           <Company>.<Domain>.<SolutionShortName>
<ApplicationName> =: <Solution>
For example, for the MySolution solution use the MyCompany.MyDomain.MySolution full name.
4.2        Projects, Assemblies, .NET namespaces
We use term the project in the Visual Studio meaning, it is a name of the project we see in the Solution Explorer window in the Visual Studio.
<Project> =:
            <Solution>.<ProjectShortName>
<AssemblyName>           =: <Project>
<Namespace>                =: <Project>
For example, for the MyProject project use the MyCompany.MyDomain.MySolution.MyProject project full name, the MyCompany.MyDomain.MySolution.MyProject assemblyname, and the MyCompany.MyDomain.MySolution.MyProject namespace.
We should separate the .NET namespaces and the XML namespaces. They are different things and used in different places. For brevity we use term the namespace exactly for the .NET namespace and always use the term the XML namespaces for the XML namespaces.
Note: After creating a new project, copy the project name property to the project properties the “Assembly Name” and the “Default Namespace”.
Use the predefined folder structure on all development machines and, if it is possible, on the Test and Product servers. This eliminates the errors and deployment effort because several BizTalk artifacts use the absolute file paths in configuration.
<SolutionsRootFolder> =: c:\Solutions
<SolutionFolder> =:
           <SolutionsRootFolder>\<Solution>
<ProjectFolder> =:
           <SolutionFolder>\<ProjectShortName>
For example, the MyCompany.MyDomain.MySolution.MyProject project is placed in the c:\Solutions\MyCompany.MyDomain.MySolution\MyProject folder.
Use very strict rules for the XML namespaces, because the XML documents expose the data interfaces to the outer world. The XML namespaces should follow the industry standards and the corporate standards. The exposed interfaces are immutable, why we should use versioning for XML namespaces. XML namespaces work as global unique identifiers for nodes of the XML documents.
We must use the URL or URN formats to XML namespaces. Feel free to use one of these standards. See the “Namespaces in XML 1.0 (Second Edition)http://www.w3.org/TR/xml-names/ for more information.
[TBD: Here I use URL format because it is widespread and users are more familiar with it. Note two confusing things about using URL as an XML namespace. First, the URLs are used as addresses. URL in XML namespace works mostly as a global unique identifier, not as an address. Second, reverse names order in URLs, for example, not the http://com.company.domain but http://domain.company.com .]
[TBD: Here I use the URL reverse order for the XML namespaces. Not for the full name but for the “before-solution” part of the name, for the first part of the name before first backslash. If you don’t want to use XML namespaces that works as the web addresses, consider to use the XML namespaces in the generic, nonreversible, sortable order.]
Compose the URLs for the XML namespaces in the reversal order like http://domain.company.com/solution/schemas/2009-05-15 and add the “com” part of URL.
<TargetNamespace> =:
           http://<Domain>.<Company>.com/<SolutionShortName>/<ProjectShortName>/<Version
<Version> =:
            <date> 
           [in YYYY-MM-DD format]
[TBD We considered using two version formats. One format is like 1.0.0.1, the format used for the .NET assemblies. See http://msdn.microsoft.com/en-us/library/51ket42z.aspx . The second version format uses a date. Use the first one only if you can implement strict versioning rules, and in this case you can create/have some version approval procedure. We use here the date format.]
  • Use the same XML namespace for all schemas in one project. Schemas in one project (with equal XML namespace) are differentiated by the root node names. Do not place the root node name inside the XML namespace.
  • Use the project creating date for the first versions of all schemas inside project.
  • Use the current date for the second and next versions.
  • Create the new version only if the old one is published to production (test) environment. Do not create new versions inside development cycles.
  • Use the YYYY-MM-DD date format to make the names “sortable”. Do not use MM/DD/YY format.
  • URLs are case-sensitive (Yes, they are!) but do not use the upper case letters in XML namespaces.
For example, for the MyCompany.MyDomain.MySolution solution and the MyProject project the XML namespace should be the http://mydomain.mycompany.com/mysolution/myproject/2009-05-15 for the first versions of all schemas, if this project was created in 2009-05-15.
6        BizTalk artifacts
6.1        Orchestrations, Schemas, Pipelines
Names of these artifacts appear together with BizTalk application name mostly everywhere. We don’t need to use composite names. Use simple names for the names.
Note: If you see one word in several places of the full name, consider this as a bad signal. Try to rethink the terms used in the names. I repeat this rule here, because exactly in the full names of orchestrations, schemas and pipelines you can frequently see the repetitive words.
6.2        Maps
<Map> =:
        <SourceSchema>_to_<DestinationSchema> [for one-to-one map]
       <SourceSchema1>_and_<SourceSchema2>_to_<DestinationSchema> [for two-to-one map]
           …
If it is possible do not change the schema names in the map name. If the map name is excessive long, cut the schema names, but use the same cut rule for all map names.
6.3        Ports
Ports are the primary artifacts of the BizTalk solution. But in contrast to orchestrations they are used through the BizTalk application boundaries in many places, that is why, we have to use the composite names for the ports like for assemblies.
<Port> =:
            <Solution>.<PortShortName>
Do we need to separate one and two-way ports and send and receive ports, for example be “R_” or “SR_” prefixes? Do they mix up in lookups or in lists? No. And answer to the first question is “No”, do not use prefixes in the port names.
Do we have to use the transport/protocol qualifiers in the port names, like .FILE or .SOAP? No. One port could use several protocols. Moreover port is on the upper level architecture than transport. But for dynamic ports the transport name can be the main part of the port name.
Do we have to use message type in the port names, like .Request? No. One port could work with several message types. But frequently the message type can be used for the port name.
Try to understand the main purpose of the port and use it in the name. For example, link the port name with transport for dynamic port; or link the port name with the partner name, or with message type.
For example, MyCompany.MyDomain.MySolution.MyPartner.
Use the prefixes to differentiate the artifacts in the XLang expressions. These artifacts are not usual .NET objects. They are used in different language context and sometime they use different language syntax. Prefixes really help to work with these artifacts.
<MessageName> =: 
           msg_ + <ShortMessageType>
<VariableName> =: 
           var_ + <Name>
<CorrelationName> =: 
           cor_ + <Name>
<OrchestrationParameter> =: 
           par_ + <Name>
<RoleLink> =: 
           roleLink_ + <Name>
7.2        Orchestration artifact types
 
We can use one suffix the “_type” for all different types because different types are seen only in the different lists and never mixed. For instance, we can never see the port types together with message types.
<ArtifactType> =:
           <ArtifactName> + “_type
<PortName> =: 
           <prefix> + <Name>
where
 
Send port
Receive port
Send-Receive
(Solicit-Response) port
Receive-Send
(Request- Response) port
prefix
S_+
R_+
SR_+
RS_+
 
For example, S_ OrderAck.
Notes:
  • The Port shapes are the real names, the names of the .NET objects. We can’t use spaces inside.
  • In the Orchestration view there are generic lists the “Ports” and the “Port types” that’s why we have to distinguish the ports with different Communication directions and pattern.
7.4        Orchestration Workflow Shapes
Problems with orchestration shapes:
·        Shapes are too small to display long names (only 12-18 characters).
·       We have to “hover mouse over” shape or click shape to show Properties window to "understand" this shape, to understand what message it is processed.
Useful features:
·       Feel free to use the same names for different shapes and use spaces inside the shape names. Shape names are not the “real programming names”. In reality they are the descriptions (excluding the Port shapes names); they are used only for description and for nothing more.
·        Icons on shapes give us the useful information. Do not repeat the “icon information” by words. For example, if we change a name of Construction shape from “Construct Input message” to “Input message” we get more clear definition because we have the Construct icon + name.
·        Shape names are used only in Orchestration Editor (excluding the Port shapes names). We don’t have to force any rules to make the “well-sorted” names (it's the main purpose of the prefixes).
·        Use a Group shape to add description to a group of related workflow shapes. Group shape will display as much text as you want. Group shapes add a lot of documentation value to the orchestration. 
7.4.1          Rules for shapes
Purpose of the orchestration and the most of the shapes is in processing the messages. We can unambiguously describe the messages by the message type. That is why in the most cases using the message type names gives us the main information about this message. That is why in the most cases using the message type names as the shape names gives us the main information about this shape, about message flow, about whole orchestration processing. Send shape with name "OrderAck" means ... exactly!
·        Whenever it is possible use the MessageType of the processed message as a shape name.
·        Do not repeat the type of shape icon by word.
·        Do not repeat words from external shape name into the internal, nested shape name.
·        Feel free to use spaces inside the shape names.
·        Feel free to repeat the shape names.
7.4.2          Rules for specific shapes
Construct, Receive, and Send:
= name of the processed message without “msg_” prefix.
For example, [OrderAck]
Note: it’s easy to set and maintain this name: just copy part of it from Properties/Messages Constructed to Properties/Name. For example, from “msg_OrderAck” copy “OrderAck”
 Transform:
= “from “ + name of the Source message
For example, [from OrderAck]
Note: it’s easy to set and maintain this name: just copy it (or part of it) from Properties/Input Messages to Properties/Name. For example: From “msg_OrderAck” copy “OrderAck”
Assignment:
No strict rules, only advice:
Name it like the methods in classes. But cut a verb if it possible. Use “set” and “get” if it possible.
For example, [set OrderAck]
Consider this chapter as “out-of-scope”. I placed it here because we discussed the folder names here. The files placement is a separate and wealthy topic. Here are only main considerations.
·        If the project is simple, place all files in one project.
·        If we want to use some files for references from other projects, place these files in separate project.
·        Place artifacts to different projects if these artifacts have different refactoring lifecycle. For example, the Niem standard schemas are never changed then place them to the separate project. The maps are changed more frequently than schemas and we could place schemas and maps to the separate projects.
·        Don’t place the technology-specific schemas and maps away from the orchestration they used for. For example, for the SQL port we generate a (technology) schema and usually create the map to transform the original schema to this (technology) schema. Place these schema and map together with orchestration, not into the Schemas/Maps projects.
In the BizTalk project folder add the subfolder the Tests. Use it to the unit tests. Inside the Tests create subfolders: In, Out, TestMessages.
For the BizTalk project with different artifact files you can add the solution folders the Schemas, Orchestrations, and Maps in case you have several schemas, orchestrations, and maps there.              
9        Out of scope
Several BizTalk artifacts are out of scope this naming convention:
·        BRE artifacts: Rule sets, Vocabularies, etc.
·        BAM artifacts: Activities, Views, BAM Definitions, Tracking Profiles
·        Parties, Role links
·        Itineraries from the ESB Toolkit 2.0. I think the ESB Toolkit is a part of BizTalk 2009, because it is delivered in binary format, supported by Microsoft, has a lot of tooling, including Itinerary Designer.
See also
1.      “Naming guidelines for the .NET Framework types” in MSDN [ http://msdn.microsoft.com/en-us/library/xzf533w0(VS.71).aspx ]
2.      “Naming Convention” in Wikipedia [ http://en.wikipedia.org/wiki/Identifier_naming_convention ]
3.      “Abbreviationsin MSDN [http://msdn.microsoft.com/en-us/library/141e06ef(VS.71).aspx ]
4.      “Readability” in Wikipedia [See http://en.wikipedia.org/wiki/Typography ]
5.      “Capitalization Styles” in MSDN  [http://msdn.microsoft.com/en-us/library/x2dbyw72(VS.71).aspx ]
6.      “Assembly Versioning” in MSDN [ http://msdn.microsoft.com/en-us/library/51ket42z.aspx ]
7.      “Namespaces in XML 1.0” [ http://www.w3.org/TR/xml-names/ ]
8.      URN in Wikipedia [ http://en.wikipedia.org/wiki/Uniform_Resource_Name ].
9.      URL in Wikipedia [ http://en.wikipedia.org/wiki/URL ].
 

 
Appendix
Syntax
<Word> =: 
           [A-Za-z1-0]* 
<CompositeWord> =:
           <Word>.<Word>[.<Word>]
<ShortName> :=
           <Word>
           <CompositeWord>
<{Any}ShortName> =: <ShortName>
           [replace {Any} with any term. For example, term Solution creates a <SolutionShortName> term]
<Company> =: <ShortName>
<Domain> =: <ShortName>
<Solution> =:
           <Company>.<Domain>.<SolutionShortName>
<ApplicationName> =: <Solution>
<AssemblyName>  =: <Project>
<Namespace>  =: <Project>
<SolutionsRootFolder> =: c:\Solutions
<SolutionFolder> =:
           <SolutionsRootFolder>\<Solution>
<Project> =:
            <Solution>.<ProjectShortName>
<ProjectFolder> =:
           <SolutionFolder>\<ProjectShortName>
<TargetNamespace> =:
           http://<Domain>.<Company>.com/<SolutionShortName>/<ProjectShortName>/<Version>
<Version> =:
           <date> 
           [in YYYY-MM-DD format]
<Port> =:
            <Solution>.<PortShortName>
<Map> =:
          <SourceSchemaShortName>_to_<DestinationSchemaShortName> [for one-to-one map]
           <SourceSchemaShortName1>_and_<SourceSchemaShortName2>_to_<DestinationSchemaShortName> [for two-to-one map]
Instructions
Keep the names of some BizTalk artifacts in the lists, a list per solution. Create, at last, a list of the XML namespaces of all schemas. Keep them in one list; it forces developers to use naming convention, because inconsistencies in the names are visible inside these lists on the development stage.
1.      Create a new name in the list below.
2.      Copy it to the name property of the new BizTalk artifact.
XML namespace List
Port List
 

Tuesday, July 28, 2009 #

Book “SOA Patterns with BizTalk Server 2009” by Richard Seroter, review
Here is a page from publisher ([PACKT] Publishing)  http://www.packtpub.com/soa-patterns-with-biztalk-server-2009/book
Questions:
Who is the reader of this book? What is the knowledge and experience level of the reader? How good is the book structure?
I think the reader should be a seasoned BizTalk developer. It is not for an entry level developer.
This book is for architects, but for architects with wealthy knowledge of the BizTalk. I would suggest it for a senior BizTalk developers, which is equal to an Integration Architect title.
You can read the first three and the last four chapters of this book only for a quick review of your knowledge.
I highly recommended the chapters from 4th to 7th. They are from Richards’s wealthy experience. They are the heart and soul of the book. I would like to see much more such interesting things, maybe in next edition of this book?
Is it about BizTalk 2009 or about BizTalk?
Chapters from 9th to 12th are about BizTalk 2009 features and tools. Other chapters are more common and do not depend on the last version. They are more than that, better than that.
Is it about SOA Patterns?
Yes, it is.
Is it the “recipe” book?
The book contains a few good recipes, but indeed it is not a recipe book.
Is it the button-to-button book?
No, luckily it is not.
How is the book covering the topics?
Chapter
Audience
Level (1-5)
Grade (1-5)
Chapter 1: Building BizTalk Server 2009 Applications
Architect
Developer
3
1
3
1
Chapter 2: Windows Communication Foundation Primer
Developer
1
1
Chapter 3: Using WCF Services in BizTalk Server 2009
Developer
3
3
Chapter 4: Planning Service-Oriented BizTalk
Architect
3
4
Chapter 5: Schema and Endpoint Patterns
Developer, Architect
3
5
Chapter 6: Asynchronous Communication Patterns
Developer
4
5
Chapter 7: Orchestration Patterns
Developer, Architect
5
3
4
4
Chapter 8: Versioning
Developer
3
3
Chapter 9: New SOA Capabilities in BizTalk Server 2009: WCF SQL Server Adapter
Developer
3
3
Chapter 10: New SOA Capabilities in BizTalk Server 2009: UDDI Services
Developer
3
2
Chapter 11: New SOA Capabilities in BizTalk Server 2009: ESB Guidance 2
Developer
3
3
Chapter 12: What's Next
 
 
 
 
Where Level:
1 – developers with entry level knowledge of BizTalk and no working experience
2 – developers with entry level knowledge of BizTalk and small working experience
3 – developers with fair level knowledge of BizTalk and fair working experience
4 – developers with expert level knowledge of BizTalk and fair working experience
5 – developers with expert level knowledge of BizTalk and expert working experience
I have to say, that several parts of this book “must be read” by every BizTalk developer. I insist these parts MUST be an essential part of the BizTalk Documentation from the early start and it is a shame of Microsoft these chapters are not included in the BizTalk Documentation. For example, the Schema Patterns, Chapter 5, how could developers work with Web-services without basic knowledge about basic principles of serializing schemas to .NET classes?
Sometimes author jumps from really interesting discussions about patterns to examples of how to implement it in “too much details” fashion.
When I ticked on the chapters with 2 or 1 grade, I thought “I cannot find any reason to include this chapter in the book. Here Richard presents only the general information but nothing from his experience. Geners description and general examples, but I would prefer to know the expert opinions, expert arguments, expert views, expert pros and cons.” I understand why these chapters are in the book. However, I strongly believe that the book worth reading if the author express his/her opinions in the text.
For Chapter 11 about ESB I would suggest to see the webcast by Richard Seroter “A look at the ESB Toolkit 2.0 in BizTalk Server 2009http://cloudtv.cloudapp.net/ViewWebcast.aspx?webcastid=2521553277324634479. It is kind of the up-to-date version of this Chapter.
Conclusion
Pros:
“SOA Patterns with BizTalk Server 2009” book contains several very interesting topics.
Book contains an expert point of view.
Book also covers several useful SOA patterns implemented in/with BizTalk Server.
The best part of the book is not only about “how” but about “why” as well.
Cons:
Apparently, the author includes some chapters just to pad the book. But the usable volume is still more than a half. This is good proportion. Yes, it is a good proportion. Usually books of this kind have smaller “performance index”.
Conclusion
This book would be very helpful for the Integration Architects and BizTalk Developers.
Author is one of the most respectful BizTalk experts in the world and his point of view is always interesting.
Must have for every BizTalk Developer.
Highly Recommended
 

Monday, June 29, 2009 #

BizTalk WCF-BasicHttp adapter issue with http://www.w3.org/2001/XMLSchema namespace
 
I am using the WCF-BasicHttp adapter to consume outer Web-service and getting the error (actually if I have retry>0, I am getting Warning first. See below:
 
Event Type: Warning
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5743
Date:  ...
Time:  ...
User:  ...
Computer: ...
Description:
The adapter failed to transmit message going to send port "..." with URL "...". It will be retransmitted after the retry interval specified for this Send Port. Details:"Unable to read the stream produced by the pipeline.
 Details: The value 'd:date' is invalid according to its schema type 'http://www.w3.org/2001/XMLSchema:QName' - 'd' is an undeclared namespace. ".
...
 
or (After retry the previous message the retry limit for this port)
 
Event Type: Error
Event Source: BizTalk Server 2006
Event Category: BizTalk Server 2006
Event ID: 5754
Date:  ...
Time:  ...
User:  ...
Computer: ...
Description:
A message sent to adapter "FILE" on send port "..." with URI "..." is suspended.
 Error details: Unable to read the stream produced by the pipeline.
 Details: The value 'd:date' is invalid according to its schema type 'http://www.w3.org/2001/XMLSchema:QName' - 'd' is an undeclared namespace. 
 MessageId:  ...
 InstanceID: ...
...
 
Very srange. When I tried the same Web-service with SoapUi, the result of the verification of the Response message is similar.
 
line 8: Invalid xsi:type qname: 'd:string' in element ...@http://...
 
What is wrong with response message?
 
Response Message:

<e:Envelope xmlns:d="http://www.w3.org/2001/XMLSchema" xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns:wn1="..." xmlns:wn2="..." xmlns:wn0="..." xmlns:e="http://schemas.xmlsoap.org/soap/envelope/">
   <e:Body>
      <wn2:ActionResponse>
         <wn2:MyResponse i:type="wn2:MyResponseType">
            <wn2:Detail i:nil="true"/>
            <wn2:MyMsg i:type="wn2:ArrayOfMyMsgType">
               <wn2:MyMsgType i:type="wn2:MyMsgType">
                  <wn2:MsgDescriptionText i:type="d:string">...</wn2:MsgDescriptionText>
                  <wn2:MsgIdentificationID i:type="d:string">...</wn2:MsgIdentificationID>
                  <wn2:MsgSeverityLevelCode i:type="wn2:MsgSeverityLevelType">...</wn2:MsgSeverityLevelCode>
                  <wn2:MsgSourceText i:nil="true"/>
               </wn2:MyMsgType>
            </wn2:MyMsg>
         </wn2:MyResponse>
      </wn2:ActionResponse>
   </e:Body>
</e:Envelope>
 
Investigation discovered that the issue is in the namespace prefix "d". If I change it to the "xsd", the error disappeared.
 
Questions:
How to work around this?
Is it the error in the response message?
Is it an error in the WCF-BasicHttp adapter?
 
How to work around this issue?
I changed the WCF-BasicHttp port for the old SOAP port and SOAP port works fine.
 
Is it the error in the response message?
I didn't find any limits for the "http://www.w3.org/2001/XMLSchema" namespace and for prefixes for it. The only limit is "don't use the prefixes, started with 'xml' letters". It is the common practice to use "xsd" prefix for the "http://www.w3.org/2001/XMLSchema" namespace. But it is not the rule.
Seems the WCF-BasicHttp adapter is "too smart".
 
Is it an error in the WCF-BasicHttp adapter?
possible...

Wednesday, April 08, 2009 #

.

BizTalk 2009: notorious Microsoft ADO MD.NET 9.0 and 10.0

 

When I was installing the BizTalk 2009 the Setup asked these prerequisite components:

Microsoft ADO MD.NET 9.0 and

Microsoft ADO MD.NET 10.0

 

I did not have Internet access and I had to manually search for these components.

Seems it is not a simple googling. :)

 

After painful search I've found them here:

1) ADO MD.NET 9.0:

Page "Feature Pack for Microsoft SQL Server 2005 - November 2005" - http://www.microsoft.com/downloads/details.aspx?FamilyID=d09c1d60-a13c-4479-9b91-9e8b9d835cdc&displaylang=en

[- follow PageDown to]

Microsoft ADOMD.NET

...

X86 Package (SQLServer2005_ADOMD.msi) - 3302 KB

X64 Package (SQLServer2005_ADOMD_x64.msi) - 5430 KB

IA64 Package (SQLServer2005_ADOMD_ia64.msi) - 6906 KB

 

2) ADO MD.NET 10:

Page "Microsoft SQL Server 2008 Feature Pack, October 2008" - http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=228de03f-3b5a-428a-923f-58a033d316e1

[- follow PageDown to]

Microsoft ADOMD.NET

...

X86 Package(SQLSERVER2008_ASADOMD10.msi) - 4312 KB

X64 Package (SQLSERVER2008_ASADOMD10.msi) - 9263 KB

IA64 Package(SQLSERVER2008_ASADOMD10.msi) - 6776 KB

 

 

As you can see there is a bad inconsistency in the names!

Hope this article saves you several minutes.


Wednesday, April 01, 2009 #

.
BizTalk: What features we would like to see in future releases
After the MVP Summit [http://geekswithblogs.net/LeonidGaneline/archive/2009/03/09/microsoft-global-summit-mvp-most-valuable-professional-2009-pictures.aspx] we, the BizTalk MVPs, have been asked to give feedback to the product team on what features we’d like to see in future releases.
I created the list of features and separated it into parts. One is from the global, crazy things than never be implemented. But why don’t imagine? Second one is from the small things.
Let start from the big, crazy things:
More flexibility in the deployment and licensing.
What I mean:
1)   Why don't move the BizTalk as a product to cheap segment? (cheap? No, let's talk about bigger)
a)   BizTalk + SQL Express on one box. Then creating a farm of the BizTalk applications would be easier. Load Balancing is moved outside, before the farm. Maybe create a separate product the "BizTalk load balancer"?
b)   Moreover, ship the preconfigured VHD with BizTalk + SQL Express + Windows Server. With possibility to create the farm from these VHDs. (Not so easy because now we have strict limit to the SQL and BizTalk server names, and that limit should be fixed anyway.)
2)   Why don't move to the expensive segment?
a)   Shift to the Windows HPC? What about this? One time the BizTalk was pioneered as the first enterprise level product by Microsoft, created on .NET. Using the HPC methods to get rid of SQL completely, perform all persistency in memory to get super-low latency product.
3)   Reiterate the architecture with all spectrum new Microsoft technologies. Is it possible to extract the MessageEngine, the OrchestrationEngine, and the UnifiedInputOutput Engine to separate products?
4)   At last extract the BRE to separate product or free library! Now it is dead. Give BRE a shock treatment.
5)   Redesign the error processing for different stages of the message processing. Now there are different approaches are used in many places or nothing at all.
6)    Extract the LOB Adapters to separate product on the “buy if you need it” basis or to the free library. Create the Internet store and sell adapters for small money to everyone not only to the buyers of the BizTalk. Sell them not in packages but per adapter.
Now the small things:
Many years there were no improvements in very basic things, the things the developers are using in everyday tasks. I mean: adapters: File, SQL; pipelines; schema and map editors; additional shapes in Orchestrations, etc.
1.      Adapters:
a.    File adapter (for example): add the possibility to use the file names to order delivery (process files in the sorted order, many variations J ); implement the file receive filters with regEx on the file names; add possibility to copy files to other folder after consuming (to make some sort audit/resubmit storage, in forums this question is repeated and repeated, "How we could make a copy of the original files?")
b.    SQL adapter: OMG, there should be many changes in real-time functions and much more improvements in the design-time appearance. I'd prefer to use not the standard Wizard to generate SQL port artifacts but some sort rich-UI window to set up different stages of artifact creation and the real-time parameters.
I am sure the brainstorm by BizTalk MVP should generate a lot of good ideas.
c.      Additional adapters: like Task Scheduler; Nope; Fan-out/Garbage (to consume messages without subscribers in the pub/sub application); PowerShell (for additional processing of the input/output messages). Brainstorm this! Buy these adapters from the third-parts, unify them and include to the standard package.
d.      Please, make InfoPath integration with BizTalk easy as hell!!!! (Isn't it a prime purpose of InfoPath??? To integrate the BizTalk with human?)
2.      Pipelines (pipeline components): where are? the xml <-> PDF ; zip/unzip ; map (yeah! what is wrong with it?); different coders/decoders; symbol (regex) replacement (for EDI processing it MUST be!); PowerShell (for additional processing of the input/output messages); "create message" pipeline; Excel/Word ; Html ; simple EDI (to very basic EDI processing); promote properties from the text; etc. . Brainstorm this!
3.      Add the error processing to the standard interfaces of the custom pipeline components.
4.      Transmitting raw/binary data. Frequently we only use the BizTalk to transfer and route the documents (messages) without transformation. Now it is the second-class citizen scenario.
5.      Orchestrations: additional shapes as: CreateMessage !!!; throwEvent; Pipeline transformation (?).
Make shapes resizable, otherwise we should use odd methods to make the Orchestration more descriptive. How we could show Orchestration to business people if we cannot add enough text to shapes???? Add color to shapes.
Make the Expression Editor window resizable, dockable, fully InteliSensed, etc. !!!!!!!!!!!!!!!!!!
6.      Schema editor: Use the schema node icons for more useful information, definitely, for cardinality (say, different colors for "max occurs = *", for "min occurs = 0"). Maybe add separate window for the referenced (included) schemas?
7.      Map editor: add functoids [IfElse]... Make improvements to the Script functoid!!! Separate to InlineScript; ExternalScript (ExternalMethod?); XsltScript...; make InteliSense to the Inline Script and Xslt script windows. Use the source/target node icons to more usefull information. See http://geekswithblogs.net/LeonidGaneline/archive/2005/12/23/64004.aspx - it is an old list but still actual.
8.      Ports: Please, make ports the first-class artifact as an Orch. Why we should use the orchestration assembly just to store the port type??? Why do we use the "logical port" term in Orchestration editor? It is not a port, it is just an endpoint. Orchestration has the endpoints and the Port has the endpoints. My perception it should be big redesign of the "port part" of the BizTalk architecture. Right now it is a mix of adapters, pipelines, maps, etc. without strict regulation, strict design. This mix is very static, could not be used in structured way to improve the development.

The question to us was: 1) What was/is THE GOOD stuff about the area? 2) What is just plain BAD? 3) What is UGLY about the feature area e.g. if you were developing this feature what would you do to improve it.
I am sorry but I used the same words. To me “UGLY” and “BAD” are just synonyms for ”rudimentary implemented” and “implemented in beta version”.
1)   Monitoring, operations. Now it is UGLY. No real real-time :). See how it works on HPC Windows, for example.
2)   Debugging is plain BAD.
3)   BRE is good, but EVERYTHING for development BR, everything is UGLY.  Development, testing-debugging (come on, have somebody seen the test text window in Composer? the text inside it????), deploying. BRE now is good, very good to sell the BizTalk to business people, and BRE is just pain in ass for developers. Examples?
http://geekswithblogs.net/LeonidGaneline/archive/2006/12/27/102156.aspx
http://geekswithblogs.net/LeonidGaneline/archive/2006/10/16/94245.aspx
Now as a rule of thumb, I use the BRE for POC projects and never for real projects.
4)   To me BAM is kind of partly implemented. Run-time is very good. Design-time is BAD.
5)   ESB. IMHO if the BizTalk gets the Web-service (or metadata) repository, it has ALL ESB functionality and could be named ESB to business people. MVPs discussed this many times on the Summit.
6)   Of course, low latency must be implemented.
 

Monday, March 09, 2009 #

 
Hi All,
I've made pictures on the
Microsoft Global Summit MVP [Most Valuable Professional] 2009 March 1-4, Seattle, Redmond.
Mostly the BizTalk MVPs.
http://public.fotki.com/leogan/cities_and_countries/usa/2009-microsoftgloba/
Steve Ballmer, many vice presidents, Microsoft Fellows, developers from different product teams.
It was fun.
Stephen W. Thomas, Alan Smith, Robert Hogg, Saravana Kumar, Joao Pedro Martins, Ben Cline
Steve Ballmer - Thinker
Microsoft Fellows

Wednesday, October 15, 2008 #

 

Review "MCTS Self-Paced Training Kit (Exam 70-503): Microsoft .NET Framework 3.5 Windows Communication Foundation (PRO-Certification)"

http://www.amazon.com/MCTS-Self-Paced-Training-70-503-PRO-Certification/dp/0735625654/ref=sr_1_12?ie=UTF8&s=books&qid=1224042536&sr=8-12

I like this series of books (SPTK - Self-Paced Training Kit) because the short theory here is always ended with real world examples. And these examples shows how the product is used in the real situations, to solve the real problems. It is like the prioritization of the functionality.

In the WCF documentation on the MSDN there is no such prioritization, great list of the features is here and no clue what are the main features and what are the secondary, additional features.

In the SPTK books there are no place to all features, the goals of these books are different. There are only the main features and steps how they are used to get the real result. For example, the part about MessageContract. A lot of information are in the MSDN, but it is realy hard to understand what the purpose of the MessageContract is. The real world example is shown in this book, how to use the MessageContract to transmit the license key to the client. Short example gives us the understanding of this artifact.

I am working with Web-services more then 4 years, and last year mostly with WCF-services. I was using this book to review my knowledge to make it more systematic. I didn't use this book to prepare for exam ( See discussion about the sertification exams here http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3280207&SiteID=1 )

I use every information source to *understand* what is going on inside the product, why these features were included in the product, what alternatives were and are. Why so? Knowledge does not stucked in my brain without answers to this questions. I could not study the product in the *button-by-button* style as monkey.

I have to know *why*.

Teaching technics usualy use the patterns how the product should not be used, the samples of the improper practice. Usualy it is hard to teach proper technics without list the improper practices. Sometimes one sample of the wrongdoing is worth dozens samples of welldoing.

How does this series of books the SPTK is different from oother books published by Microsoft?

  • Here are only described the *main* product features. These features were selected by Microsoft itself and it works as a unofficial priotirizing. It is very important.
  • Here we see the *real world* problems and ways to resolve them with help of the main product features.
  • In these books are the concisely description (and sometimes the history) what was the *source of these features*.
  • Here we could see the samples of the *improper practice*, how the product should not be used.

 

Pros:

  • This book is the Microsoft vision of what is the intend of the WCF, how the WCF should be used.
  • The concise information about WCF is concentrated in the *Lessons*. The real world samples are placed near it. These samples are also concentrated on the main things.
  • I very like the *Lesson Summary* parts. These lists are the lists of the *prime features* of the WCF.

Cons:

  • Sometimes the book gives us the method in the samples that are obsolete. Say, the generation of the classes from XSD with XSD.exe utility. Several generation of the Software Factory could make this and SvcUtil.exe so.
  • Sometimes the description are not perfect. I have feeling that authors did not squeeze out the whole information from the BizTalk team :) and this is not surprize me because of the huge WCF feature pool. (For instance, we are asked on page.66 to comment attribute the [XmlSerializerFormat...] and regenerate scheams again, then make sure these schemas are going to get big differences from the default schemas. All these exisises with regenerating are useless without detailed explanations.)

 


Conclusion:

I know several good sources of the information about WCF for deep studing.

- and this book is good addition to this list.

I mark this book with 5 stars.

It has flaws, but benefits of using it as a fast and reliable source to study WCF are great.

Best regards!

 




Tuesday, October 14, 2008 #

The WCF has such structure of the performance counter names:
http://msdn.microsoft.com/en-us/library/ms735098.aspx

   ServiceName@ServiceBaseAddress
  (ServiceName).(ContractName)@(endpoint listener address)
  (ServiceName).(ContractName).(OperationName)@(first endpoint listener address)

In MSDN we have:
"There is a limit on the length of a performance counter instance's name. When a Windows Communication Foundation (WCF) counter instance name exceeds the maximum length, WCF replaces a portion of the instance name with a hash value."  http://msdn.microsoft.com/en-us/library/ms731052.aspx


In my case WCF has generated the names:

  notif28.inoti60.removebyrefer54@82rapper|notificationwrapper.svc
  notif28.inoti60.removebymsgid@82rapper|notificationwrapper.svc
  notif28.inoti60.removebyemailid@82rapper|notificationwrapper.svc
  notif28.inoti60.schedule@82rapper|notificationwrapper.svc

(Sorry for rapper :) Originally it was Wrapper)

The question is:
Can I use these names as hard-coded names or
next time the WCF could generate different names???
BTW Such names with a hash value are disaster if I need to use the performance counters in my code.

Say I'd like to get counters for the operation with name "RemoveByReferenceMessage" name.
How I can find my counters with code if I have names:
notif28.inoti60.removebyrefer54@82rapper|notificationwrapper.svc
notif28.inoti60.removebymsgid@82rapper|notificationwrapper.svc
notif28.inoti60.removebyemailid@82rapper|notificationwrapper.svc
notif28.inoti60.schedule@82rapper|notificationwrapper.svc


???
How many chars of the operation name I have to use for search?
How many chars of the endpoint name I have to use for search?
How many chars of the service name I have to use for search?
One good part of this is that is the hash algorithm always gives us the same names. Al last in my experience.
Now I know only one method to use WCF performance counter names in the custom code:
  1. Start WCF service and get the generated performance counter names from the PerfMon.
  2. Use these names in the code.
Disadvantages: After any change in the ServiceName, ContractName, OperationName, ServiceBaseAddress, EndpointListenerAddress we have to repeat these steps again.



Thursday, October 09, 2008 #

Sometimes in the BizTalk forums such questions appear.
"...I have been using event log to test variables. I was hoping there was a way to watch it process in VS like you can debug a forms app."

There is a difference in the usual app and in the "BizTalk app".
When you start usual app it is exactly this app and you could debug it. When you "start" the BizTalk app that could means *many* *instances* of this BizTalk app could works simultaneously.
With BizTalk you have an intermediate layer, the host. This host (actually it is a host instance but it doesn't matter for this case) manages the app *instances*. It could start many app instances simultaneously and then dehydrate, rehydrate, stop, abort them without our intervention.
Ideally we need to attach a debugger to exactly one app instance (which one?) or create a debugger working with many app instances simultaneously.
It is one of the source of the complexity of debugging the BizTalk apps.
BTW What is a BizTalk application at all?

Please, let me know, what do you think.


Wednesday, October 08, 2008 #

Hello,
 
Before Dublin is in charge, especially the Repository for the Web-services I'm using the custom code to manage the buzz  with many URLs in Web.config files
 
There is a utility to change all URLs in .config files by one click.
http://www.codeplex.com/FilesModificatorAdmi

 
1. Purpose.
In my current project we've got a lot of composite WCF-services. We have several environments: Development,Test1, Test2, Production.
We don't have the service repository. That means when we move the services from one environment to another, we have to change addresses (URLs) in the <client> sections of all Web.config files (several dozens). Boring and error prone work, isn't it?
 
The FilesModificatorAdmin utility was created to change all addresses in all Web.config files by one click.
 

2. How it works.
We define the files that should be scanned and changed. We define the root folder for search. We define the replacements substrings like "http://Env1.MyCompany.com/Composite/Promo/PromoService.svc". The utility derives the searching substring RegExes from the replacement substrings like ""http[^\"]*?PromoService.svc".
 
Then the FilesModificatorAdmin utility scans all defined files in all folder tree and replace the substrings.
Utility creates the copy of the changed files as OldName.copy.
Utility output the progress to the screen and optionally to the log file.
Utility could optionally just scan the files and show how many searching substrings were found and where.
 

3. Notes.
 * The rules to derive the RegEx for the search are hard coded.
 * If the FilesModificatorAdmin found the searching substrings but the string does not changed (it is possible because the searching sub string RegEx could find the substring that is equal the replacement substring) the FilesModificatorAdmin does not change the substring. In this case it shows that sub strings were found if option the "find only and do not replace the Substrings" is checked, and it shows that substrings were not found if option the "find only and do not replace the Substrings" is unchecked.
 


GLD (C) 2008

Tuesday, September 02, 2008 #

There is an interesting discussion "BizTalk, From Hub/Spoke to ESB" in the MSDN BizTalk forum: [http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3478379&SiteID=1]


Thursday, July 10, 2008 #

 This is a Part 4 of the Interview articles.
Part 1: "BizTalk 2004, Questions for interview without answers" http://geekswithblogs.net/LeonidGaneline/archive/2006/05/22/79267.aspx  
Part 2: "BizTalk interview questions and principle" http://geekswithblogs.net/LeonidGaneline/archive/2007/07/03/113663.aspx
Part 3: "WCF: Questions for studing and interview" http://geekswithblogs.net/LeonidGaneline/archive/2008/01/07/wcf-questions-for-studing-and-interview.aspx  

Please, mark your skills in the table. 
I completely understand that nobody ever tried ALL the BizTalk features.    
   
Name                                                      Number of the Projects      Months             Skills Mark (1..10 or A,B...)

artifacts:
 applications   
ports, groups, locations   
FTP   
SOAP   
HTTP   
SQL   
WCF   
SMTP, POP3   
MSMQ   
SharePoint   
LOB: EDI base, Siebel, etc. (name them)   
pipelines
pipeline components   
schemas   
maps   
database functoids (or custom DB mapping)   
Xslt   
Xslt templates   
orchestrations   
transactions   
atomic scope  
long-running   
compensation scope    
exception scope     
persistent points   
correlations   
helper .NET classes   
SQL data bases (with relation to the BizTalk)   
hosts, instances   
adapters   
parties   
EDI, AS2 system   
policy, rules, vacabularies   
BAM   
BAS 
Development: 
orchestrations   
port-to-port   
helper .NET classes   
custom adapters   
custom pipeline components   
custom functoids   
rules…   
BAM   
BAS   
ESB  
 Debugging Tuning-Up:   
VS
Nunit   
BizUnit   
LoadGen   
stress testing   
performance metrics   
different utilities (name them)   
multi-server debugging   
MOM   
HAT   
Adm.Console   
PerfMon   
Deployment: 
BTSDeploy   
BTSTask   
MSI, Binding   
multi-server deployment   
clustered MessageBox   
WMI scripts  
   
Development techniques:   
   - correlation   
   - convoy parallel   
   - convoy sequential unified   
   - convoy sequential non unified   
   - long-running transaction   
   - transaction compensation   
  - FIFO   
   - send data to SQL   
   - receive data from SQL   
   - data validating   
 - error handling in the BizTalk applications   
  - BizTalk to/from WS/HTTP apps   
* test-driven development   
* .NET development tools   
   
Programming skills:   
* test-driven programming   
* VS.NET   
* script languages, utils   
* SQL: database normalization, programming   
 Web-programming   
low-end programming   
   
   

   
Several questions (sorry, no more than 2-3 min for answer):
 
  • How do you study BizTalk? what are the main sources of the information? 
  •  Describe creating the full-featured BizTalk application. Just the steps.   
  • Describe debugging the full-featured BizTalk application.   
  • Describe deploying the full-featured BizTalk application.   
  • Monitoring the BizTalk application:   
       


   
Skills Mark Legend:   
 can describe purpose and functionality 
 2 made Sample(s) 
 3 used in one project 
 used in one project recently  
 used in several projects 
 6 used advanced functionality 
 can show my answers in forums and articles in blog 
 8 used API (in code) 
 9 can teach other developers, can show pro and cons 
                 OR  
 A know something 
 B can use in standard cases 
 C can use advanced features, API 
 expert 


Wednesday, July 09, 2008 #

Interesting information in KB:
"How to use distinguished fields and promoted properties in a BizTalk Server project" http://support.microsoft.com/kb/942250
 
"...
  • A promoted property may not be available as a promoted property after you write a value into the message context. This situation can occur if the value that you write into the message context has the same name and namespace that was used to promote the property.
  • Properties that have a null value are not permitted in the message context. Therefore, if a null value is written into the message context, this value will be deleted.
    ..."
 
BTW What is it "a null value"?
  • Is it <shipDate xsi:nil="true"></shipDate> ?
  • Is it absence of the value <shipDate></shipDate> ?
  • Is it "closed tag <shipDate /> ?
  • Is it absence of the whole node?
 
In http://www.w3.org/TR/2004/REC-xmlschema-0-20041028/#Nils we have description of it. But frequently we've got different interpretation of this term. And I am not sure about interpretation in KB
 
 
And let me add one more, not obvious:
  • Distinguished fields and promoted properties have to always get Min/Max Occurs = 1. (Not 0, not "unbounded", only 1)

Tuesday, June 24, 2008 #

Notes

·         Bindings are spread across several namespaces.

·        DataContractAttribute is placed in the System.Runtime.Serialization namespace not in the System.ServiceModel namespace.

·         Configuration sections are spread across several namespaces.

·         ClientSection and ServicesSection: First has the structure client/endpoint, the second – services/service/endpoint. Asymmetric.


System.ServiceModel.dll

System.ServiceModel

·         ServiceHost

·         ChannelFactory<TChannel>

·         ClientBase<TChannel>

Contracts:

·         ServiceContractAttribute

·         OperationContractAttribute

·         MessageContractAttribute

·         FaultContractAttribute

Bindings:

·         BasicHttpBinding

·         NetMsmqBinding

·         NetNamedPipeBinding

·         NetPeerTcpBinding

·         NetTcpBinding

·         WS2007FederationHttpBinding

·         WS2007HttpBinding

·         WSDualHttpBinding

·         WSFederationHttpBinding

·         WSHttpBinding

Exceptions:

·         CommunicationException

·        

 

System.ServiceModel.Activation

·         ServiceHostFactory

·         WorkflowServiceHostFactory

System.ServiceModel.Activation.Configuration

·         DiagnosticSection

System.ServiceModel.Channels

Interfaces:

·         IChannel

·         IChannelFactory<TChannel>

·         IChannelListener<TChannel>

Abstract classes:

·         Binding

·         BindingContext

·         BindingElement

·         ChannelFactoryBase<TChannel>

·         ChannelListenerBase<TChannel>

·         CommunicationObject

·         Message

·         MessageHeader

·        

Bindings:

·         CustomBinding

Binding Elements:

·         TransportBindingElement

·         MessageEncodingBindingElement

·        

System.ServiceModel.Configuration

Sections:

·         BehaviorsSection

·         BindingsSection

·         ClientSection

·         DiagnosticSection

·         ServicesSection

Element: System.Configuration.ConfigurationElement

·         BaseAddressElement

·        

ElementCollection: System.ServiceModel.Configuration.ServiceModelEnhancedConfigurationElementCollection<ComMethodElement>

·         BaseAddressElementCollection

·        

System.ServiceModel.Description

·         ServiceEndpoint

Behavior interfaces:

·         IContractBehavior

·         IEndpointBehavior

·         IOperationBehavior

·         IServiceBehavior

Descriptions:

·         ContractDescription

·         FaultDescription

·         ServiceDescription

System.ServiceModel.Dispatcher

·         ChannelDispatcher

*     ClientOperation

*     ClientRuntime

·         EndpointDispatcher

Filters:

·         ActionMessageFilter

·         MatchAllMessageFilter

·         MessageFilter

·        

System.ServiceModel.MsmqIntegration

·         MsmqIntegrationBinding

System.ServiceModel.Security

Credentials:

Encoders:

System.ServiceModel.Security.Tokens

Tokens:

SecurityTokenParameters:


System.Runtime.Serialization.dll

System.Runtime.Serialization

Attributes:

·         CollectionDataContractAttribute

·         DataContractAttribute

·         DataMemberAttribute

·         EnumMemberAttribute

 

 

System.WorkflowServices.dll (v3.5)

System.ServiceModel

·         WorkflowServiceHost

Bindings:

·         BasicHttpContextBinding

·         NetTcpContextBinding

·         WSHttpContextBinding

 

 




Thursday, June 19, 2008 #

We should install the certificate to the server that hosts the services with Transport level security.

For tests we could use the self-made certificate, for production we recommend to use the certificate issued by the industrial certificate provider as the VeriSign.

1.       Install Microsoft .NET Framework 2.0 Software Development Kit (SDK) (x64) [http://www.microsoft.com/downloads/details.aspx?familyid=1AEF6FCE-6E06-4B66-AFE4-9AAD3C835D3D&displaylang=en]. It is installed by default to the "C:\Program Files\Microsoft.NET\SDK\v2.0 64bit\Bin " folder.

2.       [Optionally, only if you also have server certificate and want to refresh it]"C:\Program Files\Microsoft.NET\SDK\v2.0 64bit\Bin\certmgr.exe" -del -r LocalMachine -s My -c -n MyCompany-HTTPS-Server

3.       "C:\Program Files\Microsoft.NET\SDK\v2.0 64bit\Bin\makecert.exe" -sr LocalMachine -ss My -n CN= MyCompany-HTTPS-Server -sky exchange -sk MyCompany-HTTPS-Key

4.       Install the new certificate to the IIS by the Web Server Certificate Wizard. Open IIS Admin, choose the Web-site, Properties, Directory Security tab, Secure communicationServer Certificate… button, it starts the Web Server Certificate Wizard .

5. Check if the IIS / Web Site / Properties / tab Web Site - SSL Port set up to 443 (

 


To expose the service metadata by HTTPS and HTTP use:

    <behaviors>
      <serviceBehaviors>
        <behavior name="ServiceBehavior_Name">
          <serviceMetadata httpGetEnabled="true" httpsGetEnabled="true" />
          <serviceDebug includeExceptionDetailInFaults="false" />
        </behavior>
      </serviceBehaviors>
    </behaviors>

To expose the service metadata by HTTPS or HTTP only, change attribute the httpsGetEnabled or httpGetEnabled to false.



Monday, June 02, 2008 #

After creating simple WCF service I've got strange errors (see below).
 
The issue was in the names of the response messages.
I used the simple custom rule to name request and response messages (.NET DataContract classes):
<OperationName>Request and <OperationName>Response
For instance I created GetTokenResponse class for the response message of the GetToken operation.
 
And this is the wrong rule!
Why? Because the WCF creates these names for the WSDL metadata files:
 
For instance I've got:
...
<wsdl:message name="ITokenStore_GetToken_OutputMessage">
  <wsdl:part name="parameters" element="tns:GetTokenResponse" /> ...
 
....<wsdl:operation name="GetToken">
  <wsdl:input wsaw:Action=http://MyServices/TokenStore/2008-05-29/ITokenStore/GetToken message="tns:ITokenStore_GetToken_InputMessage" />
  <wsdl:output wsaw:Action=http://MyServices/TokenStore/2008-05-29/ITokenStore/GetTokenResponse message="tns:ITokenStore_GetToken_OutputMessage" />
 
 
When I changed the name to the GetToken_Response the errors disappeared.
It is not an error in the WCF it is just undocumented feature.
The problem is the error text gives us unhelpful and ambiguous information.
 
See the article in MSDN: http://msdn.microsoft.com/en-us/library/ms731045.aspx
Not a clue about these rules.
Conclusion:
Don't use the messages names with suffixes Response, Solicit, Request.
Don't use the name convention for the request and response messages (.NET classes) like <OperationName>Request and <OperationName>Response !
 
ADDITION [2009-07-26]: This behavior is because of the WSDL standard.
See http://www.w3.org/TR/wsdl
"

2.4.5 Names of Elements within an Operation

The name attribute of the input and output elements provides a unique name among all input and output elements within the enclosing port type.

In order to avoid having to name each input and output element within an operation, WSDL provides some default values based on the operation name. If the name attribute is not specified on a one-way or notification message, it defaults to the name of the operation. If the name attribute is not specified on the input or output messages of a request-response or solicit-response operation, the name defaults to the name of the operation with "Request"/"Solicit" or "Response" appended, respectively.

"

Error in SoapUI
, when we've tried to get the metadata:
... ERROR:javax.wsdl.WSDLException: WSDLException (at /HTML): faultCode=INVALID_WSDL: Expected element '{http://schemas.xmlsoap.org/wsdl/}definitions'.
 

Error in IE: by address the <ServiceAddressURL>

The service encountered an error.

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior
 contract: http://MyServices/TokenStore/2008-05-29:ITokenStore ----> System.Xml.Schema.XmlSchemaException: The global element 'http://MyServices/TokenStore/2008-05-29:GetTokenResponse' has already been declared.
   at System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object sender, ValidationEventArgs e)
   at System.Xml.Schema.BaseProcessor.AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item)
   at System.Xml.Schema.Preprocessor.Preprocess(XmlSchema schema, String targetNamespace, ArrayList imports)
   at System.Xml.Schema.Preprocessor.Execute(XmlSchema schema, String targetNamespace, Boolean loadExternals)
   at System.Xml.Schema.XmlSchemaSet.PreprocessSchema(XmlSchema& schema, String targetNamespace)
   at System.Xml.Schema.XmlSchemaSet.Reprocess(XmlSchema schema)
   at System.ServiceModel.Description.MessageContractExporter.Compile()
   at System.ServiceModel.Description.DataContractSerializerMessageContractExporter.Compile()
   at System.ServiceModel.Description.MessageContractExporter.ExportMessage(Int32 messageIndex, Object state)
   at System.ServiceModel.Description.MessageContractExporter.ExportMessageContract()
   at System.ServiceModel.Description.WsdlExporter.CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension)
   --- End of inner ExceptionDetail stack trace ---
   at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()
   at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData()
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleDocumentationRequest(Message httpGetRequest, String[] queries, Message& replyMessage)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest)
   at SyncInvokeGet(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)

Error in IE: by address the <ServiceAddressURL>?wsdl

The service encountered an error.

An ExceptionDetail, likely created by IncludeExceptionDetailInFaults=true, whose value is:
System.InvalidOperationException: An exception was thrown in a call to a WSDL export extension: System.ServiceModel.Description.DataContractSerializerOperationBehavior
 contract: http://MyServices/TokenStore/2008-05-29:ITokenStore ----> System.Xml.Schema.XmlSchemaException: The global element 'http://MyServices/TokenStore/2008-05-29:GetTokenResponse' has already been declared.
   at System.Xml.Schema.XmlSchemaSet.InternalValidationCallback(Object sender, ValidationEventArgs e)
   at System.Xml.Schema.BaseProcessor.AddToTable(XmlSchemaObjectTable table, XmlQualifiedName qname, XmlSchemaObject item)
   at System.Xml.Schema.Preprocessor.Preprocess(XmlSchema schema, String targetNamespace, ArrayList imports)
   at System.Xml.Schema.Preprocessor.Execute(XmlSchema schema, String targetNamespace, Boolean loadExternals)
   at System.Xml.Schema.XmlSchemaSet.PreprocessSchema(XmlSchema& schema, String targetNamespace)
   at System.Xml.Schema.XmlSchemaSet.Reprocess(XmlSchema schema)
   at System.ServiceModel.Description.MessageContractExporter.Compile()
   at System.ServiceModel.Description.DataContractSerializerMessageContractExporter.Compile()
   at System.ServiceModel.Description.MessageContractExporter.ExportMessage(Int32 messageIndex, Object state)
   at System.ServiceModel.Description.MessageContractExporter.ExportMessageContract()
   at System.ServiceModel.Description.WsdlExporter.CallExtension(WsdlContractConversionContext contractContext, IWsdlExportExtension extension)
   --- End of inner ExceptionDetail stack trace ---
   at System.ServiceModel.Description.ServiceMetadataBehavior.MetadataExtensionInitializer.GenerateMetadata()
   at System.ServiceModel.Description.ServiceMetadataExtension.EnsureInitialized()
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.InitializationData.InitializeFrom(ServiceMetadataExtension extension)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.GetInitData()
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.TryHandleMetadataRequest(Message httpGetRequest, String[] queries, Message& replyMessage)
   at System.ServiceModel.Description.ServiceMetadataExtension.HttpGetImpl.ProcessHttpRequest(Message httpGetRequest)
   at SyncInvokeGet(Object , Object[] , Object[] )
   at System.ServiceModel.Dispatcher.SyncMethodInvoker.Invoke(Object instance, Object[] inputs, Object[]& outputs)
   at System.ServiceModel.Dispatcher.DispatchOperationRuntime.InvokeBegin(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage5(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.ImmutableDispatchRuntime.ProcessMessage4(MessageRpc& rpc)
   at System.ServiceModel.Dispatcher.MessageRpc.Process(Boolean isOperationContextSet)



Tuesday, May 13, 2008 #

WCF: Technique of debugging inconsistency between Wsdl and Response messages.

 

I was working with several web-services as a client and had several issues the same kind. WSDL of this services does not conform the Response messages (See below. I’ve bolded the text related to the issue.). I fixed this issue by changing proxy code. It is not a big issue but now we have to manually change proxy every time we have updated the proxy of this service.

 

Here the checklist how debugging this case:

[The proxy for the web-service could be created with any method in Visual Studio 2008 as “Add Service Reference”.]

1.       We have found that the client code cannot get all data from the service. Some data are lost.

2.       Using SoapUI make sure the Response returns all data. This is the sign of this inconsistency!

3.       Using debugger we have found that the data are lost exactly in
      response = client.Method(request)
line in the client code.

What does it mean? The data are successfully returned in the Response message. But the client proxy code could not process them. When the proxy code is deserializing the response message some data are lost. SoapUI does not process returned data, it just shows them as raw text. The proxy code is trying to deserialize this text, converting text to objects in memory. [The deserializer is the code in the Microsoft libraries in the System.Runtime.Serialization namespace. There are two of them in WCF: XmlSerializer and DataContractSerializer.] Some of returned data magically disappeared in the Deserializing process. Description of these cases is in article “WCF: values disappeared in response: derived classes and serialization/deserialization order error” [http://geekswithblogs.net/LeonidGaneline/archive/2008/05/01/wcf-values-disappeared-in-response-derived-classes-and-serializationdeseriazlization-order.aspx]

4.       Go to the proxy source code (maybe in Refeference.cs file) and fix code (see below). This make proxy inconsistent with Wsdl file and next time when you update this Web or Service reference you have to fix proxy code again. But the client deserializes the Response messages properly now!

5.       Document this fix! And do not make it in proxy code. J

You lucky if you have got inconsistency in Response messages. The worst situation if inconsistency is in Request messages. There are only two options: the service does not care about these inconsistencies and you are lucky again, or service reject your request with fault message. Moreover I make sure this message does not give you a clue what is going on.  Try to get the “correct” request from any source and follow the same debugging technique with it.

 

 


[WSDL ]

      <xsd:complexType name="ArrayOf_xsd_string">

        <xsd:sequence>

          <xsd:element minOccurs="0" maxOccurs="unbounded" name="item" type="xsd:string" />

        </xsd:sequence>

      </xsd:complexType>

      <xsd:complexType name="PromoDetails">

        <xsd:sequence>

          <xsd:element name="assetTypes" nillable="true" type="impl:ArrayOf_xsd_string" />

        </xsd:sequence>


[Response message]

               <assetTypes>

                  <assetTypes>Album</ assetTypes >

               </assetTypes>


[Response message How it should be with regard to WSDL]

               <assetTypes>

                  <item>Album</ item >

               </assetTypes>


[Auto generated Proxy code]

        private string[] assetTypesField;

 

        [System.Xml.Serialization.XmlArrayAttribute(IsNullable=true, Order=1)]

        [System.Xml.Serialization.XmlArrayItemAttribute("item", IsNullable = false)]

        public string[] assetTypes {

            get {

                return this.assetTypesField;

            }

            set {

                this.assetTypesField = value;

                this.RaisePropertyChanged("assetTypes");

            }

        }


[Fixed Proxy code]

        private string[] assetTypesField;

 

        [System.Xml.Serialization.XmlArrayAttribute(IsNullable=true, Order=1)]

        [System.Xml.Serialization.XmlArrayItemAttribute("assetTypes ", IsNullable = false)]

        public string[] assetTypes {

            get {

                return this.assetTypesField;

            }

            set {

                this.assetTypesField = value;

                this.RaisePropertyChanged("assetTypes");

            }

        }

 



Wednesday, May 07, 2008 #

The requirements look easy:
We need to monitor the health of the WCF services, availability of the WCF services. Are they up or down?
But we don't want to call operations of the service  because it sometime could change the service internal status and these changes are out of our control.
Some services have special Heartbeat() operation to make the health monitoring easily, but the most have not.
We don't have to check the work status of the web-method. That means we don't care if some underlying services, like SQL databases, don't work and the services available but response with errors. We just want to know are web-services up or down, could they response at all or not. It should be something really easy.
 
Let's start:
I thought this is quite routine task to the service consumers and there should be several routine decisions.
As I know the OpsMngr2007 use something  simple to measure the web-service health.
 
I've asked gurus on the MSDN forums about this.
 
Dan Rigsby proposed:
"A one way Ping() method on the server works well.  If there is an exception, then the channel is broken.  You can have a timer run Ping against the server at some interval.
If this is a duplex callback system you need to be careful.  The server might also need to check if the client is still alive.  You cant have both the servicecontract and callbackcontract have the same named methods, so you will have to rename one of them."
 
Thanks, Dan!
 
I've tried to
      >ping http://text.company.com/adfadfad/asdfadf/adfadfadf.asmx
and
     >ping http://text.company.com/adfadfad/asdfadf/adfadfadf.asmx?wsdl
 
The ping works only for the host name, like
      >ping text.company.com
not for web-service URL
 
It is not what I want.
 
It checks the health of the host, not the web-service.
It does not cover cases with several services on the one host.
It does not cover cases when the host is OK but the service is not response.
 

Islam Eldemery proposed:
"try to subscribe to the events of the communication object (in the client side), so if a service stopped or disconnected you may handle the fault event.. (remember that it can only fault once).

      proxy.InnerChannel.Faulted +=
new EventHandler(InnerChannel_Faulted);

or
      proxy.InnerDuplexChannel.Faulted += new EventHandler(InnerDuplexChannel_Faulted);

see my example of handling a service in a chat application
http://www.codeproject.com/KB/IP/WCFWPFChatRoot.aspx
if this is a duplex communication, to handle the service on the service side, try to check every time on each callback object you have, to see if someone has been aborted or not before you using it (may be a client disconnect for a network failure.. etc.)"

Islam, thanks for response!

 Unfortunately with this technique we can intercept only errors after we unsuccessfully call the service operation, right?
It is not our case. We want to check the availability not "post mortem" but proactively. For instance, click a button and get health of all services. And we cannot call the service operations, it's one of requirements.
 
Martin16 proposed:
"...
Additional ideas (for IIS/HTTP WCF Services) are 
1) a custom availability operation in your service which checks all resources and gives back a result your web application monitor can parse.
2) enable WCF performance counter and create a monitor on top of that.
3) buy Avicode MP (should provide native WCF Service support)"
 
Thanks for help, Martin16!
 
Yeah, 1) is the Heartbeat() operation. It doesn't work in my case where the services are out of mu control.
For 2) First, we want actively to request the health status not to listen how the service responses to the requests of the other clients.
Second, the WCF performance counters... OK I use them with OpsMng2007 I don't like them very-very much. (It's another story).
3) The third-part utils should use the same APIs we use, not something secret.  I also use OpsMngr2007. But I want to use simple and absolutely open (to me) source code.
 
...
So far so good.
Is it possible to use Mex endpoint or something like HttpRequest to <URL>?wsdl to make sure the service is up?
 
I've got one method from the book "Programming WCF Services" by Juval Lowy (page 71). 
Code Snippet:

   MetadataExchangeClient mexClient =

bool isServiceUp = true;
try
{
  
string address = "http://localhost/MyService.svc?wsdl";new MetadataExchangeClient(new Uri(address), MetadataExchangeClientMode.HttpGet);
   MetadataSet metadata = mexClient.GetMetadata();
// if service down I get the exception
}
   catch (Exception ex)
{
    isServiceUp =
false;
}
 
I catch the Exception like {"Metadata contains a reference that cannot be resolved: "http://localhost/MyService.svc?wsdl"} System.Exception {System.InvalidOperationException}
 
Easy and don't heavy load the service.
P.S.    Please, make sure you've read good comment by Islam Eldemery below.
================================================================
Additions:
[2009-07-14]
I moved here a text from the discussions below:
 
Finally, I was creating the custom solution with Heartbeat().
Of course only some Web-services has this method, then I used the regular methods in specific fashion.
1. I must use the method that doesn't change the inner state of the service (logging is OK).
2. I didn't want to overload the service.

I used the insider information about these services.
The idea is to get the ERROR response. I just want response. And the error is a good solution. It doesn't change the service status, it does not overload the service.

The bad thing with the error response is it strictly depends of the implementation. Than means it work only if you know enough about insides of the service.
Other bad thing is you have to implement the pseudo-Heartbeat() in specific way for different services. It consumes the development time.
Conclusion (up-to-date):
Creating a service with high availability, create a Heartbeat() method to provide clients with instrumentation to check the availability of this service. BTW This method could return a valuable information about current/max performance, payload, etc.
========================================================================================

Thursday, May 01, 2008 #

WCF: values disappeared in response: derived classes and serialization/deserialization order error
 
This is a second article about errors with getting data from  the web-services.
"WCF: Deserialization error, the response elements disappeared" ( http://geekswithblogs.net/LeonidGaneline/archive/2008/04/01/wcf-deserialization-error-the-response-elements-disappeared.aspx )
First time the whole elements disappeared from the response messages without any errors. Now only values of the elements disappeared.
 
We got a very strange error.
 
Our client code to one of the third-part web-service could not get the values from the response message.
 
Investigation given us such picture:
The response class has a base class. And the disappeared values are exactly from properties of this class. See the client proxy code that was generated by Visual Studio (Pict.1). Nothing wrong with it.
If we look at the wsdl that was the source for this proxy code (Pict.2) there is nothing wrong too.
The most strange thing is we have the right values in the response message (Pict.3). The errorCode and errorMessage elements have values but then we lost them. We can get them in the code (Pict.4). The output is on Pict.5.
How? Why?
The base class properties are the errorCode and errorMessage, the derived class property is the crn.
The question is in what order those two kind of properties serialize to the elements of the Xml message and then deserialize back to the class properties?
If service and client make serialization and deserialization in the "stack-like" order then everything is OK.
We see that service serialize the derived class properties first and the base class properties last (See Pict.3.1). What about our client? The client is waiting the message with different order of elements (see Pict.3.2)
And this is the source of the problem!
 

In the "Data Member Order " article in the MSDN Library ( http://msdn.microsoft.com/en-us/library/ms729813.aspx ) we see:
 
"...The basic rules for data ordering include:
If a data contract type is a part of an inheritance hierarchy, data members of its base types are always first in the order..."
 
And there is no way to change this behaviour.
 
That's exactly how my client proxy is working. It is waiting the base class properties on the first place and have not get them, and because these properties have minOccurs="0" and nillable="true" attributes the proxy just decided that Xml message does not have properties at all and silently goes on to the first derived class property.
Unfortunately the third-part service uses the opposite order (it uses a java Axis2 service), data members of its base types are always last in the order in the serialized Xml messages.
BTW Here (http://www.onjava.com/pub/a/onjava/excerpt/JavaRMI_10/index.html?page=4) is mentioned that Java uses the same algorithm as WCF. Why does this consuming service use the opposite order? I have no idea.
Jeff W. Barnes in (http://jeffbarnes.net/portal/blogs/jeff_barnes/archive/2007/05/08/wcf-serialization-order-in-data-contracts.aspx) mentioned thet there is the solution but does not give it.
 
Is it possible to change the proxy code on my side to follow the service order? I don't know such options. Seems the WCF-classes where the whole deserialization occurs cannot be tuned up to change this order. Look one more time to the wsdl code (Pict.2). There is nothing about this order, ther is only the complexType the AddNewCreditCardResponse with the extension base="ax21:ResponseData".
Seems the only way to fix the problem is to change the auto generated code for the response message classes and force the right order. (Pict.6) OK from the point of view of WCF it is a wrong code, but what else we could do in this situation?
 
After these changes we've got the right result (see Pict.7).
 
 
 
=======================================================================
[Pict.1: autogenerated proxy code]
    [System.SerializableAttribute()]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://data.transaction.com/xsd")]
    public partial class AddNewCreditCardResponse : ResponseData {
       
        private string crnField;
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=0)]
        public string crn {
            get {   return this.crnField; }
            set { this.crnField = value; }
        }
    }
 ...
    [System.Xml.Serialization.XmlIncludeAttribute(typeof(AddNewCreditCardResponse))]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://data.transaction.com/xsd")]
    public partial class ResponseData {
       
       private string errorCodeField;
       [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=0)]
        public string errorCode{
            get { return this.errorCodeField; }
            set {  this.errorCodeField= value; }
       }
 
        private string errorMessageField;
       [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=1)]
        public string errorMessage{
            get { return this.errorMessageField; }
            set {  this.errorMessageField= value; }
       }
    }
 

[Pict.2: wsdl code]
    <xs:complexType name="AddNewCreditCardResponse">
        <xs:complexContent mixed="false">
          <xs:extension base="ax21:ResponseData">
            <xs:sequence>
              <xs:element minOccurs="0" name="crn" nillable="true" type="xs:string" />
            </xs:sequence>
          </xs:extension>
        </xs:complexContent>
      </xs:complexType>
 ...
      <xs:complexType name="ResponseData">
        <xs:sequence>
          <xs:element minOccurs="0" name="errorCode" nillable="true" type="xs:string" />
          <xs:element minOccurs="0" name="errorMessage" nillable="true" type="xs:string" />
        </xs:sequence>
      </xs:complexType>...
 

[Pict.3.1: original response message]
 ...
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
       <ns:addNewCreditCardResponse xmlns:ns="http://service.transaction.com">
   <ns:return type="com.transaction.data.AddNewCreditCardResponseData" xmlns:ax21="http://data.transaction.com/xsd">
      <ax21:crn/>
      <ax21:errorCode>TXN056</ax21:errorCode>
      <ax21:errorMessage>Process auth with create profile error</ax21:errorMessage>
   </ns:return>
       </ns:addNewCreditCardResponse>
    </soapenv:Body>
 </soapenv:Envelope>
 
[Pict.3.2: response sample with "WCF" order]
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
    <soapenv:Body>
       <ns:addNewCreditCardResponse xmlns:ns="http://service.transaction.com">
   <ns:return type="com.transaction.data.AddNewCreditCardResponse" xmlns:ax21="http://data.transaction.com/xsd">
      <ax21:errorCode>TXN0544</ax21:errorCode>
      <ax21:errorMessage>Process authentification with profile error</ax21:errorMessage>
      <ax21:crn/>
  </ns:return>
       </ns:addNewCreditCardResponse>
    </soapenv:Body>
 </soapenv:Envelope>
 
[Pict.4: test code]
 ...
 Transaction_Ref.TransactionSvcClient client = new TestTxsServiceConsoleApplication.Transaction_Ref.TransactionSvcClient ("TransactionSvcSOAP11port_http");
 
 Transaction_Ref.addNewCreditCardResponse addNewCreditCardResponse = client.addNewCreditCard(...);
 Console.WriteLine("crn: [{0}]", (addNewCreditCardResponse.crn == null ? "null" : addNewCreditCardResponse.crn));
 Console.WriteLine("errorCode: [{0}]", (addNewCreditCardResponse.errorCode == null ? "null" : addNewCreditCardResponse.errorCode));
 Console.WriteLine("errorMessage: [{0}]", (addNewCreditCardResponse.errorMessage == null ? "null" : addNewCreditCardResponse.errorMessage));
 ...
 

[Pict.5: output with original proxy code]
 crn: []
 errorCode: [null]
 errorMessage: [null]
 

[Pict.6: changed proxy code]
    [System.SerializableAttribute()]
    [System.Xml.Serialization.XmlTypeAttribute(Namespace="http://data.transaction.com/xsd")]
    public partial class AddNewCreditCardResponse {
       
        private string crnField;
        [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=0)]
        public string crn {
            get { return this.crnField; }
            set {  this.crnField = value; }
       }
 
        private string errorCodeField;
       [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=1)]
        public string errorCode{
            get { return this.errorCodeField; }
            set {  this.errorCodeField= value; }
       }
 
        private string errorMessageField;
       [System.Xml.Serialization.XmlElementAttribute(IsNullable=true, Order=2)]
        public string errorMessage{
            get { return this.errorMessageField; }
            set {  this.errorMessageField= value; }
       }
 ...
 

[Pict.7: output with changed proxy code]
 crn: []
 errorCode: [TXN0544]
 errorMessage: [Process authentification with profile error]
=========================================
Please, give me a feedback!

Tuesday, April 29, 2008 #

The message audit can be implemented by BizTalk Tracking (BizTalkDTADb) database.
But there is one big "But". This database has predefined, undescribed structure, it should be used only by special BizTalk tools as HAT. We cannot change the audit points, cannot freely create user queries, cannot change structure of this database.
 
It is not so hard to create the custom audit, it is the standard practice to make the custom audit database and gather data for it from the BizTalk application with additions for the Orchestrations.
 
It is good practice to use some standard for the audit architecture. Here I give you two of them.
They are pretty easy and repeat the "Generic Error handling" pattern. They use the Direct port subscription.
  
I. One audit send port, the audit messages are created in different ways. All audit messages have the same message type. The Audit send port is subscribed to the one audit message type.
II. One audit send port with set of the maps, the audit messages are created by these maps.The Audit send port group is subscribed to the all audited message type.
 
We create the standard audit message type; send all audit messages in all audit points to the Direct send port shape; create the Direct send port with subscription to this audited message type. That is all.
[The audit points are the all audited milestones as receiving/sending the message; transforming the message; routing the message , etc.]
 
ToDo list:
  1. Create the generic_audit schema. It can, for example, include elements: "Operation datetime", "Operation type"(Send/Receive/...), "Original message parameter (like File Name)", "Success/Fail status", "My_Specific_parameter" etc.
  2. Create simple maps to produce the generic_audit schema from all other messages. It is not necessarily all audit parameters be mapped from the source message. Some of them might be produced inside map or expressions, for example, the "Operation datetime" parameter.
  3. Create the Audit Send Direct port with these maps in the entry. Make filters for all audited message types, i.e. subscribe to all these message types.
  4. If we want to save the audited messages in the database: Create the Audit database. The simplest database might be with one table and one stored procedure to fill-in this table.
 FYI You can see in MSDN forum (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2452186&SiteID=1) a comment of Kent Weare [BizTalk MVP] about using BAM for auditing:

"...On at least a couple of occasions I have heard MS employees endorse BAM for auditing.  We brought a Microsoft consultant to review our architecture and design with respect to auditing.  He suggested we use BAM for this purpose.  Note he did not endorse message body tracking inside of BAM.  The other place that I have seen it endorsed is at TechEd at one of Darren Jefford's sessions.  
Without a doubt building up the required BAM infrastructure is not a trivial task(especially in an enterprise scenario).  Keeping things simple is often the best solution, so I do think that you have brought up some valid points. ..."

One more discussion about using HAT for tracking messages is here (http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1991237&SiteID=1).