我已经使用 wsimport.exe 为肥皂客户端生成了类。
我的请求应该看起来像
POST /posaservice/servicemanager.asmx HTTP/1.1
Host: ****
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://www.pininteract.com/BalanceInquiry"
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Header>
<AuthenticationHeader xmlns="http://www.pininteract.com">
<userId>VALUE</userId>
<password>VALUE</password>
</AuthenticationHeader>
</soap:Header>
<soap:Body>
<BalanceInquiry xmlns="http://www.pininteract.com" />
</soap:Body>
</soap:Envelope>
但我不知道如何将参数传递给 Authentication Header 部分。目前我的代码看起来像
val client = new ServiceManager().getServiceManagerSoap()
var res = client.balanceInquiry()
println(res)
我生成了其他类 AuthenticationHeader ,但我不知道如何使用它。