Hi All,
 
    I need your help. I`m trying to develop a web service client that it has, as input and output parameters, complex type. The code of this web service cliente is the next:
 
       // create a Service instance (other constructor usable, see the doc)
       Service service = new Service();
 
       // configure mappings if web service use Complex types
       // first get the mapping registry instance
 
       TypeMappingRegistry tmr = service.getTypeMappingRegistry();
 
       // create a QName representing the fully qualified name of the
       // XML type to serialize/deserialize (namespace+locapart pair)
       // QName xmlType = new QName("namespace-of-complex-type", "complex-type-name");
       QName xmlTypeIn = new QName("http://valueobject","EntradaServicioConsultaVO");
       QName xmlTypeOut = new QName("http://valueobject","SalidaServicioConsultaVO");
 
       // get a TypeMapping (default for axis is SOAP encoding TypeMapping)
       TypeMapping tm = tmr.getDefaultTypeMapping();
 
       // register the XML type with a Java class by specifying
       // Serializer/Deserializer factories to use.
 
       tm.register(EntradaServicioConsultaVO.class,
                xmlTypeIn,
                new BeanSerializerFactory(EntradaServicioConsultaVO.class, xmlTypeIn),
                new BeanDeserializerFactory(EntradaServicioConsultaVO.class, xmlTypeIn));
       tm.register(SalidaServicioConsultaVO.class,
          xmlTypeOut,
          new BeanSerializerFactory(SalidaServicioConsultaVO.class, xmlTypeOut),
          new BeanDeserializerFactory(SalidaServicioConsultaVO.class, xmlTypeOut));
 
       Call call = (Call) service.createCall();
 
        // Establecemos la dirección en la que está activado el WebService
       call.setTargetEndpointAddress( new java.net.URL(ENDPOINT_URL) );
 
       // Establecemos el nombre del método a invocar
       call.setOperationName( "procesaConsulta" );
 

        // Establecemos los parámetros que necesita el método
        // Observe que se deben especidicar correctamente tanto el nómbre como el tipo de datos..
        // esta información se puede obtener viendo el WSDL del servicio Web
 
       call.addParameter( "EntradaServicioConsultaVO", xmlTypeIn, ParameterMode.IN );
       //call.addParameter( new QName("http://valueobject","servicio"), xmlTypeIn, ParameterMode.IN );
 
       // Especificamos el tipo de datos que devuelve el método.
       call.setReturnType(xmlTypeOut);
 
        // Invocamos el método
       call.invoke( new Object [] { entrada });
 
 
    When I execute this code, I have an exception: faultString: org.xml.sax.SAXException: Invalid element in valueobject.EntradaServicioConsultaVO - servicio
 
    I think that I'm not adding a correct parameter, but I don't know what I have to add according with the WSDL file   
 
    The WSDL file is the next:
 

<?xml version="1.0" encoding="UTF-8"?>

<wsdl:definitions targetNamespace="http://ibatis" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://ibatis" xmlns:intf="http://ibatis" xmlns:tns1="http://valueobject" 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.2.1

Built on Jun 14, 2005 (09:15:57 EDT)-->

<wsdl:types>

<schema elementFormDefault="qualified" targetNamespace="http://ibatis" xmlns="http://www.w3.org/2001/XMLSchema">

<import namespace="http://valueobject"/>

<import namespace="http://xml.apache.org/xml-soap"/>

<complexType name="ArrayOf_xsd_anyType">

<sequence>

<element maxOccurs="unbounded" minOccurs="0" name="item" type="xsd:anyType"/>

</sequence>

</complexType>

<element name="servicio" type="tns1:EntradaServicioConsultaVO"/>

<element name="procesaConsultaReturn" type="tns1:SalidaServicioConsultaVO"/>

</schema>

<schema elementFormDefault="qualified" targetNamespace="http://valueobject" xmlns="http://www.w3.org/2001/XMLSchema">

<import namespace="http://ibatis"/>

<import namespace="http://xml.apache.org/xml-soap"/>

<complexType name="EntradaServicioConsultaVO">

<sequence>

<element name="camposConsulta" nillable="true" type="impl:ArrayOf_xsd_anyType"/>

<element name="secgri" nillable="true" type="xsd:string"/>

<element name="sistemaexterno" nillable="true" type="xsd:string"/>

<element name="tipoformulario" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

<complexType name="SalidaServicioConsultaVO">

<sequence>

<element name="camposValor" nillable="true" type="apachesoap:Map"/>

<element name="codigoError" nillable="true" type="xsd:string"/>

<element name="mensajeError" nillable="true" type="xsd:string"/>

<element name="secgri" nillable="true" type="xsd:string"/>

<element name="tipoformulario" nillable="true" type="xsd:string"/>

</sequence>

</complexType>

</schema>

<schema elementFormDefault="qualified" targetNamespace="http://xml.apache.org/xml-soap" xmlns="http://www.w3.org/2001/XMLSchema">

<import namespace="http://ibatis"/>

<import namespace="http://valueobject"/>

<complexType name="mapItem">

<sequence>

<element name="key" nillable="true" type="xsd:anyType"/>

<element name="value" nillable="true" type="xsd:anyType"/>

</sequence>

</complexType>

<complexType name="Map">

<sequence>

<element maxOccurs="unbounded" minOccurs="0" name="item" type="apachesoap:mapItem"/>

</sequence>

</complexType>

</schema>

</wsdl:types>

<wsdl:message name="procesaConsultaResponse">

<wsdl:part element="impl:procesaConsultaReturn" name="procesaConsultaReturn"/>

</wsdl:message>

<wsdl:message name="procesaConsultaRequest">

<wsdl:part element="impl:servicio" name="servicio"/>

</wsdl:message>

<wsdl:portType name="ProcesaConsulta">

<wsdl:operation name="procesaConsulta" parameterOrder="servicio">

<wsdl:input message="impl:procesaConsultaRequest" name="procesaConsultaRequest"/>

<wsdl:output message="impl:procesaConsultaResponse" name="procesaConsultaResponse"/>

</wsdl:operation>

</wsdl:portType>

<wsdl:binding name="ProcesaConsultaSoapBinding" type="impl:ProcesaConsulta">

<wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>

<wsdl:operation name="procesaConsulta">

<wsdlsoap:operation soapAction=""/>

<wsdl:input name="procesaConsultaRequest">

<wsdlsoap:body use="literal"/>

</wsdl:input>

<wsdl:output name="procesaConsultaResponse">

<wsdlsoap:body use="literal"/>

</wsdl:output>

</wsdl:operation>

</wsdl:binding>

<wsdl:service name="ProcesaConsultaService">

<wsdl:port binding="impl:ProcesaConsultaSoapBinding" name="ProcesaConsulta">

<wsdlsoap:address location="http://localhost:9001/ServiciosWeb2/services/ProcesaConsulta"/>

</wsdl:port>

</wsdl:service>

</wsdl:definitions>

 

    The last explanation! The web service was generated with WTP in Eclipse.

  I need your help, PLEASE!!

  THANK YOU.

 

Javier Arenales.

Reply via email to