在对Azure Azure WCF服务的POST请求中阻止了查询字符串

时间:2014-05-21 11:20:10

标签: wcf rest azure cloud

我在Azure云中发布的WCF REST服务有问题:服务收到了调用但缺少整个查询字符串,POST网址中包含的所有参数都是空的。

以下是为服务定义的合约

    <ServiceContract()>
Public Interface IRestServiceImpl

    <OperationContract>
    <WebInvoke(Method:="POST",
                BodyStyle:=WebMessageBodyStyle.Bare,
               ResponseFormat:=WebMessageFormat.Json,
               RequestFormat:=WebMessageFormat.Json,
            UriTemplate:="sendNotification?reason={reason}&eventDate={eventDate}&originalReference={originalReference}&merchantReference={merchantReference}&" & _
                "currency={currency}&pspReference={pspReference}&merchantAccountCode={merchantAccountCode}&eventCode={eventCode}&" & _
                "value={value}&operations={operations}&success={success}&paymentMethod={paymentMethod}&live={live}")>
    Function sendNotification(eventDate As String, reason As String, originalReference As String, merchantReference As String,
                         currency As String, pspReference As String, merchantAccountCode As String, eventCode As String,
                         value As String, operations As String, success As String, paymentMethod As String, live As String) As String

End Interface 

服务中的实施功能

    Public Function sendNotification(eventDate As String, reason As String, originalReference As String, merchantReference As String, currency As String, pspReference As String, merchantAccountCode As String, eventCode As String, value As String, operations As String, success As String, paymentMethod As String, live As String) As String Implements Common.IRestServiceImpl.sendNotification

    Return "Got iT!"

End Function

以下是webrole

的相关配置部分
    <serviceHostingEnvironment aspNetCompatibilityEnabled="true" multipleSiteBindingsEnabled="true" />
<services>
  <service name = "PaymentServiceWebRole.AdyenNotificationService" 
           behaviorConfiguration = "myServiceBehavior" >
    <endpoint name="webHttpBinding"
              address="" 
              binding="webHttpBinding"
              contract="TripRebelCommon.ServiceContracts.IRestServiceImpl"
              behaviorConfiguration="webHttp"
              >
    </endpoint>
  </service>

用于发布数据的网址:

的http:// * .cloudapp.net / MyService.svc / sendNotification的pspReference = 8814002409046667&安培; EVENTDATE = 2014-05-16T11:48:28.01Z&安培; merchantAccountCode = TriprebelCOM&安培;原因= 36069:1111:二千〇一十六分之六&安培; originalReference =安培;值= 10&安培; EVENTCODE = AUTHORIZATION&安培; merchantReference = 33&安培;操作= CANCEL,CAPTURE,退款&安培;成功=真安培; PAYMENTMETHOD = MC&安培;货币= EUR&安培;活=假

所以,问题是当外部服务进行测试时,我只收到 &#34; /MyService.svc/sendNotification"

根本没有包含QUeryString。我使用Fiddler从我的本地PC到云服务进行相同的调用 - 一切正常,我收到日期并处理它。

最糟糕的是 - 一周前我做了第一次测试,现在这让我疯了,因为我在这里看不到任何明显的问题,但我必须错过一些制动它的小东西。 / p>

感谢您解决问题的任何帮助。

1 个答案:

答案 0 :(得分:0)

我自己能够解决这个问题。

对任何会遇到同样问题的人:

基本上我一直在尝试实施Adyen支付提供商解决方案。问题在于他们发送数据的方式 - 技术支持说它在U​​RL中就像原始帖子状态一样,但实际上是参数字符串 pspReference = 8814002409046667&安培; EVENTDATE = 2014-05-16T11:48:28.01Z&安培; merchantAccountCode = TriprebelCOM&安培;原因= 36069:1111:二千〇一十六分之六&安培; originalReference =安培;值= 10&安培; EVENTCODE = AUTHORIZATION&安培; merchantReference = 33&安培;操作= CANCEL ,捕捉,退款&安培;成功=真安培; PAYMENTMETHOD = MC&安培;货币= EUR&安培;活=假

正在请求BODY中发送,为了正确处理它,接收函数的唯一输入参数必须是STREAM,它将包含上面提到的字符串。