Welcome to Comunidade Bloggers |create|it| Sign in | Join | Help

Biztalk xml header processing

When we use infopath or similar technologies with biztalk, the messages have always a xml processing header. Biztalk does not copy xml processing header to the output messages by default, so we have to set it manually.

There are several options in biztalk to manipulate xml header processing in output messages:

  • Set the header in orchestration using the message context properties

Example
message(XMLNORM.ProcessingInstructionOption) = 0 (append) or 1 (create new);
message(XMLNORM.ProcessingInstruction) = “xml processing header to add or append”;

Important: For the demoting process to occur, you must use the Xml assembler component or xml transmit pipeline in the output send port.

  • Use xml transmit pipeline or a custom pipeline with the xml assembler component in the output send port

When you use the xml transmit pipeline, you must set the following properties:

ProcessingInstructionsOptions – 0 (append) or 1 (create new)
XmlAsmProcessingInstructions - “xml processing header to add or append”

When  you use a custom pipeline with xml assembler component, set the following properties:

Add Processing Instructions – Append or Create new
Add processing instructions text -
“xml processing header to add or append”

  • Use a custom pipeline component

This option is the most difficult to implement, you have to create a custom assembler component, get and change de output message.

Do not forget to set the the biztalk maps property “copy processing instructions (pis)” to “yes” when you want to copy the processing instructions from the input to output messages.

Posted by tpo | 0 Comments
Filed under: ,

Using xpath function in orchestrations

Xpath is a function that can be used in any orchestration to set and retrieve data from/to messages.

The syntax is very simple:

  1. Set a value in message
    xpath(message, "xpathQuery") = value;
  2. Get a value from message
    variable = xpath(message, "xpathQuery");

The first problem that all users complains it's how to get the xpath of a specific message element. This can be achieved by going to the properties of the chosen element and copy the "Instance XPath" property value.

 

Another problem is using Xpath function to get message elements data. When you want to get a string value to a string variable, for example, you must use the xpath string function.

stringVariable = xpath(message, "string(xpathQuery)");

For a number value

intVariable = xpath(message, "number(xpathQuery)");

If you want to use the Xpath function to get xml data to a XmlDocument variable you must not use any xpath function.

xmlDocumentVariable = xpath(message, "xpathQuery");

Some examples:

booleanVar = xpath(message, "boolean(/*[local-name()='Root' and namespace-uri()='http://TestNamespace/200902']/*[local-name()='IntField' and namespace-uri()=''])");

xmlVariable = xpath(message, "/*[local-name()='Root' and namespace-uri()='http://TestNamespace/200902']/*[local-name()='anyField' and namespace-uri()='']");

xpath(message, "/*[local-name()='Root' and namespace-uri()='http://TestNamespace/200902']/*[local-name()='anyField' and namespace-uri()='']") = xmlVariable.InnerXml;

xpath(message, "/*[local-name()='Root' and namespace-uri()='http://TestNamespace/200902']/*[local-name()='BooleanField' and namespace-uri()='']") = booleanVar;

xpath(message, "/*[local-name()='Root' and namespace-uri()='http://TestNamespace/200902']/*[local-name()='IntField' and namespace-uri()='']") = 3;

Posted by tpo | 0 Comments
Filed under:

Replace namespace prefix pipeline component

In some biztalk integrations with legacy systems, there are message specifications that requires a specific namespace prefix, but all biztalk messages use ns0, ns1, ns... definition to define prefix information.

To solve this problem there are two solutions :

  1. You can replace the prefix data in all maps output xslt, then replace the map with the changed xslt, solution explained in Jeff Lynch blog.
  2. Use a custom pipeline with a component that makes the necessary replacements.

If you have few maps that do not change frequently, you can implement the first solution, otherwise the second solution is better.

I have created a custom component, based on the ESB Guidance namespace component, that perform the prefix replacements. It only requires the old and the new prefix name and uses streams in the replacement for better performance.

Before use, check the regular expression replacement agains your message schemas, and see if doesn't make any unnecessary replacement.

Posted by tpo | 0 Comments
Filed under:

How to - Validate Windows Workflow custom activity input

Windows Workflow allow us to perform custom validator input that is executed at design and compile time. The error output is similar as Biztalk Orchestration shape errors.

Adding a validator to a custom activity involves two steps:

  1. Create a class that derives from ActivityValidator class and override Validate method;
  2. Add a ActivityValidator attribute with the validator type to the custom activity;

