web services - Experian QAS Soap Request c#
本文关键字:Soap Request QAS Experian services web | 更新日期: 2023-09-27 18:00:34
我需要使用SOAP向Experian服务发出请求。
文档令人震惊,给出的示例代码更糟糕。所以我希望有人能帮忙。
首先,我只想从测试调用中得到一个响应,使用https://ws.ondemand.qas.com/ProOnDemand/V3/ProOnDemandService.asmx?op=DoGetExampleAddresses在那之后,我很确定我能解决这个问题。
有人能帮忙吗?
///Service Reference
Experian.QAS.QAAuthentication authentication = new Experian.QAS.QAAuthentication();
authentication.Username = "username";
authentication.Password = "password";
Experian.QAS.QAQueryHeader header = new Experian.QAS.QAQueryHeader();
header.QAAuthentication = authentication;
Experian.QAS.QAGetExampleAddresses body = new Experian.QAS.QAGetExampleAddresses();
body.Country = "GBR";
body.Layout = "QADefault";
//I think this is the wrong call to post the request
Experian.QAS.DoGetExampleAddressesRequest request = new Experian.QAS.DoGetExampleAddressesRequest(header, body);
代码最后一行的注释是正确的,这是操作的SOAP请求对象,而不是操作本身。
您在示例代码中的某个地方是否有一个继承自SoapHttpClientProtocol
的类(例如,称为QASOnDemandIntermediary
)?
您需要实例化该类的一个实例,将身份验证对象分配给它,然后在客户端上调用执行所需操作的方法,例如:
// Create authentication object
QAAuthentication authentication = new QAAuthentication();
authentication.Username = "MyUserName";
authentication.Password = "MyPassword";
// Create SOAP header and assign authentication parameters to it
QAQueryHeader header = new QAQueryHeader();
header.QAAuthentication = authentication;
// Create service client
QASOnDemandIntermediary client = new QASOnDemandIntermediary();
client.QAQueryHeaderValue = header;
// Create service request
QAGetExampleAddresses request = new QAGetExampleAddresses();
request.Country = "GBR";
request.Layout = "QADefault";
// Call the web service
QAExampleAddress[] result = client.DoGetExampleAddresses(request);
// Use the result
foreach (var example in result)
{
// Use the examples
}
我还没有准备好访问您正在使用的确切示例代码,所以我使用的一些类型名称可能不是100%正确的,但它们应该是相似的。