Hi, I generated with wsdl2java jaxbri Client Stub.

I use:
- Axis2 1.6.1
- axis2-jaxbri 1.5.4


fromOm Method cannot read the OMElement and return value=null.

private java.lang.Object fromOM (
            org.apache.axiom.om.OMElement param,
            java.lang.Class type,
java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{
            try {
                javax.xml.bind.JAXBContext context = wsContext;
javax.xml.bind.Unmarshaller unmarshaller = context.createUnmarshaller();

return unmarshaller.unmarshal(param.getXMLStreamReaderWithoutCaching(), type).getValue();
            } catch (javax.xml.bind.JAXBException bex){
                throw org.apache.axis2.AxisFault.makeFault(bex);
            }
        }

the parameters for example are:

param :
<ns:getPriceResponse xmlns:ns="http://quickstart.samples/xsd";><ns:return><ns:return>43.0</ns:return></ns:return></ns:getPriceResponse>

type:
samples.quickstart.xsd.GetPriceResponse.class

extraNamespaces:
soapenv=http://www.w3.org/2003/05/soap-envelope


result: samples.quickstart.xsd.GetPriceResponse intance with value=null

Can I repair this Method

Thanks


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

here is whole Client Stub

//
///**
// * StockQuoteServiceStub.java
// *
// * This file was auto-generated from WSDL
// * by the Apache Axis2 version: 1.6.1 Built on : Aug 31, 2011 (12:22:40 CEST)
// */
       package stub;



        /*
        *  StockQuoteServiceStub java implementation
        */


public class StockQuoteServiceStub extends org.apache.axis2.client.Stub
        {
protected org.apache.axis2.description.AxisOperation[] _operations;

        //hashmaps to keep the fault mapping
private java.util.HashMap faultExceptionNameMap = new java.util.HashMap(); private java.util.HashMap faultExceptionClassNameMap = new java.util.HashMap(); private java.util.HashMap faultMessageMap = new java.util.HashMap();

        private static int counter = 0;

        private static synchronized java.lang.String getUniqueSuffix(){
            // reset the counter if it is greater than 99999
            if (counter > 99999){
                counter = 0;
            }
            counter = counter + 1;
return java.lang.Long.toString(java.lang.System.currentTimeMillis()) + "_" + counter;
        }


    private void populateAxisService() throws org.apache.axis2.AxisFault {

     //creating the Service with a unique name
_service = new org.apache.axis2.description.AxisService("StockQuoteService" + getUniqueSuffix());
     addAnonymousOperations();

        //creating the operations
        org.apache.axis2.description.AxisOperation __operation;

        _operations = new org.apache.axis2.description.AxisOperation[2];

__operation = new org.apache.axis2.description.OutInAxisOperation();


__operation.setName(new javax.xml.namespace.QName("http://quickstart.samples/xsd";, "getPrice"));
        _service.addOperation(__operation);




            _operations[0]=__operation;


__operation = new org.apache.axis2.description.OutOnlyAxisOperation();


__operation.setName(new javax.xml.namespace.QName("http://quickstart.samples/xsd";, "update"));
        _service.addOperation(__operation);




            _operations[1]=__operation;


        }

    //populates the faults
    private void populateFaults(){



    }

    /**
      *Constructor that takes in a configContext
      */

public StockQuoteServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext,
       java.lang.String targetEndpoint)
       throws org.apache.axis2.AxisFault {
         this(configurationContext,targetEndpoint,false);
   }


   /**
     * Constructor that takes in a configContext  and useseperate listner
     */
public StockQuoteServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext,
        java.lang.String targetEndpoint, boolean useSeparateListener)
        throws org.apache.axis2.AxisFault {
         //To populate AxisService
         populateAxisService();
         populateFaults();

_serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);


_serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(
                targetEndpoint));
_serviceClient.getOptions().setUseSeparateListener(useSeparateListener);

            //Set the soap version
_serviceClient.getOptions().setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI);


    }

    /**
     * Default Constructor
     */
public StockQuoteServiceStub(org.apache.axis2.context.ConfigurationContext configurationContext) throws org.apache.axis2.AxisFault {

this(configurationContext,"http://localhost:8080/axis2/services/StockQuoteService.StockQuoteServiceSOAP12port/"; );

    }

    /**
     * Default Constructor
     */
    public StockQuoteServiceStub() throws org.apache.axis2.AxisFault {

this("http://localhost:8080/axis2/services/StockQuoteService.StockQuoteServiceSOAP12port/"; );

    }

    /**
     * Constructor taking the target endpoint
     */
