Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Transmitting .net class type from one application to WCF service via BizTalk orchestration
- This topic has 7 replies, 1 voice, and was last updated 8 years, 3 months ago by
community-content.
-
AuthorPosts
-
-
January 16, 2009 at 4:10 AM #21514
Hi,
I have got one .net class called StatusMessage. I have two console application, one publisher and other subscriber. Ideally I want to transmit StatusMessage type message from publisher to subscriber using BizTalk orchestration.
subscriber app also hosts WCF service. there can be many instances of subscriber running on different machines across network. orchestration decides based on the content of StatusMessage which subscriber should the message be routed.
What I have done now is, within orchestration I have referenced StatusMessage type and used it as message for both send and receive shapes. my send shape is binded to dynamic send port. I have tried two senarios here. One publishing orchestration as WCF service and other without publishing.
In first senario used svcutil to create BizTalkServiceInstance.cs and app.config file. BizTalkServiceInstance.cs for some reason creates shadow type to represent my StatusMessage type. In my WCF client console application (publisher) I call the orchestration service and send shadow type to biztalk.
Now my subscriber is waiting for biztalk to call its service and transmit StatusMessage type to its method call. For some reason message arrives upto orchestration Send shape but it is not able to transmit message to subscriber because of conflict in type between orchestration message type and subscriber’s StatusMessage type although they are using same type. StatusMessage type is also in GAC.
Please can someone advice what I am doing wrong here? How can I make a .net class transmit from one console application to another console application (hosting WCF service) via biztalk orchestration.
-
January 18, 2009 at 12:06 PM #21521
The types may be different because BizTalk generates a different namespace. Note that within BizTalk the “types” are message types, not .NET class types. If you look at the message types listed in your application, you will be able to see if there are different namespaces. You can create a simple map from the message type that BizTalk recieves to the target message type. Place the map in your send port.
-
January 19, 2009 at 2:50 AM #21524
thanks for your reply. i m new to biztalk and what I have understood till is maps only allows to do message mapping between schema messages.
in this case my message type is .net class, so when trying to view message namespace of the message i created in my biztalk project (of type .net class) it does not allow to.
kindly advice how can I do mapping in that case.
-
January 19, 2009 at 9:51 AM #21527
As you probably know, WCF uses XML and SOAP as the underlying protocol. If you are working directly between two .NET endpoints WCF will hide the XML serialization for you. When BizTalk is used it works directly with the XML payload provided by WCF.
You should learn how to use BizTalk tracking so that you can observe the XML messages.
-
January 21, 2009 at 3:32 AM #21542
The message reaches upto send port in the orchestration however for some reason my dynamic send port in the orchestration cannot figure out WCF contract and complains about contract mismatch. In the Expression shape I provide correct address of the WCF service to the send port.
Do you think the contract mismatch error would be related to message namespace or something else?
-
January 21, 2009 at 5:57 PM #21544
My first guess would be that you have an issue with messagetype and/or namespace. Post the exact error information you are getting and I may be able to provide more insight.
-
January 22, 2009 at 2:33 AM #21546
Now what I have tried is to send simple xml file rather than .net class. I have defined schema for input message as
BODY{font:x-small ‘Verdana’;margin-right:1.5em}
.c{cursor:hand}
.b{color:red;font-family:’Courier New’;font-weight:bold;text-decoration:none}
.e{margin-left:1em;text-indent:-1em;margin-right:1em}
.k{margin-left:1em;text-indent:-1em;margin-right:1em}
.t{color:#990000}
.xt{color:#990099}
.ns{color:red}
.dt{color:green}
.m{color:blue}
.tx{font-weight:bold}
.db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier}
.di{font:small Courier}
.d{color:blue}
.pi{color:blue}
.cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888}
.ci{font:small Courier;color:#888888}
PRE{margin:0px;display:inline}
<!–
function f(e){
if (e.className==”ci”){if (e.children(0).innerText.indexOf(“\n”)>0) fix(e,”cb”);}
if (e.className==”di”){if (e.children(0).innerText.indexOf(“\n”)>0) fix(e,”db”);}
e.id=””;
}
function fix(e,cl){
e.className=cl;
e.style.display=”block”;
j=e.parentElement.children(0);
j.className=”c”;
k=j.children(0);
k.style.visibility=”visible”;
k.href=”#”;
}
function ch(e){
mark=e.children(0).children(0);
if (mark.innerText==”+”){
mark.innerText=”-“;
for (var i=1;i<e.children.length;i++)
e.children(i).style.display=”block”;
}
else if (mark.innerText==”-“){
mark.innerText=”+”;
for (var i=1;i<e.children.length;i++)
e.children(i).style.display=”none”;
}}
function ch2(e){
mark=e.children(0).children(0);
contents=e.children(1);
if (mark.innerText==”+”){
mark.innerText=”-“;
if (contents.className==”db”||contents.className==”cb”)
contents.style.display=”block”;
else contents.style.display=”inline”;
}
else if (mark.innerText==”-“){
mark.innerText=”+”;
contents.style.display=”none”;
}}
function cl(){
e=window.event.srcElement;
if (e.className!=”c”){e=e.parentElement;if (e.className!=”c”){return;}}
e=e.parentElement;
if (e.className==”e”) ch(e);
if (e.className==”k”) ch2(e);
}
function ex(){}
function h(){window.status=” “;}
document.onclick=cl;
–><?xml
version=”1.0″ encoding=”utf-16″ ?>– <xs:schema xmlns:b=”http://schemas.microsoft.com/BizTalk/2003“ xmlns:xs=”http://www.w3.org/2001/XMLSchema“>and Ouput message as
BODY{font:x-small ‘Verdana’;margin-right:1.5em}
.c{cursor:hand}
.b{color:red;font-family:’Courier New’;font-weight:bold;text-decoration:none}
.e{margin-left:1em;text-indent:-1em;margin-right:1em}
.k{margin-left:1em;text-indent:-1em;margin-right:1em}
.t{color:#990000}
.xt{color:#990099}
.ns{color:red}
.dt{color:green}
.m{color:blue}
.tx{font-weight:bold}
.db{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;border-left:1px solid #CCCCCC;font:small Courier}
.di{font:small Courier}
.d{color:blue}
.pi{color:blue}
.cb{text-indent:0px;margin-left:1em;margin-top:0px;margin-bottom:0px;padding-left:.3em;font:small Courier;color:#888888}
.ci{font:small Courier;color:#888888}
PRE{margin:0px;display:inline}
<!–
function f(e){
if (e.className==”ci”){if (e.children(0).innerText.indexOf(“\n”)>0) fix(e,”cb”);}
if (e.className==”di”){if (e.children(0).innerText.indexOf(“\n”)>0) fix(e,”db”);}
e.id=””;
}
function fix(e,cl){
e.className=cl;
e.style.display=”block”;
j=e.parentElement.children(0);
j.className=”c”;
k=j.children(0);
k.style.visibility=”visible”;
k.href=”#”;
}
function ch(e){
mark=e.children(0).children(0);
if (mark.innerText==”+”){
mark.innerText=”-“;
for (var i=1;i<e.children.length;i++)
e.children(i).style.display=”block”;
}
else if (mark.innerText==”-“){
mark.innerText=”+”;
for (var i=1;i<e.children.length;i++)
e.children(i).style.display=”none”;
}}
function ch2(e){
mark=e.children(0).children(0);
contents=e.children(1);
if (mark.innerText==”+”){
mark.innerText=”-“;
if (contents.className==”db”||contents.className==”cb”)
contents.style.display=”block”;
else contents.style.display=”inline”;
}
else if (mark.innerText==”-“){
mark.innerText=”+”;
contents.style.display=”none”;
}}
function cl(){
e=window.event.srcElement;
if (e.className!=”c”){e=e.parentElement;if (e.className!=”c”){return;}}
e=e.parentElement;
if (e.className==”e”) ch(e);
if (e.className==”k”) ch2(e);
}
function ex(){}
function h(){window.status=” “;}
document.onclick=cl;
–><?xml
version=”1.0″ encoding=”utf-16″ ?>– <xs:schema xmlns:b=”http://schemas.microsoft.com/BizTalk/2003“ xmlns=”http://example.org/messenger/IMessageReceiver/ForwardMessage“ targetNamespace=”http://example.org/messenger/IMessageReceiver/ForwardMessage“ xmlns:xs=”http://www.w3.org/2001/XMLSchema“>In the file receive port I send following XML message
<Message>
<Text>Text_0</Text>
<Client>Client_0</Client>
</Message>This what I get
“net.tcp://localhost:8000/SubscriberWCFPort/MessageReceiver”. It will be retransmitted after the retry interval specified for this Send Port. Details:”System.ServiceModel.FaultException:
http://www.w3.org/2005/08/addressing/faulturn:uuid:56fd1f9b-0204-427f-9a09-2036e3777389http://www.w3.org/2005/08/addressing/anonymouss:Sendera:ActionNotSupportedThe message with Action ‘<BtsActionMapping xmlns:xsi=”http://www.w3.org/2001/XMLSchema-instance” xmlns:xsd=”http://www.w3.org/2001/XMLSchema”>
<Operation Name=”ForwardMessage” Action=”http://example.org/messenger/IMessageReceiver/ForwardMessage” />
</BtsActionMapping>’ cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).
at Microsoft.BizTalk.Adapter.Wcf.Runtime.WcfClient`2.RequestCallback(IAsyncResult result)”.My WCF code is as follows
[ServiceContract(Namespace=”http://example.org/messenger”)]
public interface IMessageReceiver
{
[OperationContract]
void ForwardMessage(Message message);
}public class MessageReceiver : IMessageReceiver
{
#region IMessageReceiver Memberspublic void ForwardMessage(Message message)
{
Console.WriteLine(message.Text);
}#endregion
}StatusMessage class is
[DataContract(Namespace=”http://example.org/messenger”)]
public class Message
{
[DataMember]
public string Text { get; set; }
[DataMember]
public string Client { get; set; }
}-
January 23, 2009 at 11:09 AM #21562
I’m assuming you used the WCF Service Consuming Wizard. In that case I would think that the action is correct, but there may be a problem with security. Do you have security configured to “None” on both the security tab of the port configuration and the WCF service?
-
-
-
-
-
-
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.