2011-08-18 32 views
1

我正在將CIM整合到MVC3應用程序中。我已經使用了發展網址添加服務引用和編碼如下:MVC3應用程序中的CIM - 如何實例化ServiceSoap?

public long x() 
{ 
    var u = this.User.Identity as IClaimsIdentity; 
    var id = u.Claims.First(x => x.ClaimType == ClaimTypes.NameIdentifier); 

    AuthorizeNet.CustomerProfileType cust = new AuthorizeNet.CustomerProfileType(); 
    cust.merchantCustomerId = id.Value; 

    AuthorizeNet.MerchantAuthenticationType merch = new AuthorizeNet.MerchantAuthenticationType(); 
    merch.name = "8aFRk4663XMd"; 
    merch.transactionKey = "4MS675e62fQEdUXN"; 
    AuthorizeNet.ServiceSoap svc = new AuthorizeNet.ServiceSoap(); 
    AuthorizeNet.CreateCustomerProfileResponseType response = svc.CreateCustomerProfile(
     merch, cust, AuthorizeNet.ValidationModeEnum.none 
    ); 
    return response.customerProfileId; 
} 

但是,當然,這是行不通的,因爲人們不能像實例化一個接口(.ServiceSoap是一個接口)。示例代碼對.Service進行引用 - 但不存在AFAICT。

所以這應該如何工作?

TIA - e!

p.s.我沒有找到an old posting恰恰與我的問題,但很可惜,沒有辦法解決

回答

2

嗯......至少現在的答案似乎是:不產生服務引用Web引用(你可以通過點擊Service Reference對話框的高級按鈕來完成)。

太令人反感了。

+0

我犯了同樣的錯誤。謝謝 – Sev

相關問題