public StockQuoteServiceStub(java.lang.String targetEndpoint) throws org.apache.axis2.AxisFault {
        this(null,targetEndpoint);
    }




                    /**
                     * Auto generated method signature
                     *
                     * @see stub.StockQuoteService#getPrice
                     * @param getPrice0

                     */



public samples.quickstart.xsd.GetPriceResponse getPrice(

                            samples.quickstart.xsd.GetPrice getPrice0)


                    throws java.rmi.RemoteException

                    {
org.apache.axis2.context.MessageContext _messageContext = null;
              try{
org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
              _operationClient.getOptions().setAction("urn:getPrice");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);



addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");


              // create a message context
_messageContext = new org.apache.axis2.context.MessageContext();



              // create SOAP envelope with that payload
              org.apache.axiom.soap.SOAPEnvelope env = null;


env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                    getPrice0,
optimizeContent(new javax.xml.namespace.QName("http://quickstart.samples/xsd";, "tns")), new javax.xml.namespace.QName("http://quickstart.samples/xsd";,
                                                    "tns"));


        //adding SOAP soap_headers
         _serviceClient.addHeadersToEnvelope(env);


        // set the message context with that soap envelope
        _messageContext.setEnvelope(env);

        // add the message contxt to the operation client
        _operationClient.addMessageContext(_messageContext);

        //execute the operation client
        _operationClient.execute(true);


org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext( org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE); org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();

System.out.println("_returnEnv.getBody()" + _returnEnv.getBody().getFirstElement());

                                java.lang.Object object = fromOM(
_returnEnv.getBody().getFirstElement() , samples.quickstart.xsd.GetPriceResponse.class, getEnvelopeNamespaces(_returnEnv));


return (samples.quickstart.xsd.GetPriceResponse)object;

         }catch(org.apache.axis2.AxisFault f){

            org.apache.axiom.om.OMElement faultElt = f.getDetail();
            if (faultElt!=null){
if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getPrice"))){
                    //make the fault by reflection
                    try{
java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getPrice")); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
                        //message class
java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getPrice")); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,messageClass,null); java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage",
                                   new java.lang.Class[]{messageClass});
m.invoke(ex,new java.lang.Object[]{messageObject});


throw new java.rmi.RemoteException(ex.getMessage(), ex);
                    }catch(java.lang.ClassCastException e){
// we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    } catch (java.lang.ClassNotFoundException e) {
// we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    }catch (java.lang.NoSuchMethodException e) {
// we cannot intantiate the class - throw the original Axis fault
                        throw f;
} catch (java.lang.reflect.InvocationTargetException e) { // we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    }  catch (java.lang.IllegalAccessException e) {
// we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    }   catch (java.lang.InstantiationException e) {
// we cannot intantiate the class - throw the original Axis fault
                        throw f;
                    }
                }else{
                    throw f;
                }
            }else{
                throw f;
            }
            } finally {
                if (_messageContext.getTransportOut() != null) {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
                }
            }
        }

                /**
* Auto generated method signature for Asynchronous Invocations
                *
                * @see stub.StockQuoteService#startgetPrice
                    * @param getPrice0

                */
                public  void startgetPrice(

                 samples.quickstart.xsd.GetPrice getPrice0,

                  final  StockQuoteServiceCallbackHandler callback)

                throws java.rmi.RemoteException{

org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
             _operationClient.getOptions().setAction("urn:getPrice");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);



addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");



              // create SOAP envelope with that payload
              org.apache.axiom.soap.SOAPEnvelope env=null;
final org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext();


                                    //Style is Doc.


env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                    getPrice0,
optimizeContent(new javax.xml.namespace.QName("http://quickstart.samples/";, "getPrice")), new javax.xml.namespace.QName("http://quickstart.samples/";,
                                                    "getPrice"));

        // adding SOAP soap_headers
         _serviceClient.addHeadersToEnvelope(env);
        // create message context with that soap envelope
        _messageContext.setEnvelope(env);

        // add the message context to the operation client
        _operationClient.addMessageContext(_messageContext);



