简体   繁体   English

使用WCF根据行业标准实施服务?

[英]Use WCF to implement services according to industry standard?

I am looking for a proper framework to implement the (web)service tier in .NET. 我正在寻找一个合适的框架来实现.NET中的(web)服务层。 I am a little bit familiar with WCF and wondering, if it can be customized the way I want it. 我对WCF有点熟悉,并且想知道是否可以按照我想要的方式对其进行自定义。

1)There is an industry standard for messages to be sent/recieved by the system, which defines the operations, types used, etc. It is XML based. 1)有一个用于系统发送/接收消息的行业标准,该标准定义了操作,使用的类型等。它基于XML。 It requires all requests/responses to be wrapped in an envelope, eg: 它要求将所有请求/响应包装在一个信封中,例如:

<xxx:Message>
  <xxx:Header>
    //some header data
  </xxx:Header>
  <xxx:Body>
    <xxx:Command>
      //request data
    </xxx:Command>
    <xxx:Command>
      //request data
    </xxx:Command>
  <xxx:Body>
</xxx:Message> 

The xxx:Command element actually identifies the operation to be performed and parameters, or contains the command execution result. xxx:Command元素实际上标识要执行的操作和参数,或包含命令执行结果。
The WCF wraps everything to SOAP envelope. WCF将所有内容包装到SOAP信封中。 Can it be customized to send all requests using the envelope in the sample above, instead of SOAP? 是否可以自定义为使用上面的示例中的信封而不是SOAP发送所有请求? How should I code my services, so that all outgoing and incoming messages are parsed correctly. 我应该如何编码我的服务,以便正确解析所有传出和传入的消息。 Should I look to [MessageContract] or [DataContract] attributes or both? 我应该查看[MessageContract][DataContract]属性还是同时使用这两个属性?

2)One-way operations. 2)单向操作。 The industry standard states that the services should respond with the "acknowledgment" message, that the request has been received. 行业标准指出,服务应以“确认”消息作为响应,表明已收到请求。 I was looking at the one-way operations, that implement the similar approach - they notify the client as soon as the message is received by the server. 我正在研究实现类似方法的单向操作-它们在服务器接收到消息后立即通知客户端。 I am wondering, how can I customize the "acknowledgment" message being sent to conform to the industry standard. 我想知道如何定制发送的“确认”消息以符合行业标准。

If WCF does not allow that, can you forward me to any other possible solution out there - Remoting, maybe some other web-services libraries? 如果WCF不允许这样做,您能否将我转发到其他任何可能的解决方案-远程处理,也许还有其他一些Web服务库?

1) Neither attribute will help you. 1)这两个属性都无法帮助您。 Those attributes are interpreted by the binding (eg, WS-HttpBinding) to determine how to actually create your messages. 这些属性由绑定(例如WS-HttpBinding)解释,以确定如何实际创建您的消息。 You're going to have to write a custom binding to do this, and possibly a custom serializer depending on how "request data" fields are structured. 您将必须编写一个自定义绑定来执行此操作,并且可能要编写一个自定义序列化程序,具体取决于“请求数据”字段的结构。

2) Again, you're going to need to write a custom binding. 2)同样,您将需要编写一个自定义绑定。

A quick search didn't show any existing implementations of a GSA S2S binding for WCF. 快速搜索没有显示WCF的GSA S2S绑定的任何现有实现。

There are existing engines for S2S (for example S2SConnect ). 现有S2S引擎(例如S2SConnect )。 The licensing costs may or may not be worth the time savings from having to develop your own implementation. 由于必须开发自己的实施,许可成本可能值得或不值得节省时间。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM