eed3si9n on master
Trim most XSD types that have w… Merge pull request #556 from jy… (compare)
eed3si9n on master
Trim most XSD types that have w… Merge pull request #556 from jy… (compare)
Lens[A, Items]
``` case class Bank(BICFI: Option[String] = None,
Name: Option[String] = None,
PstlAdr: Option[common.PostalAddress] = None)
case class PostalAddress(AdrTp: Option[AddressType2Code] = None,
StrtNm: Option[String] = None,
BldgNb: Option[String] = None,
PstCd: Option[String] = None,
TwnNm: Option[String] = None)
```
I can get Bank.PstlAdr, but go no further not sure if I can compose a Lens[Bank,Option[PostalAddress] and a Lens[PostalAddress, Option[AddressType2Code] together
scalaxbPackageNames in (Compile, scalaxb) := Map(uri("http://172.17.0.2:8080/castlemock/mock/soap/project/UKt4ew/BookServiceSOAP") -> "com.books")
``` val doc = scalaxb.fromXML[Class.forName("pacs_001_001_02.Document")](xml) ```
What am I doing wrong? I have a couple of properties set in built.sbt, they dont seem to have any effect
scalaxbPrependFamily := true
scalaxbNamedAttributes := true
I am also getting the following warnings, other scalaxb properties like scalaxbProtocolPackageName seem to work fine.
[warn] there are 2 keys that are not used by any other settings/tasks:
[warn]
[warn] * root / scalaxbNamedAttributes
[warn] +- /Users/deenar/dev/isotoolkit/build.sbt:94
[warn] * root / scalaxbPrependFamily
[warn] +- /Users/deenar/dev/isotoolkit/build.sbt:99
[warn]
hi! I've seen that on XMLProtocol, targetNamespace is generated as a None defaultScope. In my case, this hampers that a request has been well built.
Let's me explain this with an example. Having this wsdl:
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
xmlns:tns="http://myservice.com/service/login"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/"
xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
targetNamespace="http://myservice.com/service/login"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified" targetNamespace="http://myservice.com/service/login">
<s:element name="getAuth">
<s:complexType>
<s:sequence>
<s:element minOccurs="1" maxOccurs="1" form="unqualified" name="user" type="s:string" />
<s:element minOccurs="1" maxOccurs="1" form="unqualified" name="password" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
.
.
.
what I get as a request for getAuth
is:
<soap11:Envelope
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://myservice.com/service/login"
xmlns="http://myservice.com/service/login">
<soap11:Body>
<getAuth>
<user>user</user>
<password>password</password>
</getAuth>
</soap11:Body>
</soap11:Envelope>
and because <getAuth>
doesn't have tns
we get:
System.Web.Services.Protocols.SoapException: The element 'getAuth' in namespace 'http://myservice.com/service/login' has invalid child element 'user' in namespace 'http://myservice.com/service/login'. List of possible elements expected: 'user'.
I've realized that removing None -> "http://myservice.com/service/login"
from defaultScope
trait XMLProtocol extends scalaxb.XMLStandardTypes {
val defaultScope = scalaxb.toScope(None -> "http://myservice.com/service/login",
Some("tns") -> "http://myservice.com/service/login",
Some("xs") -> "http://www.w3.org/2001/XMLSchema",
Some("xsi") -> "http://www.w3.org/2001/XMLSchema-instance")
...
this is solved and the request is well built:
<soap11:Envelope
xmlns:soap11="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:tns="http://myservice.com/service/login">
<soap11:Body>
<tns:getAuth>
<user>user</user>
<password>password</password>
</tns:getAuth>
</soap11:Body>
</soap11:Envelope>
So, my question is, how can I fix this?
We use sbt-scalaxb 1.8.0, scala 2.13.4 and this is part of my build.sbt
lazy val scalaXml = "org.scala-lang.modules" %% "scala-xml" % "2.0.0-M2"
lazy val scalaParser = "org.scala-lang.modules" %% "scala-parser-combinators" % "1.1.2"
lazy val dispatch = "org.dispatchhttp" %% "dispatch-core" % "1.1.3"
...
.enablePlugins(ScalaxbPlugin)
.settings(
scalacOptions ++= Seq("-Wconf:src=src_managed/.*:silent"),
sourceGenerators in Compile += (scalaxb in Compile).taskValue,
scalaxbPackageName in (Compile, scalaxb) := "generated",
scalaxbDispatchVersion in (Compile, scalaxb) := "1.1.3"
)
Please, let me know if I need to report something else to clarify this. I hope someone can help me. Thanks :)
<xs:element name="partition" minOccurs="0" maxOccurs="1" type="test_partition_type">
<xs:annotation>
<xs:appinfo>
<jaxb:property>
<jaxb:baseType>
<jaxb:javaType name="TestPartitionType" parseMethod="TestPartitionTypeAdapter.decode"
printMethod="TestPartitionTypeAdapter.encode" />
</jaxb:baseType>
</jaxb:property>
</xs:appinfo>
</xs:annotation>
</xs:element>
<xs:element name="partition" minOccurs="0" maxOccurs="1" type="test_partition_type">
<xs:annotation>
<xs:appinfo>
<jaxb:property>
<jaxb:baseType>
<jaxb:javaType name="TestPartitionType" parseMethod="TestPartitionTypeAdapter.decode"
printMethod="TestPartitionTypeAdapter.encode" />
</jaxb:baseType>
</jaxb:property>
</xs:appinfo>
</xs:annotation>
</xs:element>