_operationClient.setCallback(new org.apache.axis2.client.async.AxisCallback() { public void onMessage(org.apache.axis2.context.MessageContext resultContext) {
                            try {
org.apache.axiom.soap.SOAPEnvelope resultEnv = resultContext.getEnvelope();

java.lang.Object object = fromOM(resultEnv.getBody().getFirstElement(),
                                                                         
samples.quickstart.xsd.GetPriceResponse.class,
                                                                         
getEnvelopeNamespaces(resultEnv));
                                        callback.receiveResultgetPrice(
(samples.quickstart.xsd.GetPriceResponse)object);

                            } catch (org.apache.axis2.AxisFault e) {
                                callback.receiveErrorgetPrice(e);
                            }
                            }

public void onError(java.lang.Exception error) { if (error instanceof org.apache.axis2.AxisFault) { org.apache.axis2.AxisFault f = (org.apache.axis2.AxisFault) error; org.apache.axiom.om.OMElement faultElt = f.getDetail();
                                    if (faultElt!=null){
if (faultExceptionNameMap.containsKey(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getPrice"))){
                                            //make the fault by reflection
                                            try{
java.lang.String exceptionClassName = (java.lang.String)faultExceptionClassNameMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getPrice")); java.lang.Class exceptionClass = java.lang.Class.forName(exceptionClassName); java.lang.Exception ex = (java.lang.Exception) exceptionClass.newInstance();
                                                    //message class
java.lang.String messageClassName = (java.lang.String)faultMessageMap.get(new org.apache.axis2.client.FaultMapKey(faultElt.getQName(),"getPrice")); java.lang.Class messageClass = java.lang.Class.forName(messageClassName); java.lang.Object messageObject = fromOM(faultElt,messageClass,null); java.lang.reflect.Method m = exceptionClass.getMethod("setFaultMessage", new java.lang.Class[]{messageClass}); m.invoke(ex,new java.lang.Object[]{messageObject});


callback.receiveErrorgetPrice(new java.rmi.RemoteException(ex.getMessage(), ex)); } catch(java.lang.ClassCastException e){ // we cannot intantiate the class - throw the original Axis fault callback.receiveErrorgetPrice(f); } catch (java.lang.ClassNotFoundException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveErrorgetPrice(f); } catch (java.lang.NoSuchMethodException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveErrorgetPrice(f); } catch (java.lang.reflect.InvocationTargetException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveErrorgetPrice(f); } catch (java.lang.IllegalAccessException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveErrorgetPrice(f); } catch (java.lang.InstantiationException e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveErrorgetPrice(f); } catch (org.apache.axis2.AxisFault e) { // we cannot intantiate the class - throw the original Axis fault callback.receiveErrorgetPrice(f);
                                            }
                                        } else {
callback.receiveErrorgetPrice(f);
                                        }
                                    } else {
                                        callback.receiveErrorgetPrice(f);
                                    }
                                } else {
                                    callback.receiveErrorgetPrice(error);
                                }
                            }

public void onFault(org.apache.axis2.context.MessageContext faultContext) { org.apache.axis2.AxisFault fault = org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(faultContext);
                                onError(fault);
                            }

                            public void onComplete() {
                                try {
_messageContext.getTransportOut().getSender().cleanup(_messageContext); } catch (org.apache.axis2.AxisFault axisFault) { callback.receiveErrorgetPrice(axisFault);
                                }
                            }
                });


          org.apache.axis2.util.CallbackReceiver _callbackReceiver = null;
if ( _operations[0].getMessageReceiver()==null && _operationClient.getOptions().isUseSeparateListener()) { _callbackReceiver = new org.apache.axis2.util.CallbackReceiver();
          _operations[0].setMessageReceiver(
                    _callbackReceiver);
        }

           //execute the operation client
           _operationClient.execute(false);

                    }


                /**
                  * Auto generated method signature
                  *
                  */
                public void  update(
                 samples.quickstart.xsd.Update update2

                ) throws java.rmi.RemoteException


                {
org.apache.axis2.context.MessageContext _messageContext = null;


org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[1].getName());
                _operationClient.getOptions().setAction("urn:update");
_operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);



addPropertyToOperationClient(_operationClient,org.apache.axis2.description.WSDL2Constants.ATTR_WHTTP_QUERY_PARAMETER_SEPARATOR,"&");

                org.apache.axiom.soap.SOAPEnvelope env = null;
