Announcement Announcement Module
Collapse
No announcement yet.
java.lang.ClassCastException with JaxRpcPortProxyFactoryBean Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • java.lang.ClassCastException with JaxRpcPortProxyFactoryBean

    I'm getting a java.lang.ClassCastException error while trying to access a Document/Wrapped (Literal) WebService using JaxRpcPortProxyFactoryBean. Any idea what is the problem?

    Thanks!

    Johann

    The whole trace is the following:
    Code:
    [INFO] CollectionFactory - JDK 1.4+ collections available
    [INFO] CollectionFactory - Commons Collections 3.x available
    [INFO] XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [applicationContext.xml]
    [INFO] ClassPathXmlApplicationContext - Bean factory for application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=8814217]: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [solicitaVectorService]; root of BeanFactory hierarchy
    [INFO] ClassPathXmlApplicationContext - 1 beans defined in application context [org.springframework.context.support.ClassPathXmlApplicationContext;hashCode=8814217]
    [INFO] ClassPathXmlApplicationContext - Unable to locate MessageSource with name 'messageSource': using default [[email protected]a]
    [INFO] ClassPathXmlApplicationContext - Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@698403]
    [INFO] DefaultListableBeanFactory - Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [solicitaVectorService]; root of BeanFactory hierarchy]
    [WARN] JavaUtils - Unable to find required classes (javax.activation.DataHandler and javax.mail.internet.MimeMultipart). Attachment support is disabled.
    [INFO] SolicitaVectorPortProxyFactoryBean - Using JAX-RPC dynamic calls for JAX-RPC port [{http://solvector.sdi.sii.cl}SolicitaVector]
    [INFO] DefaultAopProxyFactory - CGLIB2 available: proxyTargetClass feature enabled
    class $Proxy0
    java.lang.ClassCastException
    	at $Proxy0.getVector(Unknown Source)
    	at cl.sii.sdi.solvector.SolicitaVectorBd.getVector(SolicitaVectorBd.java:15)
    	at cl.sii.sdi.solvector.SolicitaVectorTest.main(SolicitaVectorTest.java:9)
    The wsdl is the following:
    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <wsdl:definitions targetNamespace="http://solvector.sdi.sii.cl" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://solvector.sdi.sii.cl" xmlns:intf="http://solvector.sdi.sii.cl" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <!--WSDL created by Apache Axis version: 1.4
    Built on Apr 22, 2006 (06:55:48 PDT)-->
     <wsdl:types>
      <schema elementFormDefault="qualified" targetNamespace="http://solvector.sdi.sii.cl" xmlns="http://www.w3.org/2001/XMLSchema">
       <element name="getVector">
        <complexType>
         <sequence>
          <element name="to" type="impl:DatosVector"/>
         </sequence>
        </complexType>
       </element>
       <complexType name="DatosVector">
        <sequence>
         <element name="dv" nillable="true" type="xsd:string"/>
         <element name="origen" nillable="true" type="xsd:string"/>
         <element name="periodo" nillable="true" type="xsd:int"/>
         <element name="rut" nillable="true" type="xsd:string"/>
         <element name="usoVector" nillable="true" type="xsd:string"/>
        </sequence>
       </complexType>
       <element name="getVectorResponse">
        <complexType>
         <sequence>
          <element maxOccurs="unbounded" name="getVectorReturn" type="impl:DatosVectorRespuesta"/>
         </sequence>
        </complexType>
       </element>
       <complexType name="Response">
        <sequence>
         <element name="numeroRegsitros" nillable="true" type="xsd:int"/>
         <element name="valor" nillable="true" type="xsd:int"/>
         <element name="vector" nillable="true" type="xsd:int"/>
        </sequence>
       </complexType>
       <complexType name="DatosVectorRespuesta">
        <sequence>
         <element name="dv" nillable="true" type="xsd:string"/>
         <element name="origen" nillable="true" type="xsd:string"/>
         <element name="periodo" nillable="true" type="xsd:int"/>
         <element name="respuesta" nillable="true" type="impl:Response"/>
         <element name="rut" nillable="true" type="xsd:string"/>
         <element name="usoVector" nillable="true" type="xsd:string"/>
        </sequence>
       </complexType>
      </schema>
     </wsdl:types>
       <wsdl:message name="getVectorRequest">
          <wsdl:part element="impl:getVector" name="parameters"/>
       </wsdl:message>
       <wsdl:message name="getVectorResponse">
          <wsdl:part element="impl:getVectorResponse" name="parameters"/>
       </wsdl:message>
       <wsdl:portType name="SolicitaVector">
          <wsdl:operation name="getVector">
             <wsdl:input message="impl:getVectorRequest" name="getVectorRequest"/>
             <wsdl:output message="impl:getVectorResponse" name="getVectorResponse"/>
          </wsdl:operation>
       </wsdl:portType>
       <wsdl:binding name="SolicitaVectorSoapBinding" type="impl:SolicitaVector">
          <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
          <wsdl:operation name="getVector">
             <wsdlsoap:operation soapAction=""/>
             <wsdl:input name="getVectorRequest">
                <wsdlsoap:body use="literal"/>
             </wsdl:input>
             <wsdl:output name="getVectorResponse">
                <wsdlsoap:body use="literal"/>
             </wsdl:output>
          </wsdl:operation>
       </wsdl:binding>
       <wsdl:service name="SolicitaVectorService">
          <wsdl:port binding="impl:SolicitaVectorSoapBinding" name="SolicitaVector">
             <wsdlsoap:address location="http://10.20.1.124:9041/solicitaVector/services/SolicitaVector"/>
          </wsdl:port>
       </wsdl:service>
    </wsdl:definitions>
    and the custom JaxRpcPortProxyFactoryBean is:
    Code:
    public class SolicitaVectorPortProxyFactoryBean extends JaxRpcPortProxyFactoryBean {    
        protected void postProcessJaxRpcService(Service service) {
            TypeMappingRegistry registry = service.getTypeMappingRegistry();
            TypeMapping mapping = registry.createTypeMapping();
            registerBeanMapping(mapping, DatosVector.class, "DatosVector");
            registerBeanMapping(mapping, DatosVectorRespuesta.class, "DatosVectorRespuesta");
            registerBeanMapping(mapping, Response.class, "Response");
            registry.register("", mapping);
        }
    
        protected void registerBeanMapping(TypeMapping mapping, Class type, String name) {
            QName qName = new QName("http://solvector.sdi.sii.cl", name);
            mapping.register(type, qName, new BeanSerializerFactory(type, qName), new BeanDeserializerFactory(type, qName));
        }
    }
    The application context file used is:
    Code:
    <beans default-lazy-init="true">
      <bean id="solicitaVectorService" class="cl.sii.sdi.solvector.SolicitaVectorPortProxyFactoryBean">
        <property name="serviceFactoryClass" value="org.apache.axis.client.ServiceFactory" />
        <property name="serviceInterface" value="cl.sii.sdi.solvector.SolicitaVector" />
        <property name="wsdlDocumentUrl" value="http://10.20.1.124:9041/solicitaVector/services/SolicitaVector?wsdl" />
        <property name="namespaceUri" value="http://solvector.sdi.sii.cl" />
        <property name="serviceName" value="SolicitaVectorService" />
        <property name="portName" value="SolicitaVector" />
      </bean>
    </beans>
Working...
X