1

ある実装の WSDL ドキュメントをいじる必要があり、Scalaxb に出会いました! 私は今、私が持っている WSDL ファイルからいくつかのスカラ クラスを生成しようとしていますが、予想通り、いくつかの問題にぶつかっています。

WSDL ファイルのスニペットを次に示します。

<?xml version="1.0" encoding="UTF-8" ?>
<wsdl:definitions
 xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
 xmlns:tns="http://www.myservice.com/MyServices/2012/06/18/"
 xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
 xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
 xmlns:s="http://www.w3.org/2001/XMLSchema"
 name="MyServices"
 targetNamespace="http://www.myservice.com/MyServices/2012/06/18/">
<wsdl:types>
 <s:schema elementFormDefault="qualified" targetNamespace="http://www.myservice.com/MyServices/2012/06/18/">
  <s:complexType name="UserCredentials">
   <s:sequence>
    <s:element name="UserName" type="s:string" />
    <s:element name="Password" type="s:string" />
   </s:sequence>
  </s:complexType>
  <s:element name="UserCredentials" type="tns:UserCredentials" />
  <s:complexType name="AnotherComplexType" >
   <s:sequence>
    <s:element name="Index" type="s:int" />
    <s:element name="Name" type="s:string" />
    <s:element name="Status" type="s:boolean" />
   </s:sequence>
  </s:complexType>
  ....

WSDL ファイルの残りの部分はまったく問題ないと仮定して、プロジェクトをコンパイルしようとしたときに、次のエラーが発生しました。

[error] /Users/joe/Desktop/scalaxb-soap-example/target/scala-2.11/src_managed/main/sbt-scalaxb/myservice/xmlprotocol.scala:1542: not found: value userCredentials
[error]             scalaxb.toXML(userCredentials, Some("http://www.myservice.com/MyServices/2012/06/18/"), "UserCredentials", defaultScope), defaultScope, baseAddress, "POST", Some(new java.net.URI("http://1.1.1.1/cgi-bin/cgi.cgi?WebService=SetGPTimerChannel"))).transform({ case (header, body) => 
[error]                           ^
[error] /Users/joe/Desktop/scalaxb-soap-example/target/scala-2.11/src_managed/main/sbt-scalaxb/myservice/xmlprotocol.scala:1544: value toSeq is not a member of Any
[error]               scala.xml.Elem(null, "Body", scala.xml.Null, defaultScope, true, body.toSeq: _*)
[error]                                                                                     ^
[error] /Users/joe/Desktop/scalaxb-soap-example/target/scala-2.11/src_managed/main/sbt-scalaxb/myservice/xmlprotocol.scala:1551: not found: value userCredentials
[error]             scalaxb.toXML(userCredentials, Some("http://www.myservice.com/MyServices/2012/06/18/"), "UserCredentials", defaultScope), defaultScope, baseAddress, "POST", Some(new java.net.URI("http://1.1.1.1/cgi-bin/cgi.cgi?WebService=SomeServiceCall"))).transform({ case (header, body) => 
[error]                           ^
[error] /Users/joe/Desktop/scalaxb-soap-example/target/scala-2.11/src_managed/main/sbt-scalaxb/myservice/xmlprotocol.scala:1553: value toSeq is not a member of Any
[error]               scala.xml.Elem(null, "Body", scala.xml.Null, defaultScope, true, body.toSeq: _*)
[error]                                                                                     ^

この問題に直面している理由と理由は何ですか? これが私のbuild.sbtです:

import ScalaxbKeys._

val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "1.0.2"
val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.1"
val dispatchV = "0.11.1" // change this to appropriate dispatch version
val dispatch = "net.databinder.dispatch" %% "dispatch-core" % dispatchV

organization := "com.eon"

name := "scalaxb-myservice-sample"

scalaVersion := "2.11.6"

scalaxbSettings

packageName in (Compile, scalaxb) := "rdmservice"

dispatchVersion in (Compile, scalaxb) := dispatchV

async in (Compile, scalaxb) := true

sourceGenerators in Compile <+= scalaxb in Compile

libraryDependencies ++= Seq(scalaXml, scalaParser, dispatch)
4

1 に答える 1