[jbossws-users] [JBossWS] - Failed to set value - argument type mismatch
hugin78
do-not-reply at jboss.com
Thu Jan 11 10:30:17 EST 2007
Hallo
In my wsdl file I have a type with enumerations. I have one operation that returns an instance of the type - This one is working fine. I then have another that take an instance of the type as argument and this one fails with the exception:
| 2007-01-11 16:09:03,253 WARN [org.jboss.webservice.metadata.jaxrpcmapping.JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://ws.facade.as2007.wmdata.com/jaws}CarType
| 2007-01-11 16:09:03,253 WARN [org.jboss.webservice.metadata.jaxrpcmapping.JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://ws.facade.as2007.wmdata.com/jaws}getCar
| 2007-01-11 16:09:03,253 WARN [org.jboss.webservice.metadata.jaxrpcmapping.JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://ws.facade.as2007.wmdata.com/jaws}getCarResponse
| 2007-01-11 16:09:03,253 WARN [org.jboss.webservice.metadata.jaxrpcmapping.JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://ws.facade.as2007.wmdata.com/jaws}setCar
| 2007-01-11 16:09:03,253 WARN [org.jboss.webservice.metadata.jaxrpcmapping.JavaWsdlMapping] Cannot find jaxrpc-mapping for type: {http://ws.facade.as2007.wmdata.com/jaws}setCarResponse
| 2007-01-11 16:09:03,253 WARN [org.jboss.ws.jaxb.SchemaBindingBuilder] Type definition not found in schema: {http://ws.facade.as2007.wmdata.com/jaws}CarType
| 2007-01-11 16:09:03,253 WARN [org.jboss.ws.jaxb.SchemaBindingBuilder] Cannot obtain type binding for: {http://ws.facade.as2007.wmdata.com/jaws}CarType
| 2007-01-11 16:09:03,253 ERROR[org.jboss.ws.jaxrpc.SOAPFaultExceptionHelper] SOAP request exception
| javax.xml.rpc.JAXRPCException: org.jboss.ws.binding.BindingException: javax.xml.bind.JAXBException: Failed to parse source: Failed to set value java.lang.String at 112785[red] using setter setColor on com.wmdata.as2007.xml.jaxbbindings.CarType at 15580831 (toString=com.wmdata.as2007.xml.jaxbbindings.CarTy
| pe at edbe9f) : argument type mismatch
| - with linked exception:
| [org.jboss.xb.binding.JBossXBException: Failed to parse source: Failed to set value java.lang.String at 112785[red] using setter setColor on com.wmdata.as2007.xml.jaxbbindings.CarType at 15580831 (toString=com.wmdata.as2007.xml.jaxbbindings.CarType at edbe9f) : argument type mismatch]
| at org.jboss.ws.soap.SOAPContentElement.getObjectValue(SOAPContentElement.java:307)
| at org.jboss.ws.binding.EndpointInvocation.transformPayloadValue(EndpointInvocation.java:233)
| at org.jboss.ws.binding.EndpointInvocation.getRequestParamValue(EndpointInvocation.java:103)
| at org.jboss.ws.binding.EndpointInvocation.getRequestPayload(EndpointInvocation.java:117)
| at org.jboss.ws.server.ServiceEndpointInvokerEJB3.invokeServiceEndpoint(ServiceEndpointInvokerEJB3.java:106)
| at org.jboss.ws.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:118)
| at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:234)
| at org.jboss.ws.server.ServiceEndpointServlet.doPost(ServiceEndpointServlet.java:120)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
| at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
| at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
| at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
| at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
| at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
| at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
| at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
| at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
| at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
| at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
| at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
| at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
| at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
| at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
| at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
| at java.lang.Thread.run(Thread.java:595)
| Caused by: org.jboss.ws.binding.BindingException: javax.xml.bind.JAXBException: Failed to parse source: Failed to set value java.lang.String at 112785[red] using setter setColor on com.wmdata.as2007.xml.jaxbbindings.CarType at 15580831 (toString=com.wmdata.as2007.xml.jaxbbindings.CarType at edbe9f) : argumen
| t type mismatch
|
|
My wsdlfile (used the jboss autogenerated one and changed the types):
| <definitions name='CarWSService' targetNamespace='http://ws.facade.as2007.wmdata.com/jaws' xmlns='http://schemas.xmlsoap.org/wsdl/' xmlns:ns1='http://jaxbbindings.xml.as2007.wmdata.com/jaws' xmlns:soap='http://schemas.xmlsoap.org/wsdl/soap/' xmlns:tns='http://ws.facade.as2007.wmdata.com/jaws' xmlns:xsd='http://www.w3.org/2001/XMLSchema'>
| <types>
| <schema elementFormDefault='qualified' targetNamespace='http://jaxbbindings.xml.as2007.wmdata.com/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns1='http://ws.facade.as2007.wmdata.com/jaws' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://jaxbbindings.xml.as2007.wmdata.com/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
| <import namespace='http://ws.facade.as2007.wmdata.com/jaws'/>
| <simpleType name='CarColor'>
| <restriction base='string'>
| <enumeration value='red'/>
| <enumeration value='green'/>
| </restriction>
| </simpleType>
| <complexType name='CarType'>
| <sequence>
| <element maxOccurs='1' name='color' nillable='true' type='tns:CarColor'/>
| </sequence>
| </complexType>
| </schema>
| <schema elementFormDefault='qualified' targetNamespace='http://ws.facade.as2007.wmdata.com/jaws' xmlns='http://www.w3.org/2001/XMLSchema' xmlns:ns2='http://jaxbbindings.xml.as2007.wmdata.com/jaws' xmlns:soap11-enc='http://schemas.xmlsoap.org/soap/encoding/' xmlns:tns='http://ws.facade.as2007.wmdata.com/jaws' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
| <import namespace='http://jaxbbindings.xml.as2007.wmdata.com/jaws'/>
| <complexType name='getCar'>
| <sequence/>
| </complexType>
| <complexType name='getCarResponse'>
| <sequence>
| <element name='result' nillable='true' type='ns2:CarType'/>
| </sequence>
| </complexType>
| <complexType name='setCar'>
| <sequence>
| <element name='CarType_1' nillable='true' type='ns2:CarType'/>
| </sequence>
| </complexType>
| <complexType name='setCarResponse'>
| <sequence/>
| </complexType>
| <element name='getCar' type='tns:getCar'/>
| <element name='getCarResponse' type='tns:getCarResponse'/>
| <element name='setCar' type='tns:setCar'/>
| <element name='setCarResponse' type='tns:setCarResponse'/>
| </schema>
| </types>
| <message name='CarWS_getCarResponse'>
| <part element='tns:getCarResponse' name='result'/>
| </message>
| <message name='CarWS_setCar'>
| <part element='tns:setCar' name='parameters'/>
| </message>
| <message name='CarWS_setCarResponse'>
| <part element='tns:setCarResponse' name='result'/>
| </message>
| <message name='CarWS_getCar'>
| <part element='tns:getCar' name='parameters'/>
| </message>
| <portType name='CarWS'>
| <operation name='getCar'>
| <input message='tns:CarWS_getCar'/>
| <output message='tns:CarWS_getCarResponse'/>
| </operation>
| <operation name='setCar'>
| <input message='tns:CarWS_setCar'/>
| <output message='tns:CarWS_setCarResponse'/>
| </operation>
| </portType>
| <binding name='CarWSBinding' type='tns:CarWS'>
| <soap:binding style='document' transport='http://schemas.xmlsoap.org/soap/http'/>
| <operation name='getCar'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| <operation name='setCar'>
| <soap:operation soapAction=''/>
| <input>
| <soap:body use='literal'/>
| </input>
| <output>
| <soap:body use='literal'/>
| </output>
| </operation>
| </binding>
| <service name='CarWSService'>
| <port binding='tns:CarWSBinding' name='CarWSPort'>
| <soap:address location='http://localhost:8280/facade/CarWS'/>
| </port>
| </service>
| </definitions>
|
The webservice class:
@Stateless
| @WebService(wsdlLocation="META-INF/wsdl/CarWS.wsdl")
| @SOAPBinding(style = SOAPBinding.Style.DOCUMENT)
| public class CarWS extends WSBean {
|
|
| @WebMethod
| public CarType getCar(){
| CarType car = new CarType();
| car.setColor(CarColor.RED);
| return car;
| }
|
| @WebMethod
| public void setCar(CarType car){
| System.out.println("carcolor = " + car.getColor());
| }
| }
and the two element type implementations:
| @XmlAccessorType(AccessType.FIELD)
| @XmlType(name = "CarType", propOrder = {
| "color"
| })
| public class CarType {
|
| @XmlElement(name = "color")
| protected CarColor color;
|
|
| public CarColor getColor() {
| return color;
| }
|
| public void setColor(CarColor color) {
| this.color = color;
| }
| }
|
| public class CarColor implements java.io.Serializable {
| private java.lang.String _value_;
|
| private static HashMap<String, Object> _table_ = new HashMap<String, Object>();
|
| public static final java.lang.String _RED = "red";
| public static final java.lang.String _GREEN = "green";
|
| public static final CarColor RED = new CarColor(_RED);
| public static final CarColor GREEN = new CarColor(_GREEN);
|
|
| public CarColor(){}
|
| // Constructor
| protected CarColor(java.lang.String value) {
| _value_ = value;
| _table_.put(_value_, this);
| }
|
| public java.lang.String getValue() {
| return _value_;
| }
|
| public static CarColor fromValue(java.lang.String value) throws java.lang.IllegalArgumentException {
| CarColor enumeration = (CarColor) _table_.get(value);
| if (enumeration == null)
| throw new java.lang.IllegalArgumentException();
| return enumeration;
| }
|
| public static CarColor fromString(java.lang.String value) throws java.lang.IllegalArgumentException {
| return fromValue(value);
| }
|
| public boolean equals(java.lang.Object obj) {
| return (obj == this);
| }
|
| public int hashCode() {
| return toString().hashCode();
| }
|
| public java.lang.String toString() {
| return _value_;
| }
|
| public java.lang.Object readResolve() throws java.io.ObjectStreamException {
| return fromValue(_value_);
| }
| }
Can any of you see what I'm doing wrong?
View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4000490#4000490
Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4000490
More information about the jbossws-users
mailing list