2014-05-21 66 views
0

我在Azure雲中發佈WCF REST服務時遇到問題:服務收到呼叫,但整個查詢字符串丟失,POST URL中包含的所有參數均爲空。查詢字符串在Azure雲POST請求中被阻止WCF服務

下面是服務

<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 

這裏遵循relewant配置部分各執行功能,對於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 =授權& merchantReference = 33個&操作=取消,捕捉,退款&成功=真& PAYMENTMETHOD = MC &貨幣= EUR &活=假

因此,問題是當外部服務進行測試時,我只收到 「/MyService.svc/sendNotification」

根本沒有包含任何QUERYString。我使用Fiddler從本地PC執行同一個雲服務 - 這一切正常,我收到日期並處理它。

最糟糕的是 - 它已經一個星期前工作時,我做了第一次測試,現在這是推動我堅果,因爲我canno這裏看不到任何明顯的問題,但我必須失去了一些小東西,剎車這一點。

希望在解決這個問題上有任何幫助。

回答

0

我已經能夠自己解決這個問題。

爲了誰的人都會有同樣的問題:

基本上我一直在努力實現Adyen支付服務提供商的解決方案。問題在於他們發送數據的方式 - 技術支持表示它在URL中的原始發佈狀態,但實際上參數字符串爲 pspReference = 8814002409046667 & eventDate = 2014-05-16T11:48:28。01Z & merchantAccountCode = TriprebelCOM &原因= 36069:1111:二千〇一十六分之六& originalReference = &值= 10 & EVENTCODE = AUTHORIZATION & merchantReference = 33 &操作= CANCEL,CAPTURE,退款&成功=真& PAYMENTMETHOD = MC &貨幣= EUR & live = false

正在請求BODY內發送,爲了正確處理它,接收函數的唯一輸入參數必須是STREAM,它將包含上述字符串。