_messageContext = new org.apache.axis2.context.MessageContext();


                                                    //Style is Doc.


env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), update2, optimizeContent(new javax.xml.namespace.QName("http://quickstart.samples/";, "update")),new javax.xml.namespace.QName("http://quickstart.samples/";, "update"));


              //adding SOAP soap_headers
         _serviceClient.addHeadersToEnvelope(env);
                // create message context with that soap envelope

            _messageContext.setEnvelope(env);

            // add the message contxt to the operation client
            _operationClient.addMessageContext(_messageContext);

             _operationClient.execute(true);


              if (_messageContext.getTransportOut() != null) {
_messageContext.getTransportOut().getSender().cleanup(_messageContext);
              }

             return;
           }



       /**
* A utility method that copies the namepaces from the SOAPEnvelope
        */
private java.util.Map getEnvelopeNamespaces(org.apache.axiom.soap.SOAPEnvelope env){
        java.util.Map returnMap = new java.util.HashMap();
java.util.Iterator namespaceIterator = env.getAllDeclaredNamespaces();
        while (namespaceIterator.hasNext()) {
org.apache.axiom.om.OMNamespace ns = (org.apache.axiom.om.OMNamespace) namespaceIterator.next();
            returnMap.put(ns.getPrefix(),ns.getNamespaceURI());
        }
       return returnMap;
    }



    private javax.xml.namespace.QName[] opNameArray = null;
    private boolean optimizeContent(javax.xml.namespace.QName opName) {


        if (opNameArray == null) {
            return false;
        }
        for (int i = 0; i < opNameArray.length; i++) {
            if (opName.equals(opNameArray[i])) {
                return true;
            }
        }
        return false;
    }
//http://localhost:8080/axis2/services/StockQuoteService.StockQuoteServiceSOAP12port/

        private static final javax.xml.bind.JAXBContext wsContext;
        static {
            javax.xml.bind.JAXBContext jc;
            jc = null;
            try {
                jc = javax.xml.bind.JAXBContext.newInstance(
            samples.quickstart.xsd.GetPrice.class,
                        samples.quickstart.xsd.GetPriceResponse.class,
                        samples.quickstart.xsd.Update.class
                );
            }
            catch ( javax.xml.bind.JAXBException ex ) {
System.err.println("Unable to create JAXBContext: " + ex.getMessage());
                ex.printStackTrace(System.err);
                Runtime.getRuntime().exit(-1);
            }
            finally {
                wsContext = jc;
            }
        }



private org.apache.axiom.om.OMElement toOM(samples.quickstart.xsd.GetPrice param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
                throws org.apache.axis2.AxisFault {
                    try {
                        javax.xml.bind.JAXBContext context = wsContext;
javax.xml.bind.Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);

org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();

JaxbRIDataSource source = new JaxbRIDataSource( samples.quickstart.xsd.GetPrice.class, param, marshaller, methodQName.getNamespaceURI(), methodQName.getLocalPart()); org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace(methodQName.getNamespaceURI(),
                                                                           
null);
return factory.createOMElement(source, methodQName.getLocalPart(), namespace);
                    } catch (javax.xml.bind.JAXBException bex){
                        throw org.apache.axis2.AxisFault.makeFault(bex);
                    }
                }

private org.apache.axiom.om.OMElement toOM(samples.quickstart.xsd.GetPrice param, boolean optimizeContent)
                    throws org.apache.axis2.AxisFault {
                        try {
javax.xml.bind.JAXBContext context = wsContext; javax.xml.bind.Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);

org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();

JaxbRIDataSource source = new JaxbRIDataSource( samples.quickstart.xsd.GetPrice.class,
                                                                            
param,
                                                                            
marshaller,
"http://quickstart.samples/xsd";,
                                                                            
"getPrice");
org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("http://quickstart.samples/xsd";, null); return factory.createOMElement(source, "getPrice", namespace);
                        } catch (javax.xml.bind.JAXBException bex){
throw org.apache.axis2.AxisFault.makeFault(bex);
                        }
                    }

private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, samples.quickstart.xsd.GetPrice param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
                throws org.apache.axis2.AxisFault {
org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope(); envelope.getBody().addChild(toOM(param, optimizeContent, methodQName));
                    return envelope;
                }



