axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From iksrazal <iksra...@gmail.com>
Subject Re: Dynamic typeMapping deserializers
Date Thu, 24 Nov 2005 16:35:59 GMT
Em Quinta 24 Novembro 2005 15:16, o Don Tam escreveu:
> Hi,
>
> I already have an old web service running JWSDP.  So if I write a
> deserializer for a datatype, how would I register it with my client so
> that Axis knows I need to use it for said datatype? Is there a way I can
> declare this in the code once I have the stub (because I have nothing to
> deploy)?
>
> Thanks,

I solved seemingly this same problem a while back. With JWSDP and wscompile, 
you can generate a mapping file, like...

wscompile.sh -import   -mapping resources/CallCentreWeb_Mapping.xml 
resources/config-wsdl.xml

Now with an axis client, the code is like: 


    String wsdl_loc   = "http://localhost:8080/CallCentreWebServiceJAR?wsdl";
            URL mappinglocation = 
ClassLoader.getSystemResource("CallCentreWeb_Mapping.xml");
            URL ws4eeMetaData = 
ClassLoader.getSystemResource("ws4ee-deploy.xml");

            QName qname = new QName("http://localhost/callcentreweb",
              "CallCentreWebService");
            URL url =  new URL(wsdl_loc);

            org.jboss.webservice.client.ServiceFactoryImpl factory= 
(org.jboss.webservice.client.ServiceFactoryImpl) 
ServiceFactoryImpl.newInstance();
            javax.xml.rpc.Service service = factory.createService(url, 
mappinglocation, ws4eeMetaData,  qname, null);
            endpoint = (CallCentreWebEndpoint) 
service.getPort(CallCentreWebEndpoint.class); 

            ReturnWeb_Login rwl = endpoint.web_Login(1,"user","password");
            ReturnWeb_UserList ul = endpoint.web_user_List(1,sessionStr);
            
The idea here is that you load the mappinglocation from JWSDP into an Axis 
library. JBoss uses Axis internally, and I picked it because I thought I also 
needed ws4eeMetaData with the axis descriptor, shown here: 

<deployment
xmlns='http://xml.apache.org/axis/wsdd/'
xmlns:java='http://xml.apache.org/axis/wsdd/providers/java'
xmlns:soap='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:xsi='http://www.w3.org/2000/10/XMLSchema-instance'
xmlns:xsd='http://www.w3.org/2001/XMLSchema'>

<typeMapping
qname="ns2:SimpleStaffEntry"
xmlns:ns2="urn:BeanService"
serializer='org.apache.axis.encoding.ser.BeanSerializerFactory'
deserializer='org.apache.axis.encoding.ser.BeanDeserializerFactory'
type="java:hostedtelecom.callcentreweb.endpoint.ReturnWeb_UserList_Item"
encodingStyle=''
/> 
</deployment>	

In retrospect I ended up calling a lot more than ReturnWeb_UserList_Item, and 
never changed this file. 

Bottom line, IIRC you need to find a ServiceFactoryImpl that supports 
importing a mapping location. 

HTH,
iksrazal

Mime
View raw message