I am trying to call a method in a web service made in .NET from JAVA. I am using AXIS 1.4 and Spring, my main target was send a hashtable from JAVA to .NET, because .NET doesn´t allow that i have to implement a “jagged array”. I made an application in .NET which send this “jagged array” and it worked perfect but when i try to send from a JAVA appilcation is imposible, i get an empty array “key = {Dimensions:[0]}”.



WDSL file:


HTML Code:
  <?xml version="1.0" encoding="utf-8" ?> 

- <wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tns="http://tempuri.org/" xmlns:s="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" targetNamespace="http://tempuri.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">

- <wsdl:types>

- <s:schema elementFormDefault="qualified" targetNamespace="http://tempuri.org/">

- <s:element name="sendEmail">

- <s:complexType>

- <s:sequence>

  <s:element minOccurs="0" maxOccurs="1" name="idNotificacion" type="s:string" /> 

  <s:element minOccurs="1" maxOccurs="1" name="idUsuario" type="s:int" /> 

  <s:element minOccurs="1" maxOccurs="1" name="idPais" type="s:int" /> 

  <s:element minOccurs="0" maxOccurs="1" name="key" type="tns:ArrayOfArrayOfString" /> 

  </s:sequence>

  </s:complexType>

  </s:element>

- <s:complexType name="ArrayOfArrayOfString">

- <s:sequence>

  <s:element minOccurs="0" maxOccurs="unbounded" name="ArrayOfString" nillable="true" type="tns:ArrayOfString" /> 

  </s:sequence>

  </s:complexType>

- <s:complexType name="ArrayOfString">

- <s:sequence>

  <s:element minOccurs="0" maxOccurs="unbounded" name="string" nillable="true" type="s:string" /> 

  </s:sequence>

  </s:complexType>

- <s:element name="sendEmailResponse">

  <s:complexType /> 

  </s:element>

  </s:schema>

  </wsdl:types>

- <wsdl:message name="sendEmailSoapIn">

  <wsdl:part name="parameters" element="tns:sendEmail" /> 

  </wsdl:message>

- <wsdl:message name="sendEmailSoapOut">

  <wsdl:part name="parameters" element="tns:sendEmailResponse" /> 

  </wsdl:message>

- <wsdl:portType name="ServiceSoap">

- <wsdl:operation name="sendEmail">

  <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">Transporta los datos requeridos desde G2 a G1 para el envío de emails</wsdl:documentation> 

  <wsdl:input message="tns:sendEmailSoapIn" /> 

  <wsdl:output message="tns:sendEmailSoapOut" /> 

  </wsdl:operation>

  </wsdl:portType>

- <wsdl:binding name="ServiceSoap" type="tns:ServiceSoap">

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

- <wsdl:operation name="sendEmail">

  <soap:operation soapAction="http://tempuri.org/sendEmail" 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="ServiceSoap12" type="tns:ServiceSoap">

  <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" /> 

- <wsdl:operation name="sendEmail">

  <soap12:operation soapAction="http://tempuri.org/sendEmail" style="document" /> 

- <wsdl:input>

  <soap12:body use="literal" /> 

  </wsdl:input>

- <wsdl:output>

  <soap12:body use="literal" /> 

  </wsdl:output>

  </wsdl:operation>

  </wsdl:binding>

- <wsdl:service name="Service">

- <wsdl:port name="ServiceSoap" binding="tns:ServiceSoap">

  <soap:address location="http://localhost:1487/WSSendEmail/Service.asmx" /> 

  </wsdl:port>

- <wsdl:port name="ServiceSoap12" binding="tns:ServiceSoap12">

  <soap12:address location="http://localhost:1487/WSSendEmail/Service.asmx" /> 

  </wsdl:port>

  </wsdl:service>

  </wsdl:definitions>

Spring bean:

HTML Code:
      <bean id="sendEmailWS" class="com.deremate.g2.email.spring.SendEmailRpcPortProxyFactoryBean">

            <property name="serviceInterface" value="com.deremate.g2.email.spring.SendEmailBridge" />

            <property name="wsdlDocumentUrl" value="http://localhost:1487/WSSendEmail/Service.asmx?WSDL" />

            <property name="namespaceUri" value="http://tempuri.org/" />

            <property name="serviceName" value="Service" />

            <property name="portName" value="ServiceSoap" />

      </bean>

Implementation of the bean class

Code:
public class SendEmailRpcPortProxyFactoryBean extends JaxRpcPortProxyFactoryBean {

 

    protected void postProcessJaxRpcService(Service service) {

        TypeMappingRegistry registry = service.getTypeMappingRegistry();

        TypeMapping mapping = registry.createTypeMapping();

        registerBeanMapping(mapping, String[].class, "ArrayOfString");

        registerBeanMappingArray(mapping, String[][].class, "ArrayOfArrayOfString");

        registry.register("http://schemas.xmlsoap.org/soap/encoding/", mapping);

     }

 

     protected void registerBeanMapping(TypeMapping mapping, Class type, String name) {

        QName qName = new QName("http://tempuri.org/", name);

        mapping.register(type, qName,

            new BeanSerializerFactory(type, qName),

            new BeanDeserializerFactory(type, qName));

     }

 

    protected void registerBeanMappingArray(TypeMapping mapping, Class type, String name) {

        QName qName = new QName("http://tempuri.org/", name);

        mapping.register(type, qName,

            new ArraySerializerFactory(type, qName),

            new ArrayDeserializerFactory(qName));

    }

}




webservice (Client)


Code:
String[] dataMapKey[] = new String[1][];

      dataMapKey[0] = new String[2];

      dataMapKey[0][0] = "pepe";

      dataMapKey[0][1] = "pepito";

      

      SendEmailBridge service = (SendEmailBridge) ctx.getBean("sendEmailWS");

      service.sendEmail("Registro_Confirma_OK", 1000000, 27, dataMapKey);


WebService in.NET (Server)

Code:
[WebMethod(Description = "Transporta los datos requeridos desde G2 a G1 para el envío de emails")]

    public void sendEmail(String idNotificacion, int idUsuario, int idPais, String[][] key)

    {

     //El valor de key que recibo es: {Dimensions:[0]}

    }