private org.apache.axiom.om.OMElement toOM(samples.quickstart.xsd.GetPriceResponse param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
                throws org.apache.axis2.AxisFault {
                    try {
                        javax.xml.bind.JAXBContext context = wsContext;
javax.xml.bind.Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);

org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();

JaxbRIDataSource source = new JaxbRIDataSource( samples.quickstart.xsd.GetPriceResponse.class, param, marshaller, methodQName.getNamespaceURI(), methodQName.getLocalPart()); org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace(methodQName.getNamespaceURI(),
                                                                           
null);
return factory.createOMElement(source, methodQName.getLocalPart(), namespace);
                    } catch (javax.xml.bind.JAXBException bex){
                        throw org.apache.axis2.AxisFault.makeFault(bex);
                    }
                }

private org.apache.axiom.om.OMElement toOM(samples.quickstart.xsd.GetPriceResponse param, boolean optimizeContent)
                    throws org.apache.axis2.AxisFault {
                        try {
javax.xml.bind.JAXBContext context = wsContext; javax.xml.bind.Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);

org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();

JaxbRIDataSource source = new JaxbRIDataSource( samples.quickstart.xsd.GetPriceResponse.class,
                                                                            
param,
                                                                            
marshaller,
"http://quickstart.samples/xsd";,
                                                                            
"getPriceResponse");
org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("http://quickstart.samples/xsd";, null); return factory.createOMElement(source, "getPriceResponse", namespace);
                        } catch (javax.xml.bind.JAXBException bex){
throw org.apache.axis2.AxisFault.makeFault(bex);
                        }
                    }

private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, samples.quickstart.xsd.GetPriceResponse param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
                throws org.apache.axis2.AxisFault {
org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope(); envelope.getBody().addChild(toOM(param, optimizeContent, methodQName));
                    return envelope;
                }



private org.apache.axiom.om.OMElement toOM(samples.quickstart.xsd.Update param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
                throws org.apache.axis2.AxisFault {
                    try {
                        javax.xml.bind.JAXBContext context = wsContext;
javax.xml.bind.Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);

org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();

JaxbRIDataSource source = new JaxbRIDataSource( samples.quickstart.xsd.Update.class, param, marshaller, methodQName.getNamespaceURI(), methodQName.getLocalPart()); org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace(methodQName.getNamespaceURI(),
                                                                           
null);
return factory.createOMElement(source, methodQName.getLocalPart(), namespace);
                    } catch (javax.xml.bind.JAXBException bex){
                        throw org.apache.axis2.AxisFault.makeFault(bex);
                    }
                }

private org.apache.axiom.om.OMElement toOM(samples.quickstart.xsd.Update param, boolean optimizeContent)
                    throws org.apache.axis2.AxisFault {
                        try {
javax.xml.bind.JAXBContext context = wsContext; javax.xml.bind.Marshaller marshaller = context.createMarshaller(); marshaller.setProperty(javax.xml.bind.Marshaller.JAXB_FRAGMENT, Boolean.TRUE);

org.apache.axiom.om.OMFactory factory = org.apache.axiom.om.OMAbstractFactory.getOMFactory();

JaxbRIDataSource source = new JaxbRIDataSource( samples.quickstart.xsd.Update.class,
                                                                            
param,
                                                                            
marshaller,
"http://quickstart.samples/xsd";,
                                                                            
"update");
org.apache.axiom.om.OMNamespace namespace = factory.createOMNamespace("http://quickstart.samples/xsd";, null); return factory.createOMElement(source, "update", namespace);
                        } catch (javax.xml.bind.JAXBException bex){
throw org.apache.axis2.AxisFault.makeFault(bex);
                        }
                    }

private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory, samples.quickstart.xsd.Update param, boolean optimizeContent, javax.xml.namespace.QName methodQName)
                throws org.apache.axis2.AxisFault {
org.apache.axiom.soap.SOAPEnvelope envelope = factory.getDefaultEnvelope(); envelope.getBody().addChild(toOM(param, optimizeContent, methodQName));
                    return envelope;
                }



        /**
        *  get the default envelope
        */
