axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aedemar.co...@rbc.com
Subject RE: .NET and Axis
Date Fri, 18 Mar 2005 13:12:15 GMT
Hi Dino,
 
thanks for your suggestion but I have found that I can generate helper classes using --helperGen
on the WSDL2Java command.  These helper classes contain the typeDesc code that Axis uses for
it serialization.  BeanSer/Deser actually tries to load these _Helper classes if the getTypeDesc
static method is not found is the X.class in order to get the TypeDesc.
 
I have found that I need to use a variation of the WSDL first approach as the axis generated
WSDL contains ArrayOf elements which I cannot get to work with my .NET client.
 
But I can use my existing classes and a wrapped/literal service if I include the generated
Helper classes and edit the WSDL as below.   
 
The steps I follow are therefore:
1. Java2WSDL
2. Edit the ArrayOf XML
3. WSDL2Java using --helperGen 
 
and it works.
 
Thanks for all your help.
 
<complexType name="ArrayOf_tns2_X">

<sequence>

<element maxOccurs="unbounded" minOccurs="0" name="item" type="tns2:X"/>

</sequence>

....

<complexType name="Y">

<complexContent>

<sequence>

<element name="queries" nillable="true" type="impl:ArrayOf_X"/>

</sequence>

</complexContent>

</complexType>

gets changes to....
<element name="Y">

<complexType>

<sequence>

<element maxOccurs="unbounded" name="X1" type="tns2:X"/>

</sequence>

</complexType>

</element>

 

-----Original Message-----
From: Dino Chiesa [mailto:dinoch@microsoft.com]
Sent: 15 March 2005 2:19 
To: Dino Chiesa; axis-user@ws.apache.org
Cc: Cooke, Aedemar
Subject: RE: .NET and Axis


Aedmar, One last thing. . .
 
If I take your inquiry.wsdl, and modify it, I can generate a .NET client that accepts the
response.xml that you included previously.  
 
The modifications are: 
 
- collapse all <schema> into a single <schema>, targetNamespace="http://inquiry.webservice.gpb.rbc.com"
-  re-define tns3 and tns4 to be "inquiry.webservice.gpb.rbc.com" rather than util... and
customer.... 
 
In other words, effectively I redefine all types used in the wsdl to reside in a single namespace.
 ("inquiry.blah.blah").  
 
Then, the .NET client generated from such a WSDL can consume the response document you sent
out. 
 
I don't feel quite right in doing this.  Effectively I have turned the contract on its head
- I am writing the WSDL to conform to the actual XML on the wire, rather than the other way
'round ("WSDL First", which as you know is the One True Way to Interop Enlightenment).  
 
But, on the other hand, WSDL is just a tool, no?   Modifying the WSDL in this way may be completely
acceptable.  Of course, a better approach is to convince AXIS to generate a WSDL like that,
automatically.   How?  Just modify the WSDD so that all your custom types (Code, BankIdentifier,
GPBException, etc) all reside in the same XMLNS, "http://inquiry.webservice.gpb.rbc.com"
 
 
Then, the auto-gen'd WSDL should reflect the XML on the wire.  
 
-Dino
 
 

  _____  

From: Dino Chiesa 
Sent: Tuesday, March 15, 2005 7:59 AM
To: 'axis-user@ws.apache.org'
Subject: RE: .NET and Axis


ahh, sorry, I don't know much about custom serializers for AXIS, someone else maybe on the
list can help you with that.  maybe you need to restate the question (it has been a long-ish
thread, and probably lots of people tuned out). 
 

  _____  

From: aedemar.cooke@rbc.com [mailto:aedemar.cooke@rbc.com] 
Sent: Tuesday, March 15, 2005 6:30 AM
To: axis-user@ws.apache.org
Subject: RE: .NET and Axis


Hi Dino,
 
you can get it working because you are using the Axis generated Java beans which contains
class specific Serializer and Deserializer code.
 
If I cut and paste the Axis generated Serializer and Deserializer code into my existing classes
it works aswell. 
 
Thanks to you I have recognised the problem, i.e., that using the de/serializers specified
in the server-config.wsdd file creates name space issues.
 
<typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle=""
qname="ns5:BankIdentifier" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
type="java:com.rbc.gpb.util.BankIdentifier" xmlns:ns5="http://util.gpb.rbc.com"/>

<typeMapping deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" encodingStyle=""
qname="ns6:Code" serializer="org.apache.axis.encoding.ser.BeanSerializerFactory" type="java:com.rbc.gpb.util.Code"
xmlns:ns6="http://util.gpb.rbc.com"/>

Any idea how I can continue to use my preexisting Java classes (and there are a lot of them)
without having to cut and paste the de/serializer code into each of them?
 
Example of Axis generated Serializer and Deserializer code 

private static org.apache.axis.description.TypeDesc typeDesc =

new org.apache.axis.description.TypeDesc(BankIdentifier.class, true);

static {

typeDesc.setXmlType(new javax.xml.namespace.QName("http://util.gpb.rbc.com", "BankIdentifier"));

org.apache.axis.description.ElementDesc elemField = new org.apache.axis.description.ElementDesc();

elemField.setFieldName("bank");

elemField.setXmlName(new javax.xml.namespace.QName("http://util.gpb.rbc.com", "bank"));

elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));

typeDesc.addFieldDesc(elemField);

elemField = new org.apache.axis.description.ElementDesc();

elemField.setFieldName("transit");

elemField.setXmlName(new javax.xml.namespace.QName("http://util.gpb.rbc.com", "transit"));

elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));

typeDesc.addFieldDesc(elemField);

elemField = new org.apache.axis.description.ElementDesc();

elemField.setFieldName("key");

elemField.setXmlName(new javax.xml.namespace.QName("http://util.gpb.rbc.com", "key"));

elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "string"));

elemField.setNillable(true);

typeDesc.addFieldDesc(elemField);

elemField = new org.apache.axis.description.ElementDesc();

elemField.setFieldName("number");

elemField.setXmlName(new javax.xml.namespace.QName("http://util.gpb.rbc.com", "number"));

elemField.setXmlType(new javax.xml.namespace.QName("http://www.w3.org/2001/XMLSchema", "int"));

typeDesc.addFieldDesc(elemField);

}

/**

* Return type metadata object

*/

public static org.apache.axis.description.TypeDesc getTypeDesc() {

return typeDesc;

}

/**

* Get Custom Serializer

*/

public static org.apache.axis.encoding.Serializer getSerializer(

java.lang.String mechType, 

java.lang.Class _javaType, 

javax.xml.namespace.QName _xmlType) {

return 

new org.apache.axis.encoding.ser.BeanSerializer(

_javaType, _xmlType, typeDesc);

}

/**

* Get Custom Deserializer

*/

public static org.apache.axis.encoding.Deserializer getDeserializer(

java.lang.String mechType, 

java.lang.Class _javaType, 

javax.xml.namespace.QName _xmlType) {

return 

new org.apache.axis.encoding.ser.BeanDeserializer(

_javaType, _xmlType, typeDesc);

}

------------------------------------------------------------

This e-mail may be privileged and/or confidential, and the sender does not waive any related
rights and obligations. Any distribution, use or copying of this e-mail or the information
it contains by other than an intended recipient is unauthorized. If you received this e-mail
in error, please advise me (by return e-mail or otherwise) immediately. 

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux
droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message
ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s)
est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser
immédiatement, par retour de courrier électronique ou par un autre moyen.

============================================================



------------------------------------------------------------

This e-mail may be privileged and/or confidential, and the sender does not waive any related
rights and obligations. Any distribution, use or copying of this e-mail or the information
it contains by other than an intended recipient is unauthorized. If you received this e-mail
in error, please advise me (by return e-mail or otherwise) immediately. 

Ce courrier électronique est confidentiel et protégé. L'expéditeur ne renonce pas aux
droits et obligations qui s'y rapportent. Toute diffusion, utilisation ou copie de ce message
ou des renseignements qu'il contient par une personne autre que le (les) destinataire(s) désigné(s)
est interdite. Si vous recevez ce courrier électronique par erreur, veuillez m'en aviser
immédiatement, par retour de courrier électronique ou par un autre moyen.

============================================================

Mime
View raw message