As an example, i'm going to show a validator creation that verifies if a specific property is set.

I have already created a custom activity that is called Hello and have a property that receives the user name. To validate if the activity proprety is set, i'm going to create a validator. 

ActivityValidator class creation:

As said early, to create a validator i have to create a class that derives from ActivityValidator. To perform the validation i have to override the validate method and set the validation code.

using System;

using System.Text.RegularExpressions;

using System.Workflow.ComponentModel.Compiler;

internal sealed class ExampleValidator : ActivityValidator {

    public override ValidationErrorCollection Validate (ValidationManager manager, object obj)
    {

        if (manager == null throw new ArgumentNullException("Invalid manager.");)

        if (obj == null throw new ArgumentNullException("Invalid activity.");)

        HelloActivity activity = obj as HelloActivity

        if (activity == null) throw new InvalidOperationException("Activity should be a HelloActivity.");

        ValidationErrorCollection errors = base.Validate(manager, obj);

        // Validate UserName property setting validationErrorCollection with information
        // about the property that causes the error.

        if (string.IsNullOrEmpty(activity.UserName)) {
           
errors.Add(ValidationError.GetNotSetValidationError("Username"));
        } 

        return errors;
    }
}

 

Custom activity and validator association

To associate the validator with the custom activity it's used the activityvalidator attribute.

[ActivityValidator(typeof(ExampleValidator))]

public sealed class HelloActivity : System.Workflow.ComponentModel.Activity {..

 

In the end the custom activity validator error will be show like this:

WFValidator 

Posted by tpo | 0 Comments

Using WF CallExternalMethod activity in Windows Workflow

The CallExternalMethod Activity allows us to make synchronous communication between Workflow and the Host through the Local Service using Local Service Communication.

Local Service Communication allows workflows to communicate with an external service that resides within the Host.

Using this activity involves 4 phases:

1.    Contract interface creation;

2.    Workflow CallExternalMethod activity configuration with the contract interface, the parameter(s) and return properties (if applies);

3.    Contract implementation creation;

4.    Using ExternalDataExchangeService class at the Host, to register the Contract implementation

We can optionally set the input properties and read the return data.

Example:

In this example I'm going to show the execution of a simple method that returns the 2 input parameters concatenation.

1.    Contract interface creation

    In the contract interface you have only to create the interface contract definition used by the Workflow.

    You're going to create an Interface named "IContract", which defines the Concatenate method.

    All interfaces must have the ExternalDataExchange attribute defined that marks the interface as a local service interface.

       [ExternalDataExchange]
    public interface IContract 
    {

        string Concatenate(string parameter1, string parameter2);
       }

2.    Workflow CallExternalMethodActivity configuration

    Add the CallExternalMethodActivity to the Workflow.

    The Workflow will appear like this:

    Then you will create three properties that correspond to the two input parameters to concatenate and the return concatenation.

    public string Parameter1ToConcat { get; set; }

    public string Parameter2ToConcat { get; set; }

    public string ConcatenateReturn { get; set; }

    

    Configure the CallExternalMethodActivity properties like this:

InterfaceType

IContract interface

MethodName

Concatenate

Parameter1 & parameter2

Parameter1ToConcat & Parameter2ToConcat properties

(ReturnValue)

ConcatenateReturn property



 

3.    Contract implementation creation

    At the contract implementation creation, you have to create a class that implements IContract defined at the first step.

  public class ContractImplementation : IContract
  { 

      public string Concatenate(string parameter1, string parameter2)                      
      { 

          return parameter1 + parameter2; 
           }            
   }

4.    Host configuration

    At the Host, the contract implementation is registered by using the ExternalDataExchangeService class.

    The input properties can be set by using the second parameter from the CreateWorkflow method.

    The return parameter can be retrieved using the OutputParameters property from the WorkflowCompletedEventArgs class, at the WorkflowCompleted event.

using (WorkflowRuntime workflowRuntime = new WorkflowRuntime())

  …  
  workflowRuntime.WorkflowCompleted += delegate(
          object sender, WorkflowCompletedEventArgs e) 
    {
      // this is where we can get the return value 
      Console.Write((string)e.OutputParameters["ConcatenateReturn"]); 
      waitHandle.Set();
    } 
  … 
  ExternalDataExchangeService externalDataExchangeService = new ExternalDataExchangeService();  

  // add the external data exchange service to the runtime 
  workflowRuntime.AddService(externalDataExchangeService); 