private org.apache.axiom.soap.SOAPEnvelope toEnvelope(org.apache.axiom.soap.SOAPFactory factory) {
            return factory.getDefaultEnvelope();
        }

        private java.lang.Object fromOM (
            org.apache.axiom.om.OMElement param,
            java.lang.Class type,
java.util.Map extraNamespaces) throws org.apache.axis2.AxisFault{
            try {
                javax.xml.bind.JAXBContext context = wsContext;
javax.xml.bind.Unmarshaller unmarshaller = context.createUnmarshaller();

                System.out.println("param" + param);
System.out.println("param.getFirstElement()"+param.getFirstElement() );

System.out.println("param.getXMLStreamReaderWithoutCaching()" + param.getXMLStreamReaderWithoutCaching()); System.out.println("unmarshaller.unmarshal(param.getXMLStreamReaderWithoutCaching(), type)" + unmarshaller.unmarshal(param.getXMLStreamReaderWithoutCaching(), type)); System.out.println("unmarshaller.unmarshal(param.getXMLStreamReaderWithoutCaching(), type).getValue()" + unmarshaller.unmarshal(param.getXMLStreamReader(), type).getValue()); return unmarshaller.unmarshal(param.getXMLStreamReaderWithoutCaching(), type).getValue();
            } catch (javax.xml.bind.JAXBException bex){
                throw org.apache.axis2.AxisFault.makeFault(bex);
            }
        }

class JaxbRIDataSource implements org.apache.axiom.om.OMDataSource {
            /**
             * Bound object for output.
             */
            private final Object outObject;

            /**
             * Bound class for output.
             */
            private final Class outClazz;

            /**
             * Marshaller.
             */
            private final javax.xml.bind.Marshaller marshaller;

            /**
             * Namespace
             */
            private String nsuri;

            /**
             * Local name
             */
            private String name;

            /**
             * Constructor from object and marshaller.
             *
             * @param obj
             * @param marshaller
             */
public JaxbRIDataSource(Class clazz, Object obj, javax.xml.bind.Marshaller marshaller, String nsuri, String name) {
                this.outClazz = clazz;
                this.outObject = obj;
                this.marshaller = marshaller;
                this.nsuri = nsuri;
                this.name = name;
            }

public void serialize(java.io.OutputStream output, org.apache.axiom.om.OMOutputFormat format) throws javax.xml.stream.XMLStreamException {
                try {
                    marshaller.marshal(new javax.xml.bind.JAXBElement(
new javax.xml.namespace.QName(nsuri, name), outObject.getClass(), outObject), output);
                } catch (javax.xml.bind.JAXBException e) {
throw new javax.xml.stream.XMLStreamException("Error in JAXB marshalling", e);
                }
            }

public void serialize(java.io.Writer writer, org.apache.axiom.om.OMOutputFormat format) throws javax.xml.stream.XMLStreamException {
                try {
                    marshaller.marshal(new javax.xml.bind.JAXBElement(
new javax.xml.namespace.QName(nsuri, name), outObject.getClass(), outObject), writer);
                } catch (javax.xml.bind.JAXBException e) {
throw new javax.xml.stream.XMLStreamException("Error in JAXB marshalling", e);
                }
            }

public void serialize(javax.xml.stream.XMLStreamWriter xmlWriter) throws javax.xml.stream.XMLStreamException {
                try {
                    marshaller.marshal(new javax.xml.bind.JAXBElement(
new javax.xml.namespace.QName(nsuri, name), outObject.getClass(), outObject), xmlWriter);
                } catch (javax.xml.bind.JAXBException e) {
throw new javax.xml.stream.XMLStreamException("Error in JAXB marshalling", e);
                }
            }

public javax.xml.stream.XMLStreamReader getReader() throws javax.xml.stream.XMLStreamException {
                try {
                    javax.xml.bind.JAXBContext context = wsContext;
org.apache.axiom.om.impl.builder.SAXOMBuilder builder = new org.apache.axiom.om.impl.builder.SAXOMBuilder(); javax.xml.bind.Marshaller marshaller = context.createMarshaller();
                    marshaller.marshal(new javax.xml.bind.JAXBElement(
new javax.xml.namespace.QName(nsuri, name), outObject.getClass(), outObject), builder);

                    return builder.getRootElement().getXMLStreamReader();
                } catch (javax.xml.bind.JAXBException e) {
throw new javax.xml.stream.XMLStreamException("Error in JAXB marshalling", e);
                }
            }
        }


   }


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscr...@axis.apache.org
For additional commands, e-mail: java-user-h...@axis.apache.org

Reply via email to