Compile error in xmlprotocol.scala on Seq vs. vararg #125

Closed
hedefalk opened this Issue Nov 28, 2011 · 4 comments

Comments

Projects
None yet
2 participants
@hedefalk

The following wsdl gives me compile errors:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:tns="http://www.hedefalk.se/test/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
targetNamespace="http://www.hedefalk.se/test/">
    <wsdl:types>
        <xsd:schema
        targetNamespace="http://www.hedefalk.se/test/">
            <xsd:element name="TestElement">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element maxOccurs="unbounded" minOccurs="0"
                        name="Thing">
                            <xsd:complexType>
                                <xsd:sequence>
                                    <xsd:element name="sString" type="xsd:string" />
                                </xsd:sequence>
                            </xsd:complexType>
                        </xsd:element>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="MessageIn">
        <wsdl:part name="in" element="tns:TestElement" />
    </wsdl:message>
    <wsdl:message name="MessageOut">
        <wsdl:part name="out" type="xsd:string" />
    </wsdl:message>
    <wsdl:portType name="PortType1">
        <wsdl:operation name="Operation1">
            <wsdl:input message="tns:MessageIn" />
            <wsdl:output message="tns:MessageOut" />
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:portType name="PortType2">
        <wsdl:operation name="Operation2">
            <wsdl:input message="tns:MessageIn" />
            <wsdl:output message="tns:MessageOut" />
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="Binding1" type="tns:PortType1">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="Operation1">
            <soap:operation soapAction="http://hedefalk.se/test" style="document" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="Binding2" type="tns:PortType2">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="Operation2">
            <soap:operation soapAction="http://hedefalk.se/test" style="document" />
            <wsdl:input>
                <soap:body use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="service">
        <wsdl:port binding="tns:Binding1" name="Port1"></wsdl:port>
        <wsdl:port binding="tns:Binding2" name="Port2"></wsdl:port>
    </wsdl:service>
</wsdl:definitions>

The generated code:

trait Binding1Binding extends PortType1 {
      def operation1(thing: Seq[dfk.ka.generated.Thing]): Either[scalaxb.Fault[Any], String] = 
        soapClient.requestResponse(scalaxb.toXML(TestElement(thing), Some("http://www.hedefalk.se/test/"), "TestElement", defaultScope),
            Nil, defaultScope, baseAddress, "POST", Some(new java.net.URI("http://hedefalk.se/test"))) match {
          case Left(x)  => Left(x)
          case Right((header, body)) =>
            Right(scalaxb.fromXML[String](scala.xml.Elem("", "Body", scala.xml.Null, defaultScope, body.toSeq: _*)))
        }
    }

I have three compile errors here, but I think only the first is a real error while the following just is the type checker that get's hindered by the first:

type mismatch; found : Seq[dfk.ka.generated.Thing] required:
dfk.ka.generated.Thing

The case class is generated with a vararg of Thing but then used with a Seq from operation. Maybe a : _* would fix it or am I misusing sequences in some way?

note

https://github.com/eed3si9n/scalaxb-sample/tree/hedefalk/hedefalk

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Nov 28, 2011

Owner

This is likely scalaxb bug, missing _* for vararg parameter.

Owner

eed3si9n commented Nov 28, 2011

This is likely scalaxb bug, missing _* for vararg parameter.

@hedefalk

This comment has been minimized.

Show comment
Hide comment
@hedefalk

hedefalk Nov 28, 2011

Should be a quick fix, right? :)

Thanks a lot for your quick replies! I'm really dependent on them so I can't thank you enough…

Should be a quick fix, right? :)

Thanks a lot for your quick replies! I'm really dependent on them so I can't thank you enough…

@eed3si9n eed3si9n closed this in 838db8b Nov 29, 2011

@eed3si9n

This comment has been minimized.

Show comment
Hide comment
@eed3si9n

eed3si9n Nov 29, 2011

Owner

this is fixed in the latest snapshot.

Owner

eed3si9n commented Nov 29, 2011

this is fixed in the latest snapshot.

@hedefalk

This comment has been minimized.

Show comment
Hide comment
@hedefalk

hedefalk Nov 29, 2011

Excellent, thanks a lot! Is it deployed to scala-tools.org already?
/Viktor

On Tue, Nov 29, 2011 at 8:17 AM, eugene yokota
reply@reply.github.com
wrote:

this is fixed in the latest snapshot.


Reply to this email directly or view it on GitHub:
#125 (comment)

Excellent, thanks a lot! Is it deployed to scala-tools.org already?
/Viktor

On Tue, Nov 29, 2011 at 8:17 AM, eugene yokota
reply@reply.github.com
wrote:

this is fixed in the latest snapshot.


Reply to this email directly or view it on GitHub:
#125 (comment)

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