  // add the external method implementation to the local services 
  // this is where we add the object(that implements IContract)
  // that is going to be invoked by the CallExternalMethodActivity 
  externalDataExchangeService.AddService(new ContractProject.ContractImplementation()); 

  Dictionary<string, object> parameters = new Dictionary<string, object>(); 

  // add both paramenters  
  parameters.Add("Parameter1ToConcat", "1"); 
  parameters.Add("Parameter1ToConcat", "2"); 

  WorkflowInstance instance = workflowRuntime.CreateWorkflow(
              typeof(WorkflowConsoleApplication1.Workflow1), parameters); 
  instance.Start(); 
  waitHandle.WaitOne();

Posted by tpo | 1 Comments

Como executar pesquisas ao estado de um Workflow de máquina de estados

Um Workflow de máquina de estados permite que sejam efectuadas pesquisas sobre uma instância.

 Para tal deve-se usar um objecto da classe StateMachineWorkflowInstance (System.Workflow.Activities), que permite por exemplo obter a seguinte informação de uma instância:

  • O estado corrente;
  • As transições possiveis;
  • O Histórico das transições;
  • Enumerar todos os estados da máquina de estados

Exemplo

StateMachineWorkflowInstance stateMachineWorkflowInstance = new StateMachineWorkflowInstance(workflowRuntime, instanceId);

//obter o estado corrente
StateActivity currentStateActivity = stateMachineWorkflowInstance.CurrentState;

//obter os estados possíveis de acordo com o estado corrente
ReadOnlyCollection<string> possibleStateTransitions = stateMachineWorkflowInstance.PossibleStateTransitions;

//só funciona se SqlTrackingService está a ser usado
ReadOnlyCollection<string> stateHistory = stateMachineWorkflowInstance.StateHistory;

//obter todos os estados
ReadOnlyCollection<StateActivity> stateActivitiesList = stateMachineWorkflowInstance.States;

Posted by tpo | 1 Comments

Ciclo de Webcasts - Introdução ao Windows Workflow Foundation com a Framework 3.5

Nos passados dia 3 e 4 de março fiz uns webcasts para Webcasts4share da Microsoft sob o tema "Introdução ao Windows Workflow Foundation com a Framework 3.5". Ainda não estão disponíveis para download, espero no final desta semana, publicar os links para os mesmos.

Os Webcasts tal como indicado foram divididos em duas partes.

Podem fazer aqui o download dos slides da parte 1 e da parte 2.

A parte 1 foi dividida nos seguintes módulos:

  1. Introdução
  2. Windows Workflow Foundation
  3. Actividades
  4. Workflows Sequenciais
  5. Hosting e Runtime Services
  6. Workflows de máquina de estados

Foram apresentadas as seguintes demonstrações, que podem fazer download:

  1. Criação de um Workflow sequencial simples - download
  2. Passagem de parâmetros entre o host e um Workflow sequencial - download
  3. Persistencia do estado dos Workflows para Sql-Server - download
  4. Criação de um Workflow de máquina de estados - download
  5. Comunição do host com um Workflow de máquina de estados assincronamente por eventos - download

A parte 2 foi dividida em :

  1. Criação de actividades à medida
  2. Desenvolvimento de Workflows
  3. Novidades na Framework 3.5

Foram apresentadas as seguintes demonstrações:

  1. Criação de uma actividade que permite escrever para ficheiro - download
  2. Mostrar potencialidades do Designer, fazendo-se as seguintes modificações na actividade anterior (download):
    • Alteração do layout
    • Criação de um validator
    • Acrescentar uma nova opção no menu do botão dto do rato, mostrando-se um OpenFileDialog que permitia escolher a localização do ficheiro
  3. Criação de um Workflow usando Xml - download
  4. Compilação e execução do Workflow criado no passo anterior por código - download
  5. Invocação de um serviço Wcf pelo Workflow - download
Posted by tpo | 3 Comments

Set Sharepoint workflow task permissions

I have saw many posts about this problem, many questions but few answers.

 So, how do we set permissions to workflow tasks:

  1. In workflow code behind create a HybridDictionary property something like this:

    WorkflowTaskPermission - Property

  2. Go to the CreateTask action/shape properties

    WorkflowTaskPermission - TaskCreationProperties

  3. The hidden feature is in the SpecialPermissions property

    When you click the "..." button as usual this window appears

    WorkflowTaskPermission - wrongWindow.JPG

    The big secret is not to click the "..." button in the SpecialPermissions property, but in the round blue circle near SpecialPermissions, this window appears

    WorkflowTaskPermission - RightWindow.JPG

  4. Choose the right property and it's working

    WorkflowTaskPermission - ChooseProperty.JPG

Simple and easy.

Posted by tpo | 0 Comments
Filed under: ,

Microsoft Tech Ed 2007 - Barcelona

5-9 Nov 2007, i'll be there with Jota.
Posted by tpo | 0 Comments
Filed under:

Custom Property demotion - Using IDocumentSpec and IPropertyAnnotation

Sometimes the property demotion rules are very difficult to apply in the Xml Assembler Pipeline. There are some limitations:

   • The Biztalk context dependency forces that data must be in message context when the demote occurs;
   • Orchestrations must promote all the data to be demoted, so there is a dependency orchestration -> pipeline;
   • The data to demote cannot be accessed by the orchestration;
   • The data to be demoted can only be calculated in the pipeline context;
   • Little control of the process; 

The problem can be solved creating a custom pipeline component. There are two interfaces that can help our job, IDocumentSpec and IPropertyAnnotation.

The IDocumentSpec (http://msdn2.microsoft.com/en-us/library/microsoft.biztalk.component.interop.idocumentspec.aspx) can be obtained by IPipelineContext interface methods GetDocumentSpecByName and GetDocumentSpecByType. It is used to get document or envelope schema property and distinguished fields (by IPropertyAnnotation).

The IPropertyAnnotation interface allow us to access data from property and distinguished fields.
It can be obtained using IDocumentSpec methods GetPropertyAnnotationEnumerator (property fields) or GetDistinguishedPropertyAnnotationEnumerator (distinguished fields).
IPropertyAnnotation has three main properties: Name, Namespace and Xpath:
• Name is the name of the property schema;
• Namespace is the property schema namespace;
• Xpath is the Xpath query to access the schema element;

With these properties we can set any data dynamically in messages. We can use the name and namespace to access context data, query a database or other repository and use Xpath to set the data.


Example

IDocumentSpec documentSpec = pipelineContext.GetDocumentSpecByName(MESSAGE_SCHEMA_NAME or MESSAGE_ENVELOPE);
                                            
IEnumerator annotations = documentSpec.GetPropertyAnnotationEnumerator();

while (annotations.MoveNext()) {
    IPropertyAnnotation annotation = (IPropertyAnnotation)annotations.Current;
    // Use annotation.Name or Namespace to get the data to demote in message
    // Make manual demoting using annotation.Xpath.
}
     
       
Usage scenario

1. Use IDocumentSpec to retrieve all message schema or envelope annotations;
2. Use annotation Name and Namespace properties  to get data to demote (from message context, database or other source);
3. Use  annotation Xpath property to make message manual demotion;

Posted by tpo | 0 Comments
Filed under:

Dicas relativamente a event handlers de sharepoint

Aqui vão algumas dicas no desenvolvimento de handlers de sharepoint:

  • Um event handler relativamente a items, usa as permissões do utilizador que o submete.

Terá de se ter cuidado, pois esta situação representa um enorme factor de bugs/problemas. Em caso de se manipular informação não acessivel a todos os utilizadores, fazer impersonate. Ver http://dotnetjunkies.com/WebLog/victorv/archive/category/2032.aspx .

  • Existe uma enorme confusão relativamente às propriedades After e BeforeProperties.

Nos testes efectuados estas propriedades não apareciam preenchidas no evento ItemUpdated, logo não tinha forma de obter valores anteriores ao update. A solução passa por escrever em properties.AfterProperties (properties.BeforeProperties é read only) os dados desejados no evento ItemUpdating.

properties.AfterProperties["xpto"] = properties.ListItem["xpto"]

 Assim em ItemUpdated, poderemos sempre obter o "estado anterior" do item.

  •  Para criar/editar as permissões de qualquer item submetido, dá imenso jeito usar o objecto Contact (Microsoft.Office.Workflow.Utility). O mesmo poderá ser criado usando o seguinte método estático Contact.FromName(contactName, site).

        internal static void SetPermissions(SPWeb web, ref SPListItem listItem, IList<Contact> itemUsers, SPRoleType roleType)
        {
            if (itemUsers != null && itemUsers.Count > 0)
            {               
                //Get Role Definition from SPWeb
                SPRoleDefinition roleDefinition = web.RoleDefinitions.GetByType(roleType);

                foreach (Contact contact in itemUsers)
                {
                    SPRoleAssignment roleAssignment = new SPRoleAssignment(contact.LoginName,
                                                                        contact.EmailAddress,
                                                                        contact.DisplayName,
                                                                        null);

                    roleAssignment.RoleDefinitionBindings.Add(roleDefinition);                                                        
                    listItem.RoleAssignments.Add(roleAssignment);                   
                }
            }
        }

Posted by tpo | 0 Comments
Filed under:

Criar um webservice para aceder ao contexto do Windows SharePoint Services 3.0

O processo de criação de um webservice para aceder ao contexto do Windows Sharepoint Services 3.0 é uma tarefa de certa forma complexa, terão de se efectuar um conjunto de passos que descrevo nos pontos seguintes:

  1. Criar Webservice
  2. Assinar a assembly e registar na gac
  3. Colocar assembly do webservice na virtual directory "bin" da web do sharepoint (por omissão C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin)
  4. Colocar .asmx na virtual directory "_vti_bin" da web do sharepoint (por omissão em C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\isapi)
  5. Usar a tool "Disco.exe"(por omissão em c:\Program Files\Microsoft Visual Studio 8\SDK\v2.0\Bin) sobre o asmx copiado no ponto anterior. Serão criados dois ficheiros na mesma pasta onde se encontra a tool Disco (exemplo ws.disco e ws.wsdl)
    Por exemplo "disco http://localhost:2214/_vti_bin/ws.asmx"
  6. Renomear os ficheiros disco e wsdl criados no ponto anterior para "Nome do webservice"disco.aspx e "Nome do webservice"wsdl.aspx
    Por exemplo quando o webservice se chama ws.asmx, terão de se renomear para wsdisco.aspx e wswsdl.aspx
  7. Abrir ficheiro wsdl e executar os seguintes passos:
    1. Substituir directiva xml (<?xml version="1.0" encoding="utf-8"?> ) por
      <%@ Page Language="C#" Inherits="System.Web.UI.Page" %>
      <%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
      <%@ Import Namespace="Microsoft.SharePoint.Utilities" %>
      <%@ Import Namespace="Microsoft.SharePoint" %>
      <% Response.ContentType = "text/xml"; %>
    2. Onde está soap address, colocar a instrução seguinte
      <soap:address location=<% SPEncode.WriteHtmlEncodeWithQuote(Response, SPWeb.OriginalBaseUrl(Request), '"'); %> />

  8. Abrir ficheiro disco e executar o seguinte passo:
    1. Substituir directiva xml (<?xml version="1.0" encoding="utf-8"?> ) por
      <%@ Page Language="C#" Inherits="System.Web.UI.Page"    %>
      <%@ Assembly Name="Microsoft.SharePoint, Version=12.0.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c" %>
      <%@ Import Namespace="Microsoft.SharePoint.Utilities" %>
      <%@ Import Namespace="Microsoft.SharePoint" %>
      <% Response.ContentType = "text/xml"; %>

  9. Colocar o ficheiro disco e wsdl na mesma pasta do asmx (ponto 4)
  10. Na virtual directory _vti_bin da web do sharepoint (por omissão C:\Program Files\Common Files\Microsoft Shared\Web Server Extensions\12\isapi) no ficheiro spdisco.aspx acrescentar o seguinte
    <contractRef  ref=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(spWeb.Url + "/_vti_bin/ws.asmx?wsdl"),Response.Output); %> docRef=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(spWeb.Url + "/_vti_bin/ws.asmx"),Response.Output); %> xmlns="http://schemas.xmlsoap.org/disco/scl/" />
    <discoveryRef ref=<% SPHttpUtility.AddQuote(SPHttpUtility.HtmlEncode(spWeb.Url + "/_vti_bin/ws.asmx?disco"),Response.Output); %> xmlns="http://schemas.xmlsoap.org/disco/" />
    Nota, o que está a bold, substituir pelo nome do webservice
  11. No projecto cliente, quando se faz a referencia para o webservice, deve-se colocar ?wsdl após o mesmo. Após a criação do proxy, deve-se verificar se o caminho para o webservice não conter o “?wsdl”

