error "unexpected type: XsAnyType" when xs:anyType is in wsdl #88

Closed
radirk opened this Issue Sep 27, 2011 · 6 comments

Comments

Projects
None yet
2 participants
@radirk

radirk commented Sep 27, 2011

With this file

https://gist.github.com/1244388

I get (see https://gist.github.com/1244385 line 162)

java.lang.RuntimeException: unexpected type: XsAnyType

The wsdl appears to be valid. I could generate stubs with soap4r and .net.

Is it a dependency?

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Sep 27, 2011

Owner

It's not deps issue, but I'd have to take a look at what's going on.

Owner

eed3si9n commented Sep 27, 2011

It's not deps issue, but I'd have to take a look at what's going on.

@eed3si9n eed3si9n closed this in 19581e0 Sep 28, 2011

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Sep 28, 2011

Owner

scalaxb wasn't handling xs:anyType appearing in wsdl correctly.

> cs eed3si9n/scalaxb/0.6.5-SNAPSHOT
Owner

eed3si9n commented Sep 28, 2011

scalaxb wasn't handling xs:anyType appearing in wsdl correctly.

> cs eed3si9n/scalaxb/0.6.5-SNAPSHOT
@radirk

This comment has been minimized.

Show comment
Hide comment
@radirk

radirk Oct 8, 2011

I could generate the files from wsdl without problems now. However, when compiling I get errors:

> compile
[info] Compiling 2 Scala sources to /var/scalawork/HotelbedsApi/target/scala-2.9.1/classes...
[error] /var/scalawork/HotelbedsApi/src/main/scala/frontend/xmlprotocol.scala:25: could not find implicit value for evidence parameter of type scalaxb.CanWriteXML[Any]
[error]         soapClient.requestResponse(scalaxb.toXML(scalaxb.DataRecord[Any](part), Some("http://axis.frontend.hydra.hotelbeds.com"), "cancelProtectionAdd", defaultScope), defaultScope, baseAddress, "POST", Some(new java.net.URI(""))) match {
[error]                                                                         ^
[error] /var/scalawork/HotelbedsApi/src/main/scala/frontend/xmlprotocol.scala:26: type mismatch;
[error]  found   : Any
[error]  required: scalaxb.Fault[Any]
[error]           case Left(x)  => Left(x)
[error]                                 ^
[error] /var/scalawork/HotelbedsApi/src/main/scala/frontend/xmlprotocol.scala:27: value head is not a member of Any
[error] Error occurred in an application involving default arguments.
[error]           case Right(x) => Right(scalaxb.fromXML[scalaxb.DataRecord[Any]](x.head))
[error]                                                                             ^

radirk commented Oct 8, 2011

I could generate the files from wsdl without problems now. However, when compiling I get errors:

> compile
[info] Compiling 2 Scala sources to /var/scalawork/HotelbedsApi/target/scala-2.9.1/classes...
[error] /var/scalawork/HotelbedsApi/src/main/scala/frontend/xmlprotocol.scala:25: could not find implicit value for evidence parameter of type scalaxb.CanWriteXML[Any]
[error]         soapClient.requestResponse(scalaxb.toXML(scalaxb.DataRecord[Any](part), Some("http://axis.frontend.hydra.hotelbeds.com"), "cancelProtectionAdd", defaultScope), defaultScope, baseAddress, "POST", Some(new java.net.URI(""))) match {
[error]                                                                         ^
[error] /var/scalawork/HotelbedsApi/src/main/scala/frontend/xmlprotocol.scala:26: type mismatch;
[error]  found   : Any
[error]  required: scalaxb.Fault[Any]
[error]           case Left(x)  => Left(x)
[error]                                 ^
[error] /var/scalawork/HotelbedsApi/src/main/scala/frontend/xmlprotocol.scala:27: value head is not a member of Any
[error] Error occurred in an application involving default arguments.
[error]           case Right(x) => Right(scalaxb.fromXML[scalaxb.DataRecord[Any]](x.head))
[error]                                                                             ^
@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Oct 8, 2011

Owner

Oh no. Sorry about that! I took care of the above issue and made a sample that talks to the service:
https://github.com/eed3si9n/sbt-scalaxb-hotelbeds-sample

If you have sbt 0.11 installed it should run with sbt run. I'm calling getHotelCountryList but since I don't know what I am supposed to pass it in, it's returning me nothing.

0.6.5 is also published:

> cs eed3si9n/scalaxb
Owner

eed3si9n commented Oct 8, 2011

Oh no. Sorry about that! I took care of the above issue and made a sample that talks to the service:
https://github.com/eed3si9n/sbt-scalaxb-hotelbeds-sample

If you have sbt 0.11 installed it should run with sbt run. I'm calling getHotelCountryList but since I don't know what I am supposed to pass it in, it's returning me nothing.

0.6.5 is also published:

> cs eed3si9n/scalaxb
@radirk

This comment has been minimized.

Show comment
Hide comment
@radirk

radirk Oct 9, 2011

Compilation works fine now and the request goes out correctly. Great work, thanks!
Btw. is there a way to observe the raw XML (SOAP document) going over the wire? In soap4r I can

obj = FrontendService.new(endpoint_url)
# run ruby with -d to see SOAP wiredumps.
obj.wiredump_dev = STDERR if $DEBUG

radirk commented Oct 9, 2011

Compilation works fine now and the request goes out correctly. Great work, thanks!
Btw. is there a way to observe the raw XML (SOAP document) going over the wire? In soap4r I can

obj = FrontendService.new(endpoint_url)
# run ruby with -d to see SOAP wiredumps.
obj.wiredump_dev = STDERR if $DEBUG
@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Oct 9, 2011

Owner

scalaxb generates modules based on Cake pattern, which is basically a module system using inner traits.
You can substitute http module to anything as long as it conforms to scalaxb.HttpClients. Here's an example that prints out the raw XML:

import scalaxb._

trait LoggerHttpClients extends HttpClients {
  val httpClient = new LoggerHttpClient {}

  trait LoggerHttpClient extends HttpClient {
    import dispatch._

    def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
      val http = new Http
      println("[request] " + in)
      val out = http x (url(address.toString) << (in) <:< headers as_str)
      println("[response] " + out)
      out
    }
  }
}

This is also pushed into sbt-scalaxb-hotelbeds-sample.

Owner

eed3si9n commented Oct 9, 2011

scalaxb generates modules based on Cake pattern, which is basically a module system using inner traits.
You can substitute http module to anything as long as it conforms to scalaxb.HttpClients. Here's an example that prints out the raw XML:

import scalaxb._

trait LoggerHttpClients extends HttpClients {
  val httpClient = new LoggerHttpClient {}

  trait LoggerHttpClient extends HttpClient {
    import dispatch._

    def request(in: String, address: java.net.URI, headers: Map[String, String]): String = {
      val http = new Http
      println("[request] " + in)
      val out = http x (url(address.toString) << (in) <:< headers as_str)
      println("[response] " + out)
      out
    }
  }
}

This is also pushed into sbt-scalaxb-hotelbeds-sample.

martiell pushed a commit to martiell/scalaxb that referenced this issue Oct 11, 2011

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment