Home Page › Forums › BizTalk 2004 – BizTalk 2010 › Difficulty consuming WCF Service in Biztalk using a generic service contract
- This topic has 1 reply, 1 voice, and was last updated 9 years, 1 month ago by
community-content.
-
AuthorPosts
-
-
March 3, 2009 at 2:23 AM #21810
Hi Everyone
I have created a custom WCF service using the IReplyChannel message exchange pattern, to allow clients talking a proprietory binary protocol to ultimately inject messages into a biztalk orchestraction. I can successfully host my service inside a unit test, which also implements my service contract so that I can test the full loop. Everything works fine.
I am using a generic service contract as follows:
[ServiceContract]
public interface ISynapseInboundContract
{
[OperationContract(Action=”*”, IsOneWay=false, ReplyAction=”*”)]
Message ProcessRequest(Message request);
}I am serializing a type, representing the proprietary request, and embedding it inside the body of the incoming request, as follows:
Message requestMessage = Message.CreateMessage(this.MessageVersion, “*”, requestObject);I have enabled a metadata exchange point as follows:
<?xml version=”1.0″ encoding=”utf-8″ ?>
<configuration>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name=”MEX”>
<serviceMetadata httpGetEnabled=”true” httpGetUrl=”http://127.0.0.1:8003/SynapseInboundService”/>
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service name=”Extensibility.SynapseInboundService” behaviorConfiguration=”MEX”>
<host>
<baseAddresses>
<add baseAddress=”http://127.0.0.1:8003/SynapseInboundService”/>
<add baseAddress=”synapse.tcp://127.0.0.1:30566″/>
</baseAddresses>
</host>
<endpoint name=”ep1″
address=”Endpoint”
binding=”customBinding”
bindingConfiguration=”SynapseInboundBinding”
contract=”Extensibility.ISynapseInboundContract” />
<endpoint name=”ep2″
address=”mex”
binding=”mexHttpBinding”
bindingConfiguration=””
contract=”IMetadataExchange”/>
</service>
</services>
<bindings>
<customBinding>
<binding name=”SynapseInboundBinding”>
<synapseMessageEncoderElement/>
<synapseInboundTransportElement/>
</binding>
</customBinding>
</bindings>
<extensions>
<bindingElementExtensions>
<add name=”synapseMessageEncoderElement” type=”Extensibility.SynapseMessageEncoderBindingElementExtension, SynapseMessageEncoderBindingElement”/>
<add name=”synapseInboundTransportElement” type=”Extensibility.SynapseTransportBindingElementExtension, SynapseTransportBindingElement”/>
</bindingElementExtensions>
</extensions>
</system.serviceModel>
</configuration>When i run/host this service and try and consume if from a biztalk project via Add->Add Generated Items, using the mex endpoint specified above, the wizard completes successfully but the only files that get generated are some *bindinginfo.xml files and an orchestration file. I don’t see any xsd files. I can see that a port type has been added for my service contract ISynapseInboundContract, but it is only one-way despite the fact that my operation returns a response.
In short, I cannot add a port to my orchestration that supports my very simple service contract. I was thinking that maybe the System.ServiceModel.Channels.Message type needs to be decorated with the DataContract attributes so that an xsd is genererated and I can select a message type, when configuring the receive port. I tried choosing System.ServiceModel.Channels.Message as the message type and got an error when I tried to build saying that this type “must be Xml serializable to be a message part type.”
My wsdl, when I point my browser at my MEP, is:
<wsdl:definitions name=”SynapseInboundService” targetNamespace=”http://tempuri.org/”>
<wsdl:import namespace=”http://www.microsoft.com/biztalk/2006/r2/wcf-adapter” location=”http://127.0.0.1:8003/SynapseInboundService?wsdl=wsdl0″/>
<wsdl:types/>
<wsdl:binding name=”ep1″ type=”i0:ISynapseInboundContract”/>
<wsdl:service name=”SynapseInboundService”>
<wsdl:port name=”ep1″ binding=”tns:ep1″>
<soap12:address location=”synapse.tcp://127.0.0.1:30566/Endpoint”/>
</wsdl:port>
</wsdl:service>
</wsdl:definitions>There is a complete absence of wsdl:types which doesn’t seem right.
Anyway, I would really appreciate any help that can be offered. I am new to WCF and Biztalk, so apologies if some of what I’ve mentioned doesn’t make sense or is complete nonsense 🙂
Regards
Mark -
March 3, 2009 at 5:26 AM #21814
I have since solved my problem, yay!
The problem is this line in my service contract:
[OperationContract(Name=”SynapseRequestProcessor”, Action=”ProcessSynapseRequest”, IsOneWay=false, ReplyAction=”*”)]
ReplyAction cannot be set to “*” otherwise no operations or type information are generated in the WSDL when you go to http://localhost/Service/?wsdl
Not sure why this is the case, would be nice to know if anyone knows why?
-
-
AuthorPosts
- The forum ‘BizTalk 2004 – BizTalk 2010’ is closed to new topics and replies.