Scalaxb мыльный клиент терпит неудачу со странным исключением
Я пытаюсь вызвать веб-сервис Web of Science SOAP с помощью scalaxb wsdl следующим образом:
$ sbt new eed3si9n/scalaxb.g8
name [foo-project]: WoSScalaAPI
scala_version [2.12.3]:
scalaxb_version [1.5.2]:
dispatch_version [0.12.0]:
generated_package_name [generated]:
Template applied in ./wosscalaapi
$ cd wosscalaapi
$ rm ./src/main/wsdl/sample.wsdl
$ wget -O ./src/main/wsdl/WOKMWSAuthenticate.wsdl "http://search.webofknowledge.com/esti/wokmws/ws/WOKMWSAuthenticate?wsdl"
$ wget -O ./src/main/wsdl/WokSearchLite.wsdl "http://search.webofknowledge.com/esti/wokmws/ws/WokSearchLite?wsdl"
$ sbt compile
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/WOKMWSAuthenticate_type1.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/WOKMWSAuthenticate.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/WokSearchLite_type1.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/WokSearchLite.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/generated/xmlprotocol.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/scalaxb/scalaxb.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/scalaxb/httpclients_async.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/scalaxb/httpclients_dispatch_async.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/scalaxb/soap11_async.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/soapenvelope11/soapenvelope11.scala.
generated /private/tmp/zz/wosscalaapi/target/scala-2.12/src_managed/main/sbt-scalaxb/soapenvelope11/soapenvelope11_xmlprotocol.scala.
тогда я создаю файл src/main/scala/Test.scala
с этим содержанием:
import generated._
import scala.concurrent._
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
object Test extends App {
val authenticateService =
new WOKMWSAuthenticateServiceSoapBindings with
scalaxb.Soap11ClientsAsync with
scalaxb.DispatchHttpClientsAsync {}
.service
val authenticateFutureResponse: Future[AuthenticateResponse] = authenticateService.authenticate()
val authenticateResponse = Await.result(authenticateFutureResponse, 5 seconds)
println(authenticateResponse)
val searchService =
new WokSearchLiteServiceSoapBindings with
scalaxb.Soap11ClientsAsync with
scalaxb.DispatchHttpClientsAsync {}
.service
val queryParameters = QueryParameters(databaseId = "WOS", userQuery = "DO='10.1126/science.1227970'", queryLanguage = "en")
val retrieveParameters = RetrieveParameters(firstRecord = 1, count = 5, Seq(SortField(name = "RS", sort = "D")))
val searchFutureResponse = searchService.search(queryParameters, retrieveParameters)
println("AAA1")
val searchResponse = Await.result(searchFutureResponse, 5 seconds)
println("AAA2")
println(searchResponse)
}
Это хорошо работает при первом вызове authenticateService.authenticate()
, но это не удается на searchService.search
между печатью AAA1
а также AAA2
, с:
AuthenticateResponse(Some(R15ACHlb2emby3TZZZZ))
AAA1
Exception in thread "main" java.util.NoSuchElementException: head of empty list
at scala.collection.immutable.Nil$.head(List.scala:428)
at scala.collection.immutable.Nil$.head(List.scala:425)
at scalaxb.Soap11Fault.$anonfun$asFault$1(soap11_async.scala:6)
at scala.Option.map(Option.scala:146)
at scalaxb.Soap11Fault.asFault(soap11_async.scala:5)
at generated.XMLProtocol$WokSearchLiteServiceSoapBindings$WokSearchLiteServiceSoapBinding.$anonfun$search$2(xmlprotocol.scala:796)
at scala.concurrent.Future.$anonfun$transform$3(Future.scala:240)
at scala.concurrent.Future.$anonfun$transform$1(Future.scala:240)
at scala.concurrent.impl.Promise.liftedTree1$1(Promise.scala:29)
at scala.concurrent.impl.Promise.$anonfun$transform$1(Promise.scala:29)
at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
at scala.concurrent.impl.ExecutionContextImpl$AdaptedForkJoinTask.exec(ExecutionContextImpl.scala:140)
at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
at java.util.concurrent.ForkJoinPool$WorkQueue.pollAndExecAll(ForkJoinPool.java:1021)
at java.util.concurrent.ForkJoinPool$WorkQueue.execLocalTasks(ForkJoinPool.java:1046)
at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1058)
at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Любая идея?
Это выглядит как scalaxb
ошибка, или ошибка веб-сервера, или ошибка в моем коде?