You are viewing a plain text version of this content. The canonical link for it is here.
Posted to stonehenge-commits@incubator.apache.org by be...@apache.org on 2009/09/22 03:01:20 UTC
svn commit: r817484 -
/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceContract/ITradeServiceFacadeWcf.cs
Author: bendewey
Date: Tue Sep 22 03:01:20 2009
New Revision: 817484
URL: http://svn.apache.org/viewvc?rev=817484&view=rev
Log:
Removed the unnecessary DispatchByBodyElementOperationSelector attribute from the dotnet business service contract.
Modified:
incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceContract/ITradeServiceFacadeWcf.cs
Modified: incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceContract/ITradeServiceFacadeWcf.cs
URL: http://svn.apache.org/viewvc/incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceContract/ITradeServiceFacadeWcf.cs?rev=817484&r1=817483&r2=817484&view=diff
==============================================================================
--- incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceContract/ITradeServiceFacadeWcf.cs (original)
+++ incubator/stonehenge/trunk/stocktrader/dotnet/business_service/BusinessServiceContract/ITradeServiceFacadeWcf.cs Tue Sep 22 03:01:20 2009
@@ -43,8 +43,8 @@
// But the business services are 'independent' of this client application--and can be accessed, for instance,
// by other clients and potentially other organizaitons (for example, the Trade 6.1 JSP Web Application).
// Suffice it to say that this facade for now is (possibly) suitable for deployment on the intranet, but not on
-/// the Internet. Web Service security and security in general are deep topics.
-/// Two good starting Web Service security resources can be found at:
+// the Internet. Web Service security and security in general are deep topics.
+// Two good starting Web Service security resources can be found at:
// http://msdn2.microsoft.com/en-us/library/ms732008.aspx
@@ -92,111 +92,11 @@
//AccessMode=WebSphere_WebService setting in Web.Config after setting the correct endpoint to
//your WebSphere server running Trade 6.1 in the same config file.
-
- /// <summary>
- /// This class is included for seamless interoperability with the existing WebSphere SOAP proxy for IBM WebSphere
- /// Trade 6.1. The IBM WebSphere SOAP Proxy uses method name in body, vs. method name in SOAP Action Header. This code
- /// will properly dispatch methods based on an empty SOAP Action, instead routing based on the method name in the
- /// XML body.
- /// </summary>
- class DispatchByBodyElementOperationSelector : IDispatchOperationSelector
- {
- #region IDispatchOperationSelector Members
- Dictionary<XmlQualifiedName, string> dispatchDictionary;
-
- public DispatchByBodyElementOperationSelector(Dictionary<XmlQualifiedName, string> dispatchDictionary)
- {
- this.dispatchDictionary = dispatchDictionary;
- }
-
-
-
- private Message CreateMessageCopy(Message message, XmlDictionaryReader body)
- {
- Message copy = Message.CreateMessage(message.Version, message.Headers.Action, body);
- copy.Headers.CopyHeaderFrom(message, 0);
- copy.Properties.CopyProperties(message.Properties);
- return copy;
- }
-
- public string SelectOperation(ref System.ServiceModel.Channels.Message message)
- {
- XmlDictionaryReader bodyReader = message.GetReaderAtBodyContents();
-
- XmlQualifiedName lookupQName = new XmlQualifiedName(bodyReader.LocalName, bodyReader.NamespaceURI);
- message = CreateMessageCopy(message, bodyReader);
- if (dispatchDictionary.ContainsKey(lookupQName))
- {
- return dispatchDictionary[lookupQName];
- }
- else
- {
- return null;
- }
- }
-
- #endregion
- }
-
- /// <summary>
- /// This class is included for seamless interoperability with the existing WebSphere SOAP proxy for IBM WebSphere
- /// Trade 6.1. The IBM WebSphere SOAP Proxy uses method name in body, vs. method name in SOAP Action Header. This code
- /// will properly dispatch methods based on an empty SOAP Action, instead routing based on the method name in the
- /// XML body.
- /// </summary>
- [AttributeUsage(AttributeTargets.Class | AttributeTargets.Interface)]
- sealed class DispatchByBodyBehaviorAttribute : Attribute, IContractBehavior
- {
- #region IContractBehavior Members
-
- public void AddBindingParameters(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Channels.BindingParameterCollection bindingParameters)
- {
- // no binding parameters need to be set here
- return;
- }
-
- public void ApplyClientBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.ClientRuntime clientRuntime)
- {
- // this is a dispatch-side behavior which doesn't require
- // any action on the client
- return;
- }
-
- public void ApplyDispatchBehavior(ContractDescription contractDescription, ServiceEndpoint endpoint, System.ServiceModel.Dispatcher.DispatchRuntime dispatchRuntime)
- {
- // We iterate over the operation descriptions in the contract and
- // record the QName of the request body child element and corresponding operation name
- // to the dictionary to be used for dispatch
- Dictionary<XmlQualifiedName, string> dispatchDictionary = new Dictionary<XmlQualifiedName, string>();
- foreach (OperationDescription operationDescription in contractDescription.Operations)
- {
- XmlQualifiedName qname =
- new XmlQualifiedName(operationDescription.Messages[0].Body.WrapperName, operationDescription.Messages[0].Body.WrapperNamespace);
-
- dispatchDictionary.Add(qname, operationDescription.Name);
- }
-
- // Lastly, we create and assign an instance of our operation selector that
- // gets the dispatch dictionary we've just created, unless the encoding is Binary over TCP (not XML).
- if (endpoint.Binding.Scheme=="net.tcp")
- return;
- dispatchRuntime.OperationSelector =
- new DispatchByBodyElementOperationSelector(dispatchDictionary);
- }
-
- public void Validate(ContractDescription contractDescription, ServiceEndpoint endpoint)
- {
- //
- }
- #endregion
- }
-
/// <summary>
/// This is the service contract for Trade Business Services. It defines the business service layer operations
/// that are separately implemented in an implementation class.
/// </summary>
[ServiceContract(Namespace = "http://trade.samples.websphere.ibm.com")]
- [DispatchByBodyBehavior]
public interface ITradeServices
{
[OperationContract(Action = "")]