Para mais informações ir a Walkthrough: Creating a Custom Web Service.

Posted by tpo | 0 Comments
Filed under:

Terminar orquestrações suspensas usando WMI

Quem está farto de usar o Hat para terminar orquestrações suspensas, poderá usar um script WMI da seguinte forma:

query = "SELECT * FROM MSBTS_ServiceInstance where ServiceClass = 1 and ServiceInstanceStatus = 32
Set instSet = GetObject("Winmgmts:!root\MicrosoftBizTalkServer").ExecQuery(Query)  
For Each inst In instSet
    inst.Terminate 
Next

ServiceInstanceStatus
1-"Ready to run", 2 -"Active", 4 - "Suspended (resumable)", 8 - "Dehydrated", 16 - "Completed with discarded messages", 32 - "Suspended (not resumable)", 64 - "In breakpoint"

Caso se pretenda suspender um determinado tipo de orquestração, poderá usar-se a seguinte query:

SELECT * FROM MSBTS_ServiceInstance where ServiceClass = 1 and ServiceInstanceStatus = 32 and AssemblyName='NOME DA ASSEMBLY'

Se se pretender algo mais especifico o schema do wmi para o bizatlk encontra-se em BTSWMISchema.mof na mesma pasta onde foi instalado o biztalk.

Posted by tpo | 0 Comments
Filed under:

