Using axis2 0.9's WSDL2Java tool on my .wsdl file produced a DatabindingSupporter.java class with a bunch of duplicate methods (example, two toOM methods) and calls and thus won't compile. Any idea on what I'm doing wrong?
My .wsdl file is produced below followed by the generated .java file created: <?xml version="1.0" encoding="UTF-8"?> <definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:tr="http://www.someco.com/eap/transactions" xmlns:trxsd="http://www.someco.com/eap/transactions.xsd" targetNamespace="http://www.someco.com/eap/transactions"> <types> <xs:schema targetNamespace="http://www.someco.com/eap/transactions"> <xs:complexType name="LoginRequest"> <xs:attribute name="username" type="xs:string" use="required"/> <xs:attribute name="password" type="xs:string" use="required"/> </xs:complexType> <xs:complexType name="LoginResponse"> <xs:attribute name="sessionId" type="xs:string" use="required"/> </xs:complexType> </xs:schema> </types> <message name="LoginRequest"> <part name="parameter" type="tr:LoginRequest"/> </message> <message name="LoginResponse"> <part name="parameter" type="tr:LoginResponse"/> </message> <portType name="EAPTransaction"> <operation name="Login"> <input name="LoginRequest" message="tr:LoginRequest"/> <output name="LoginResponse" message="tr:LoginResponse"/> </operation> </portType> <binding name="TransactionBinding" type="tr:EAPTransaction"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="Login"> <soap:operation soapAction="urn:#Login"/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="EAPTransactions"> <port name="Transaction" binding="tr:TransactionBinding"> <soap:address location="No Target Adress"/> </port> </service> </definitions> Generated code: package com.efi.eap.server.transactions.databinding; /** * Auto generated supporter class for XML beans by the Axis code generator */ public class LoginDatabindingSupporter { public static org.apache.axis2.om.OMElement toOM(org.apache.axis2.om.OMElement param){ org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory.createStAXOMBuilder (org.apache.axis2.om.OMAbstractFactory.getOMFactory(),new org.apache.axis2.clientapi.StreamWrapper(param.newXMLStreamReader())) ; org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); //Building the element is needed to avoid certain stream errors! documentElement.build(); return documentElement; } public static org.apache.axis2.om.OMElement toOM(org.apache.axis2.om.OMElement param){ org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = org.apache.axis2.om.impl.llom.factory.OMXMLBuilderFactory.createStAXOMBuilder (org.apache.axis2.om.OMAbstractFactory.getOMFactory(),new org.apache.axis2.clientapi.StreamWrapper(param.newXMLStreamReader())) ; org.apache.axis2.om.OMElement documentElement = builder.getDocumentElement(); //Building the element is needed to avoid certain stream errors! documentElement.build(); return documentElement; } public static org.apache.xmlbeans.XmlObject fromOM(org.apache.axis2.om.OMElement param, java.lang.Class type){ try{ if (org.apache.axis2.om.OMElement.class.equals(type)){ return org.apache.axis2.om.OMElement.Factory.parse(param.getXMLStreamReader()) ; } if (org.apache.axis2.om.OMElement.class.equals(type)){ return org.apache.axis2.om.OMElement.Factory.parse(param.getXMLStreamReader()) ; } }catch(java.lang.Exception e){ throw new RuntimeException("Data binding error",e); } return null; } //Generates an empty object for testing // Caution - need some manual editing to work properly public static org.apache.xmlbeans.XmlObject getTestObject(java.lang.Class type){ try{ if (org.apache.axis2.om.OMElement.class.equals(type)){ org.apache.axis2.om.OMElement emptyObject= org.apache.axis2.om.OMElement.Factory.newInstance(); //////////////////////////////////////////////// // TODO // Fill in the empty object with necessaey values. Empty XMLBeans objects do not generate proper events //////////////////////////////////////////////// return emptyObject; } if (org.apache.axis2.om.OMElement.class.equals(type)){ org.apache.axis2.om.OMElement emptyObject= org.apache.axis2.om.OMElement.Factory.newInstance(); //////////////////////////////////////////////// // TODO // Fill in the empty object with necessaey values. Empty XMLBeans objects do not generate proper events //////////////////////////////////////////////// return emptyObject; } }catch(java.lang.Exception e){ throw new RuntimeException("Test object creation failure",e); } return null; } }
