从ASP.NET MVC项目调用SOAP API

我需要将支付网关(HiPay)集成到使用ASP.NET MVC 5构建的网站中。

我已经到达支持团队。他们告诉我说他们使用SOAP API,并提供了integration example in PHP的说法,即语言并不重要。但是他们没有使用ASP.NET的示例。

我不知道如何在C#中适应PHP代码。我找到了this answer,并尝试使用HiPay提供的地址向我的项目添加服务引用。 但是我得到一个错误:

下载'https://ws.hipay.com/soap/payment-v2?wsdl/_vti_bin/ListData.svc/ $ metadata'时出错。 基础连接已关闭:发送时发生意外错误。 身份验证失败,因为远程方已关闭传输流。 元数据包含无法解析的引用。

我猜错误是由于需要凭据的事实引起的,但是在这种情况下,我不知道如何添加服务引用。

如何将这个PHP集成示例转换为ASP.NET C#?

<?php 
// STEP 1 : soap flow options
$options = array(
'compression' => SOAP_COMPRESSION_accEPT | SOAP_COMPRESSION_GZIP,'cache_wsdl' => WSDL_CACHE_NONE,'soap_version' => SOAP_1_1,'encoding' => 'UTF-8'
);
// STEP 2 : Soap client initialization
$client = new SoapClient('https://ws.hipay.com/soap/payment-v2?wsdl',$options);

// STEP 3 : Soap call on confirm method of manual-capture webservice
$result = $client->generate(array('parameters'=>array(
  'wsLogin' => 'YOUR wsLogin','wsPassword' => 'YOUR wsPassword','categoryId' => 'xxx','websiteId' => 'YOUR websiteID','description' => 'Test HiPay','currency' => 'EUR','amount' => '','rating' => '','locale' => 'fr_FR','customerIpAddress' => '','manualCapture' => '0','executionDate' => '','customerEmail' => '','urlCallback' => '','urlaccept' => '','urlDecline' => '','urlCancel' => '','urlLogo'=> '','merchantReference' => 'test-123'
)));

// STEP 4 : Response
echo $_POST['redirectUrl'];
$url = $result->generateResult->redirectUrl;
echo $url;
?>

任何帮助将不胜感激。

zlm1zlm3zlm5 回答:从ASP.NET MVC项目调用SOAP API

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3116947.html

大家都在问