Publicação de vários tipos de mensagens para o Biztalk por Web Service

A publicação de mensagens de diversos schemas para o Biztalk, envolve um conjunto de questões.

Normalmente segue-se a abordagem de criar Web Services com os Schemas das mensagens usando o “Web Service Publishing Wizard”. Essa abordagem deve ser logo posta de parte, pois devido a um elevado número de tipos de mensagens, faz com que a criação de um Webservice por tipo de schema se torne impraticável.  

Assim colocam-se dois problemas:

  1. Como criar um webservice genérico para publicar qualquer tipo de mensagem.
  2. Como fazer o “cast” da mensagem genérica para o tipo de mensagem propriamente dita, para poder ser consumida pelo subscritor respectivo.

 Para criar um Web Service genérico, para qualquer tipo de mensagem:

  1. Executar o “Web Service Publishing Wizard”
  2. Seleccionar “Publish Schema as A Web Service”
  3. Remover “WebService1”
  4. Com o botão direito do rato, seleccionar “Add Web Service”
  5. Com o botão direito do rato, seleccionar WebService1 e seleccionar “web method, One-Way”
  6. Com o botão direito do rato, seleccionar o parametro “Request” e “Schema Type”
  7. Seleccionar qualquer dll com um schema (pode ser qualquer schema)
  8. Seleccionar “Next”
  9. Seleccionar “Create Biztalk Receive Locations”
  10. Seleccionar “Next”
  11. Seleccionar “Create”
  12. O Web Service é criado

O Wizard cria um Webservice para o Schema especificado, no próximo passo, irá alterar-se o mesmo para receber um tipo de mensagem genérico.

Editar o Web Service

  1. Abrir o Web Service criado
  2. Editar a assinatura do mesmo para parecer da seguinte forma: public void WebMethod1(System.Xml.XmlDocument part)
  3. Procurar pela linha que tem a criação da variável inParamInfos e alterar o typeof para System.Xml.XmlDocument.
    Nota: Caso se tenha alterado o nome do parâmetro de entrada, também terá de se alterar o nome do mesmo após a instrução typeof
  4. Alterar a variável bodyTypeAssemblyQualifiedName para string.empty
  5. Apagar os ficheiros DataTypes.cs e WsdlExtension.cs
  6. Compilar, invocar com um xml exemplo e verificar se a mensagem entra na MessageBox

Principal fonte http://geekswithblogs.com/sthomas/

Após o primeiro problema resolvido, resta-nos criar um processo de fazer "cast" das mensagens publicadas para um tipo conhecido, para facilitar o processo de subscrição.

A ideia partiu do meu colega João Martins (Jota), para tal só terá de se criar uma pipeline de receive, colocar na mesma uma Componente “Xml disassembler” e nas propriedades da mesma em “Document Schemas” colocar todos os Schemas de todos os tipos de mensagens que irão ser publicadas por este Web Service.

Nota: para evitar a publicação de tipos de mensagens não desejados, poderá também colocar-se a propriedade “Allow unrecognized message” a “false”.

Após a configuração e deploy da pipeline, só terá de se colocar o receive location do WebService a usar esta pipeline.

Após a implementação anterior, temos um Webservice que suporta a publicação de N tipos de mensagens.

Posted by tpo | 0 Comments
Filed under: