我尝试使用SOAP for ipayment(德国)创建一个支付系统,并在其文档中描述了使用以下SOAP请求我可能会得到第二个代码示例中显示的响应。
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<capture>
<accountData>
<accountId>99999</accountId>
<trxuserId>99999</trxuserId>
<trxpassword>0</trxpassword>
<adminactionpassword>
5cfgRT34xsdedtFLdfHxj7tfwx24fe</adminactionpassword>
</accountData>
<origTrxNumber>1-25949395</origTrxNumber>
<transactionData>
<trxAmount>119</trxAmount>
<trxCurrency>EUR</trxCurrency>
</transactionData>
</capture>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
来自服务器的示例响应是
<?xml version="1.0" encoding="ISO-8859-1"?>
<SOAP-ENV:Envelope
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:captureResponse
xmlns:ns1="https://ipayment.de/service_v3/binding">
<ipaymentReturn>
<status>SUCCESS</status>
<successDetails>
<retTransDate>25.07.08</retTransDate>
<retTransTime>17:08:08</retTransTime>
<retTrxNumber>1-25949407</retTrxNumber>
<retAuthCode></retAuthCode>
</successDetails>
<addressData>
<addrStreet>Ernst-Frey-Str. 9</addrStreet>
<addrCity>Karlsruhe</addrCity>
<addrZip>76135</addrZip>
<addrCountry>DE</addrCountry>
</addressData>
<addresscheckResult>UNCHECKED</addresscheckResult>
<paymentMethod>VisaCard</paymentMethod>
<trxPaymentDataCountry>US</trxPaymentDataCountry>
</ipaymentReturn>
</ns1:captureResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
但我不知道如何使用grails创建请求。我尝试使用Spring WS插件,但文档中的示例代码根本没用。你知道一些例子或任何想法的来源吗?可以在https://ipayment.de/service/3.0/?wsdl找到WSDL架构 感谢。
答案 0 :(得分:2)
如果不需要cookie来验证WS(并且它们不应该:-)),groovy-wslite是一个很好的库,用于创建SOAP请求。
另一种方法是使用HTTPBuilder,它允许您创建巡回确切请求并在需要时处理cookie(您可以使用wslite执行此操作,但需要更多工作)
答案 1 :(得分:0)
如果你是脚本,可以直接从groovy使用curl(如果你有的话)。它功能强大,易于操作,您可以在单行中完成。
例如: “curl -d \”$ {payload} \“ - H \”Content-Type:text / xml \“$ {wsUrl}”。execute.text 有效负载是请求(包括肥皂信封)。