I am trying to use/consume a web service in Visual Studio 2010. Documentation of API has provided 3 urls:
我试图在Visual Studio 2010中使用/使用Web服务.API的文档提供了3个URL:
- http://testwebpay.interswitchng.com/test_paydirect/services/webpayservice.svc
- http://testwebpay.interswitchng.com/test_paydirect/services/webpayservice.svc
- http://testwebpay.interswitchng.com/test_paydirect/api/v1/gettransaction.xml
- http://testwebpay.interswitchng.com/test_paydirect/api/v1/gettransaction.xml
- http://testwebpay.interswitchng.com/test_paydirect/api/v1/gettransaction.json
- http://testwebpay.interswitchng.com/test_paydirect/api/v1/gettransaction.json
Documentation gives two examples. For json they says sample request to be like:
文档提供了两个示例。对于json,他们说样本请求如下:
Http://testwebpay.interswitchng.com/test_paydirect/api/v1/gettransaction.json?productid=21&transactionreference=8421941122&amount=300000 HTTP/1.1
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.239)
Hash: F6FF2E22F99D93DDDA52D71811FD92B3A71FA1968A66216E0D310DAD
and for XML:
对于XML:
GET Http://testwebpay.interswitchng.com/test_paydirect/api/v1/gettransaction.xml?productid=21&transactionreference=8421941122&amount=300000 HTTP/1.1
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 4.0.30319.239)
Hash: F6FF2E22F99D93DDDA52D71811FD92B3A71FA1968A66216E0D310DAD
Documentation doesn't give example of consuming the .svc
url
文档没有给出使用.svc url的示例
I am trying to use Add -> Webservice Reference
in VS 2010 but I keep getting the following error for the .svc
url (first one in above 3):
我试图在VS 2010中使用添加 - > Web服务参考,但我不断收到.svc网址的错误(上面3中的第一个):
There was an error downloading
https://testwebpay/test\_paydirect/services/WebPAYService.svc?wsdl
.
The remote name could not be resolved: 'testwebpay'
Metadata contains a reference that cannot be resolved:https://testwebpay/test\_paydirect/services/WebPAYService.svc?wsdl
.
There was no endpoint listening athttps://testwebpay/test\_paydirect/services/WebPAYService.svc?wsdl
that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
The remote name could not be resolved: 'testwebpay'下载https:// testwebpay / test \ _paydirect / services / WebPAYService.svc?wsdl时出错。无法解析远程名称:'testwebpay'元数据包含无法解析的引用:https:// testwebpay / test \ _paydirect / services / WebPAYService.svc?wsdl。在https:// testwebpay / test \ _paydirect / services / WebPAYService.svc?wsdl中没有可以接受该消息的端点。这通常是由不正确的地址或SOAP操作引起的。有关更多详细信息,请参阅InnerException(如果存在)。无法解析远程名称:'testwebpay'
Which of the above 3 URLs do I need to use to add service refernce. Is it problem on service end or am I doing something wrong ?
我需要使用以上3个URL中的哪一个来添加服务引用。是服务端问题还是我做错了?
Please suggest
请建议
1 个解决方案
#1
2
This is a rather odd web service....
这是一个相当奇怪的网络服务....
If you go to URL you provided as the first URL:
如果您转到您提供的URL作为第一个URL:
http://testwebpay.interswitchng.com/test_paydirect/services/WebPAYService.svc
you get a "help page" that shows you - yes, indeed, there's a SOAP service living here.
你得到一个显示你的“帮助页面” - 是的,确实,这里有一个SOAP服务。
BUT: the URL for adding the web reference at the top of that page is invalid:
但是:在该页面顶部添加Web引用的URL无效:
https://testwebpay/test_paydirect/services/WebPAYService.svc?wsdl
It's a local web address - missing the domain name .....
这是一个本地网址 - 缺少域名.....
So based on this URL, you really must connect to
所以基于这个URL,你真的必须连接到
https://testwebpay.interswitchng.com/test_paydirect/services/WebPAYService.svc?wsdl
in order to get the SOAP definition for the service (the Web Service Description Language file that describes all the details of this service). Once you connect there, and once you ignore the certificate problems (if you trust that company / service provider), then you get the proper WSDL and you can build your service client.
以获取服务的SOAP定义(描述此服务的所有详细信息的Web服务描述语言文件)。一旦您连接到那里,并且一旦忽略证书问题(如果您信任该公司/服务提供商),那么您将获得正确的WSDL,并且您可以构建您的服务客户端。
Alternatively: go to
或者:去吧
https://testwebpay.interswitchng.com/test_paydirect/services/webpayservice.svc
(your first URL, but with https://
instead of http://
) and you get the proper URL for the WSDL right from the beginning...
(您的第一个URL,但使用https://而不是http://)并且您从一开始就获得了WSDL的正确URL ...
#1
2
This is a rather odd web service....
这是一个相当奇怪的网络服务....
If you go to URL you provided as the first URL:
如果您转到您提供的URL作为第一个URL:
http://testwebpay.interswitchng.com/test_paydirect/services/WebPAYService.svc
you get a "help page" that shows you - yes, indeed, there's a SOAP service living here.
你得到一个显示你的“帮助页面” - 是的,确实,这里有一个SOAP服务。
BUT: the URL for adding the web reference at the top of that page is invalid:
但是:在该页面顶部添加Web引用的URL无效:
https://testwebpay/test_paydirect/services/WebPAYService.svc?wsdl
It's a local web address - missing the domain name .....
这是一个本地网址 - 缺少域名.....
So based on this URL, you really must connect to
所以基于这个URL,你真的必须连接到
https://testwebpay.interswitchng.com/test_paydirect/services/WebPAYService.svc?wsdl
in order to get the SOAP definition for the service (the Web Service Description Language file that describes all the details of this service). Once you connect there, and once you ignore the certificate problems (if you trust that company / service provider), then you get the proper WSDL and you can build your service client.
以获取服务的SOAP定义(描述此服务的所有详细信息的Web服务描述语言文件)。一旦您连接到那里,并且一旦忽略证书问题(如果您信任该公司/服务提供商),那么您将获得正确的WSDL,并且您可以构建您的服务客户端。
Alternatively: go to
或者:去吧
https://testwebpay.interswitchng.com/test_paydirect/services/webpayservice.svc
(your first URL, but with https://
instead of http://
) and you get the proper URL for the WSDL right from the beginning...
(您的第一个URL,但使用https://而不是http://)并且您从一开始就获得了WSDL的正确URL ...