geronimo-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Srinath Perera <hemap...@gmail.com>
Subject Fwd: [Follow up IRC]Type mappings and Dynamic Proxies in Axis
Date Sat, 29 Jan 2005 15:31:07 GMT
Foward without the attachment

---------- Forwarded message ----------
From: Srinath Perera <hemapani@gmail.com>
Date: Sat, 29 Jan 2005 21:22:47 +0600
Subject: [Follow up IRC]Type mappings and Dynamic Proxies in Axis
To: dev@geronimo.apache.org, David Blevins <david.blevins@visi.com>,
David Jencks <djencks@gluecode.com>


Hi All;
Regarding the IRC chat regarding the Axis Client side have a good news
to deliver :)

1) Dynamic Proxy, use new Service(wsdlfile,serviceName) works for the
complex types
2) registering the type mappings can be done easily using the
clinet-config.wsdd file in Axis.

e.g.
public void testDynamicCall()throws Exception{
System.setProperty(EngineConfigurationFactoryDefault.OPTION_CLIENT_CONFIG_FILE,
new File("client-config.wsdd").getAbsolutePath());
File wsdlFile = new File("echo.wsdl");
FileInputStream in = new FileInputStream(wsdlFile);
Service service = new Service(in,new
QName("http://axis.apache.org","EchoService"));
Echo echo = (Echo)service.getPort(Echo.class);
System.out.println(echo.echoString("Hello"));
System.out.println(echo.echoStringArray(new String[]{"Hello","Hi"}));

EchoStruct struct = new EchoStruct("val1","val1","val1","val1",
"val1","val1","val1","val1","val1","val1","val1","val1",23);

System.out.println(echo.echoEchoStruct(struct));
System.out.println(echo.echoEchoStructArray(new EchoStruct[]{struct}));
}
Note the first line of the method, by setting the system property we
can make the AxisClient to use the given conf file. the conf file
should be like follows in this case.

<?xml version="1.0" encoding="UTF-8"?>
<deployment name="defaultClientConfig"
          xmlns="http://xml.apache.org/axis/wsdd/"
          xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
<globalConfiguration>
 <parameter name="disablePrettyXML" value="true"/>
</globalConfiguration>
<transport name="http" pivot="java:org.apache.axis.transport.http.HTTPSender"/>
<transport name="local"
pivot="java:org.apache.axis.transport.local.LocalSender"/>
<transport name="java" pivot="java:org.apache.axis.transport.java.JavaSender"/>

     <typeMapping
      xmlns:ns="http://axis.apache.org"
      qname="ns:ArrayOf_xsd_string"
      type="java:java.lang.String[]"
      serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
      deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    />
    <typeMapping
      xmlns:ns="http://axis.apache.org"
      qname="ns:ArrayOfEchoStruct"
      type="java:org.apache.axis.EchoStruct[]"
      serializer="org.apache.axis.encoding.ser.ArraySerializerFactory"
      deserializer="org.apache.axis.encoding.ser.ArrayDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    />
    <typeMapping
      xmlns:ns="http://axis.apache.org"
      qname="ns:EchoStruct"
      type="java:org.apache.axis.EchoStruct"
      serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
      deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory"
      encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    />
</deployment>

Note the typeMapping tags, and they do the trick :). I think we can
generate the client-config.wsdd file from the information take from
the service Referances and the mapping file. (we can use EWS parsers
or may be XSLT?)
Thanks
Srinath

Mime
View raw message