2013-03-22 165 views
1

誰能幫我說什麼是錯用下面的代碼WCF Web服務

var BasicHttpBinding = require('wcf.js').BasicHttpBinding 
, Proxy = require('wcf.js').Proxy 
, binding = new BasicHttpBinding() 
, proxy = new Proxy(binding,"http://www.restfulwebservices.net/wcf/WeatherForecastService.svc") 
, message = '<Envelope xmlns=' + 
     '"http://schemas.xmlsoap.org/soap/envelope/">' + 
      '<Header />' + 
       '<Body>' + 
       '<GetCitiesByCountry xmlns="http://www.restfulwebservices.net/ServiceContracts/2008/01">' + 
        '<Country>korea</Country>' + 
        '</GetCitiesByCountry>' + 
       '</Body>' + 
      '</Envelope>' 

proxy.send(message, "http://www.restfulwebservices.net/ServiceContracts/2008/01/IWeatherForecastService/GetCitiesByCountry", function(response, ctx) { 
console.log(response) 
}); 

我提示以下錯誤:

<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/"><s:Body><s:Fault> <faultcode xmlns:a="http://schemas.microsoft.com/ws/2005/05/addressing/none">a:ActionNotSupported</faultcode><faultstring xml:lang="en-US">The message with Action 'http://www.restfulwebservices.net/ServiceContracts/2008/01/IWeatherForecastService/GetCitiesByCountry' cannot be processed at the receiver, due to a ContractFilter mismatch at the EndpointDispatcher. This may be because of either a contract mismatch (mismatched Actions between sender and receiver) or a binding/security mismatch between the sender and the receiver. Check that sender and receiver have the same contract and the same binding (including security requirements, e.g. Message, Transport, None).</faultstring></s:Fault></s:Body></s:Envelope> 

任何幫助將是非常有幫助。

謝謝

+0

您需要將生成的soap/headers與您從wcf客戶端獲得的工作請求進行比較 – 2013-07-20 00:12:22

回答

1

Wcf.js只支持soap服務。您無法將Wcf.js用於REST Web服務。

+0

我只想用於soap服務。上面的代碼就是它的一個例子。還是有任何其他的.svc我可以在我的代碼中使用和使用? – user87267867 2013-03-22 09:37:43

+0

而我知道.svc也是一個肥皂服務。 – user87267867 2013-03-22 09:50:29

+0

@Filburt需要上述代碼的幫助。 – user87267867 2013-03-25 03:53:31