1
客戶端我試圖捕捉到這樣的領域:發送表單參數的Web服務使用Operations
// Initialize the object, before adding data to it.
// { } is declarative shorthand for new Object().
var NewSubscriber = { };
NewSubscriber.FirstName = $("#FirstName").val();
NewSubscriber.LastName = $("#LastName").val();
NewSubscriber.Email = $("#Email").val();
NewSubscriber.subscriptionID = $("#subscriptionID").val();
NewSubscriberNewPerson.Password = "NewPassword1";
NewSubscriber.brokerID = "239432904812";
// Create a data transfer object (DTO) with the proper structure.
var DTO = { 'NewSubscriber' : NewSubscriber };
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: "NewSubscriberService.asmx/AddDigitalSubscriber",
data: JSON.stringify(DTO),
dataType: "json"
});
現在,這裏是我遇到的問題。如果使用C#或vb.net,如何發送這些參數並將其設置爲Web服務?任何幫助是極大的讚賞
這是我到目前爲止有:
public class Service1 : System.Web.Services.WebService
{
public SubNameSpace.WebServiceSubBook.drmProfile _profile;
[WebMethod]
public string SetProfileData (object DTO) {
SetProfile (DTO);
}
[WebMethod]
public class SetProfileData (SubNameSpace.WebServiceSubBook.drmProfile _profile;) {
this._profile = _profile;
return "success";
}
}
}
SetProfile是Web服務中的操作。 SetProfileRequest是操作中的消息。我想設置一些參數,然後在代碼隱藏文件中列出其他參數,如:
access_time = 30;
我完全失去了......幫助!
前端編碼器迷失在C#翻譯
明白了......完全明白,但我沒有把握的部分是,一旦我在:'[的WebMethod] 公共字符串AddDigitalSubscriber(NewSubscriber NewSubscriber) { 串狀態=的String.Empty; // Add Subscriber ... return status; }'我如何將NewSubscriber.Email設置爲web服務中的email參數? –
它也給了我一個警告,說「類型或命名空間名稱'NewSubscriber'找不到... –
@Devise,你看到編輯嗎? – Joe