You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by di...@apache.org on 2006/04/24 18:28:34 UTC

svn commit: r396600 - /webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl

Author: dims
Date: Mon Apr 24 09:28:31 2006
New Revision: 396600

URL: http://svn.apache.org/viewcvs?rev=396600&view=rev
Log:
- Get the simplest client working with JAXB binding.

Notes:
To test run w2j on the version service's wsdl ("java org.apache.axis2.wsdl.WSDL2Java -o jaxme_binding -d jaxme -uri version.wsdl") and then use the following snippet.

import org.apache.axis2.VersionStub;
import axis2.apache.org.xsd.GetVersion;
import axis2.apache.org.xsd.ObjectFactory;
import axis2.apache.org.xsd.GetVersionResponse;

public class Main {
    public static void main(String[] args) throws Exception {
        VersionStub stub = new VersionStub();
        ObjectFactory factory = new ObjectFactory();
        GetVersion request = factory.createGetVersion();
        GetVersionResponse response = stub.getVersion(request);
        System.out.println(response.getReturn());
    }
}



Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl?rev=396600&r1=396599&r2=396600&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/DatabindingTemplate.xsl Mon Apr 24 09:28:31 2006
@@ -106,7 +106,7 @@
 
         private org.apache.axiom.om.OMElement toOM(Object param) {
             try {
-                javax.xml.bind.JAXBContext ctx = javax.xml.bind.JAXBContext.newInstance(param.getClass().getPackage()
+                javax.xml.bind.JAXBContext ctx = javax.xml.bind.JAXBContext.newInstance(param.getClass().getInterfaces()[0].getPackage()
                                                                                             .getName());
                 org.apache.axiom.om.impl.builder.SAXOMBuilder builder = new org.apache.axiom.om.impl.builder.SAXOMBuilder();
                 javax.xml.bind.Marshaller marshaller = ctx.createMarshaller();
@@ -131,7 +131,7 @@
         java.lang.Class type){
             try{
                 javax.xml.transform.Source source =
-                        new javanet.staxutils.StAXSource(param.getXMLStreamReaderWithoutCaching());
+                        new javanet.staxutils.StAXSource(param.getXMLStreamReader());
                 javax.xml.bind.JAXBContext ctx = javax.xml.bind.JAXBContext.newInstance(
                         type.getPackage().getName());
                 javax.xml.bind.Unmarshaller u = ctx.createUnmarshaller();