我尝试使用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模式
谢谢。
最佳答案
如果不需要cookie来进行WS身份验证(并且它们不应该:-)),那么groovy-wslite是一个不错的库,可用于创建SOAP请求。
另一种方法是使用HTTPBuilder,它允许您创建游览确切的请求并在需要时处理cookie(您可以使用wslite进行此操作,但需要做更多的工作)
关于web-services - 带有Grails的SOAP客户端请求,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11362990/