Return-Path: Delivered-To: apmail-ws-axis-user-archive@www.apache.org Received: (qmail 14699 invoked from network); 6 Nov 2006 14:36:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 6 Nov 2006 14:36:38 -0000 Received: (qmail 64678 invoked by uid 500); 6 Nov 2006 14:36:35 -0000 Delivered-To: apmail-ws-axis-user-archive@ws.apache.org Received: (qmail 64670 invoked by uid 500); 6 Nov 2006 14:36:35 -0000 Mailing-List: contact axis-user-help@ws.apache.org; run by ezmlm Precedence: bulk Reply-To: axis-user@ws.apache.org list-help: list-unsubscribe: List-Post: List-Id: Delivered-To: mailing list axis-user@ws.apache.org Received: (qmail 64659 invoked by uid 99); 6 Nov 2006 14:36:35 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 06 Nov 2006 06:36:35 -0800 X-ASF-Spam-Status: No, hits=2.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,HTML_MESSAGE X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [68.142.236.104] (HELO web57911.mail.re3.yahoo.com) (68.142.236.104) by apache.org (qpsmtpd/0.29) with SMTP; Mon, 06 Nov 2006 06:36:19 -0800 Received: (qmail 95139 invoked by uid 60001); 6 Nov 2006 14:35:57 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.ca; h=Message-ID:Received:Date:From:Subject:To:In-Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=CRBH4ohYIP2d+C1rMeblwb3kBiG8pegaDMJN9dIoqyM4mWK4iPvVxUPojr/tLrBkgbbd6Led1j7ZaoxG/mLzllZM2fR8wKko7QcFbk8NHajZje6PG80Sc0RWnQkUjlRFPl9oaAe/qvnD+G+0olnJrXuaOAWSAjdgigqxdoyahAI= ; Message-ID: <20061106143557.95137.qmail@web57911.mail.re3.yahoo.com> Received: from [202.154.255.1] by web57911.mail.re3.yahoo.com via HTTP; Mon, 06 Nov 2006 09:35:57 EST Date: Mon, 6 Nov 2006 09:35:57 -0500 (EST) From: Moiz Ghori Subject: Re: MTOM issues on different Axis version To: axis-user@ws.apache.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-1771695331-1162823757=:94342" Content-Transfer-Encoding: 8bit X-Virus-Checked: Checked by ClamAV on apache.org --0-1771695331-1162823757=:94342 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit I am using Axis2_1.1 but still I am having same problem and I am using the same versions to generate and compile the code. Can you please give me the URLs of the WAR and binary files. Thanks Moiz Thilina Gunarathne wrote: ouch.. Hit the send button too fast...:( Please use the Axis2-1.1-RC2 [1].. Also please use the same version to generate code too.. You seem to be using diffrent versions to generate code and then to compile and run them... ~Thilina > > On 11/4/06, Moiz Ghori wrote: > > Thanks for your reply. > > > > I am generating code from WSDLToJava. First there were some compile time > > errors of converttoString, convertofloat etc which got fixed easily with the > > help of Eclipse IDE. > > But there is also a complile time error in the Stub saying > > getElement(SOAPEnvelope,String) is not defined in > > OnlineBooksADBImageServiceStub. > > I am using Axis2_1.0 snapshot. > > > > > > > > /** > > * OnlineBooksADBImageServiceStub.java > > * > > * This file was auto-generated from WSDL > > * by the Apache Axis2 version: 1.0 May 05, 2006 (12:31:13 IST) > > */ > > package org.apache.axis2; > > > > /* > > * OnlineBooksADBImageServiceStub java implementation > > */ > > > > public class OnlineBooksADBImageServiceStub extends > > org.apache.axis2.client.Stub > > { > > //default axis home being null forces the system to pick up the mars > > from the axis2 library > > public static final java.lang.String AXIS2_HOME = null; > > protected static > > org.apache.axis2.description.AxisOperation[] _operations; > > //hashmaps to keep the fault mapping > > private java.util.HashMap faultExeptionNameMap = new > > java.util.HashMap(); > > private java.util.HashMap faultExeptionClassNameMap = new > > java.util.HashMap(); > > private java.util.HashMap faultMessageMap = new java.util.HashMap(); > > > > private void populateAxisService(){ > > //creating the Service > > _service = new > > org.apache.axis2.description.AxisService("OnlineBooksADBImageService"); > > > > //creating the operations > > org.apache.axis2.description.AxisOperation > > __operation; > > > > > > _operations = new > > org.apache.axis2.description.AxisOperation[1]; > > > > __operation = new > > org.apache.axis2.description.OutInAxisOperation(); > > > > __operation.setName(new javax.xml.namespace.QName("", > > "FindBooks")); > > > > _operations[0]=__operation; > > _service.addOperation(__operation); > > > > } > > //populates the faults > > private void populateFaults(){ > > > > > > } > > public > > OnlineBooksADBImageServiceStub(org.apache.axis2.context.ConfigurationContext > > configurationContext, > > java.lang.String targetEndpoint) > > throws java.lang.Exception { > > //To populate AxisService > > populateAxisService(); > > populateFaults(); > > > > > > _serviceClient = new > > org.apache.axis2.client.ServiceClient(configurationContext,_service); > > _serviceClient.getOptions().setTo(new > > org.apache.axis2.addressing.EndpointReference( > > targetEndpoint)); > > > > } > > /** > > * Default Constructor > > */ > > public OnlineBooksADBImageServiceStub() throws > > java.lang.Exception { > > > > > > this("http://localhost/axis2/services/OnlineBooksADBImageService" > > ); > > > > } > > /** > > * Constructor taking the target endpoint > > */ > > public OnlineBooksADBImageServiceStub(java.lang.String targetEndpoint) > > throws java.lang.Exception { > > > > this(org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_HOME,null), > > targetEndpoint); > > } > > > > > > /** > > * Auto generated method signature > > * @see > > org.apache.axis2.OnlineBooksADBImageService#FindBooks > > * @param param12 > > > > */ > > public > > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse > > FindBooks( > > > > com.example.www.onlinebooksadbimage.xsd.FindBooksRequest > > param12) > > throws java.rmi.RemoteException > > > > { > > try{ > > org.apache.axis2.client.OperationClient > > _operationClient = > > _serviceClient.createClient(_operations[0].getName()); > > > > _operationClient.getOptions().setAction("http://www.example.com/OnlineBooksADBImage/FindBooks"); > > > > _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); > > > > // create SOAP envelope with that payload > > org.apache.axiom.soap.SOAPEnvelope env = > > null; > > > > //Style is Doc. > > > > > > env = > > toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), > > param12, > > > > optimizeContent(new javax.xml.namespace.QName("", > > > > "FindBooks"))); > > > > // create message context with that soap envelope > > org.apache.axis2.context.MessageContext > > _messageContext = new > > org.apache.axis2.context.MessageContext() ; > > _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(); > > > > > > java.lang.Object object = fromOM( > > > > getElement(_returnEnv,"document"), > > > > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.class, > > > > getEnvelopeNamespaces(_returnEnv)); > > > > _messageContext.getTransportOut().getSender().cleanup(_messageContext); > > return > > (com.example.www.onlinebooksadbimage.xsd.FindBooksResponse)object; > > > > }catch(org.apache.axis2.AxisFault f){ > > org.apache.axiom.om.OMElement faultElt = f.getDetail(); > > if (faultElt!=null){ > > if > > (faultExeptionNameMap.containsKey(faultElt.getQName())){ > > //make the fault by reflection > > try{ > > java.lang.String exceptionClassName = > > (java.lang.String)faultExeptionClassNameMap.get(faultElt.getQName()); > > java.lang.Class exceptionClass = > > java.lang.Class.forName(exceptionClassName); > > java.rmi.RemoteException ex= > > > > (java.rmi.RemoteException)exceptionClass.newInstance(); > > //message class > > java.lang.String messageClassName = > > (java.lang.String)faultMessageMap.get(faultElt.getQName()); > > 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 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; > > } > > } > > } > > > > /** > > * Auto generated method signature for Asynchronous > > Invocations > > * @see > > org.apache.axis2.OnlineBooksADBImageService#startFindBooks > > * @param param12 > > > > */ > > public void startFindBooks( > > > > com.example.www.onlinebooksadbimage.xsd.FindBooksRequest > > param12,final > > org.apache.axis2.OnlineBooksADBImageServiceCallbackHandler > > callback) > > throws java.rmi.RemoteException{ > > org.apache.axis2.client.OperationClient > > _operationClient = > > _serviceClient.createClient(_operations[0].getName()); > > > > _operationClient.getOptions().setAction("http://www.example.com/OnlineBooksADBImage/FindBooks"); > > > > _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true); > > > > // create SOAP envelope with that payload > > org.apache.axiom.soap.SOAPEnvelope env=null; > > > > //Style is Doc. > > > > env = > > toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()), > > param12, optimizeContent(new javax.xml.namespace.QName("", "FindBooks"))); > > > > // create message context with that soap envelope > > org.apache.axis2.context.MessageContext > > _messageContext = new > > org.apache.axis2.context.MessageContext() ; > > _messageContext.setEnvelope(env); > > // add the message contxt to the operation client > > > > _operationClient.addMessageContext(_messageContext); > > > > > > _operationClient.setCallback(new > > org.apache.axis2.client.async.Callback() { > > public void onComplete( > > > > org.apache.axis2.client.async.AsyncResult result) { > > java.lang.Object object = fromOM(getElement( > > result.getResponseEnvelope(), "document"), > > > > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.class, > > > > getEnvelopeNamespaces(result.getResponseEnvelope()) > > ); > > > > callback.receiveResultFindBooks((com.example.www.onlinebooksadbimage.xsd.FindBooksResponse) > > object); > > } > > public void onError(java.lang.Exception e) { > > callback.receiveErrorFindBooks(e); > > } > > }); > > > > 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); > > } > > > > /** > > * 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.getName()); > > } > > 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/axis2/services/OnlineBooksADBImageService > > private org.apache.axiom.om.OMElement > > toOM(com.example.www.onlinebooksadbimage.xsd.FindBooksResponse > > param, boolean optimizeContent){ > > if (param instanceof > > org.apache.axis2.databinding.ADBBean){ > > > > org.apache.axiom.om.impl.builder.StAXOMBuilder builder > > = new > > org.apache.axiom.om.impl.builder.StAXOMBuilder > > > > (org.apache.axiom.om.OMAbstractFactory.getOMFactory(), > > new > > org.apache.axis2.util.StreamWrapper(param.getPullParser(com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.MY_QNAME))); > > org.apache.axiom.om.OMElement documentElement = > > builder.getDocumentElement(); > > > > ((org.apache.axiom.om.impl.OMNodeEx) > > documentElement).setParent(null); // remove the parent link > > return documentElement; > > }else{ > > > > //todo finish this onece the bean serializer has > > the necessary methods > > return null; > > } > > } > > private > > org.apache.axiom.soap.SOAPEnvelope > > toEnvelope(org.apache.axiom.soap.SOAPFactory factory, > > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse > > param, boolean optimizeContent){ > > if (param instanceof > > org.apache.axis2.databinding.ADBBean){ > > > > org.apache.axis2.databinding.ADBSOAPModelBuilder builder = > > new > > > > org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.MY_QNAME), > > > > factory); > > return builder.getEnvelope(); > > }else{ > > > > //todo finish this onece the bean serializer has > > the necessary methods > > return null; > > } > > } > > > > private org.apache.axiom.om.OMElement > > toOM(com.example.www.onlinebooksadbimage.xsd.FindBooksRequest > > param, boolean optimizeContent){ > > if (param instanceof > > org.apache.axis2.databinding.ADBBean){ > > > > org.apache.axiom.om.impl.builder.StAXOMBuilder builder > > = new > > org.apache.axiom.om.impl.builder.StAXOMBuilder > > > > (org.apache.axiom.om.OMAbstractFactory.getOMFactory(), > > new > > org.apache.axis2.util.StreamWrapper(param.getPullParser(com.example.www.onlinebooksadbimage.xsd.FindBooksRequest.MY_QNAME))); > > org.apache.axiom.om.OMElement documentElement = > > builder.getDocumentElement(); > > > > ((org.apache.axiom.om.impl.OMNodeEx) > > documentElement).setParent(null); // remove the parent link > > return documentElement; > > }else{ > > > > //todo finish this onece the bean serializer has > > the necessary methods > > return null; > > } > > } > > private > > org.apache.axiom.soap.SOAPEnvelope > > toEnvelope(org.apache.axiom.soap.SOAPFactory factory, > > com.example.www.onlinebooksadbimage.xsd.FindBooksRequest > > param, boolean optimizeContent){ > > if (param instanceof > > org.apache.axis2.databinding.ADBBean){ > > > > org.apache.axis2.databinding.ADBSOAPModelBuilder builder = > > new > > > > org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(com.example.www.onlinebooksadbimage.xsd.FindBooksRequest.MY_QNAME), > > > > factory); > > return builder.getEnvelope(); > > }else{ > > > > //todo finish this onece the bean serializer has > > the necessary methods > > return null; > > } > > } > > > > /** > > * 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){ > > try { > > > > if > > (com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.class.equals(type)){ > > return > > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching()); > > } > > > > if > > (com.example.www.onlinebooksadbimage.xsd.FindBooksRequest.class.equals(type)){ > > return > > com.example.www.onlinebooksadbimage.xsd.FindBooksRequest.Factory.parse(param.getXMLStreamReaderWithoutCaching()); > > } > > > > } catch (Exception e) { > > throw new RuntimeException(e); > > } > > return null; > > } > > > > > > } > > > > > > > > >Hi, > > >There was a considerable number of changes in MTOM as well as in ADB. > > >Hope you are using the same set of jars to code generate as well as to > > >compile. Please don't mix the stuff at any cost... > > > > >In the mean time please post your WSDL and any stack trace you are > > >getting... > > > > >~Thilina > > > > On 10/29/06, moiz ghori wrote: > > > Hi, I wanted to know that is there any difference b/w the implementation > > of > > > MTOM in Axis2 (1.0 release) and Axis2 1.0 SANPSHOT available. My code is > > > working fine on Axis2 1.0 release but it is not working on the SNAPSHOT > > and > > > giving wired compile time errors. > > > I am generating code from WSDLToJava(using ADB) and this genetated code is > > > different and shows complile time errors. I spend whole day but I couldnt > > > make it to work. > > > > > > -- > > http://webservices.apache.org/~thilina/ > > http://thilinag.blogspot.com/ > > > > > > ________________________________ > > Now you can have a huge leap forward in email: get the new Yahoo! Mail. > > > > > > > -- > http://webservices.apache.org/~thilina/ > http://thilinag.blogspot.com/ > -- http://webservices.apache.org/~thilina/ http://thilinag.blogspot.com/ --------------------------------------------------------------------- To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org For additional commands, e-mail: axis-user-help@ws.apache.org --------------------------------- All new Yahoo! Mail - --------------------------------- Get a sneak peak at messages with a handy reading pane. --0-1771695331-1162823757=:94342 Content-Type: text/html; charset=iso-8859-1 Content-Transfer-Encoding: 8bit
I am using Axis2_1.1 but still I am having same problem and I am using the same versions to generate and compile the code. Can you please give me the URLs of the WAR and  binary files.
 
Thanks
 
Moiz
Thilina Gunarathne <csethil@gmail.com> wrote:
ouch.. Hit the send button too fast...:(

Please use the Axis2-1.1-RC2 [1].. Also please use the same version to
generate code too.. You seem to be using diffrent versions to
generate code and then to compile and run them...

~Thilina

>
> On 11/4/06, Moiz Ghori wrote:
> > Thanks for your reply.
> >
> > I am generating code from WSDLToJava. First there were some compile time
> > errors of converttoString, convertofloat etc which got fixed easily with the
> > help of Eclipse IDE.
> > But there is also a complile time error in the Stub saying
> > getElement(SOAPEnvelope,String) is not defined in
> > OnlineBooksADBImageServiceStub.
> > I am using Axis2_1.0 snapshot.
> >
> >
> >
> > /**
> > * OnlineBooksADBImageServiceStub.java
> > *
> > * This file was auto-generated from WSDL
> > * by the Apache Axis2 version: 1.0 May 05, 2006 (12:31:13 IST)
> > */
> > package org.apache.axis2;
> >
> > /*
> > * OnlineBooksADBImageServiceStub java implementation
> > */
> >
> > public class OnlineBooksADBImageServiceStub extends
> > org.apache.axis2.client.Stub
> > {
> > //default axis home being null forces the system to pick up the mars
> > from the axis2 library
> > public static final java.lang.String AXIS2_HOME = null;
> > protected static
> > org.apache.axis2.description.AxisOperation[] _operations;
> > //hashmaps to keep the fault mapping
> > private java.util.HashMap faultExeptionNameMap = new
> > java.util.HashMap();
> > private java.util.HashMap faultExeptionClassNameMap = new
> > java.util.HashMap();
> > private java.util.HashMap faultMessageMap = new java.util.HashMap();
> >
> > private void populateAxisService(){
> > //creating the Service
> > _service = new
> > org.apache.axis2.description.AxisService("OnlineBooksADBImageService");
> >
> > //creating the operations
> > org.apache.axis2.description.AxisOperation
> > __operation;
> >
> >
> > _operations = new
> > org.apache.axis2.description.AxisOperation[1];
> >
> > __operation = new
> > org.apache.axis2.description.OutInAxisOperation();
> >
> > __operation.setName(new javax.xml.namespace.QName("",
> > "FindBooks"));
> >
> > _operations[0]=__operation;
> > _service.addOperation(__operation);
> >
> > }
> > //populates the faults
> > private void populateFaults(){
> >
> >
> > }
> > public
> > OnlineBooksADBImageServiceStub(org.apache.axis2.context.ConfigurationContext
> > configurationContext,
> > java.lang.String targetEndpoint)
> > throws java.lang.Exception {
> > //To populate AxisService
> > populateAxisService();
> > populateFaults();
> >
> >
> > _serviceClient = new
> > org.apache.axis2.client.ServiceClient(configurationContext,_service);
> > _serviceClient.getOptions().setTo(new
> > org.apache.axis2.addressing.EndpointReference(
> > targetEndpoint));
> >
> > }
> > /**
> > * Default Constructor
> > */
> > public OnlineBooksADBImageServiceStub() throws
> > java.lang.Exception {
> >
> >
> > this("http://localhost/axis2/services/OnlineBooksADBImageService"
> > );
> >
> > }
> > /**
> > * Constructor taking the target endpoint
> > */
> > public OnlineBooksADBImageServiceStub(java.lang.String targetEndpoint)
> > throws java.lang.Exception {
> >
> > this(org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(AXIS2_HOME,null),
> > targetEndpoint);
> > }
> >
> >
> > /**
> > * Auto generated method signature
> > * @see
> > org.apache.axis2.OnlineBooksADBImageService#FindBooks
> > * @param param12
> >
> > */
> > public
> > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse
> > FindBooks(
> >
> > com.example.www.onlinebooksadbimage.xsd.FindBooksRequest
> > param12)
> > throws java.rmi.RemoteException
> >
> > {
> > try{
> > org.apache.axis2.client.OperationClient
> > _operationClient =
> > _serviceClient.createClient(_operations[0].getName());
> >
> > _operationClient.getOptions().setAction("http://www.example.com/OnlineBooksADBImage/FindBooks");
> >
> > _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
> >
> > // create SOAP envelope with that payload
> > org.apache.axiom.soap.SOAPEnvelope env =
> > null;
> >
> > //Style is Doc.
> >
> >
> > env =
> > toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
> > param12,
> >
> > optimizeContent(new javax.xml.namespace.QName("",
> >
> > "FindBooks")));
> >
> > // create message context with that soap envelope
> > org.apache.axis2.context.MessageContext
> > _messageContext = new
> > org.apache.axis2.context.MessageContext() ;
> > _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();
> >
> >
> > java.lang.Object object = fromOM(
> >
> > getElement(_returnEnv,"document"),
> >
> > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.class,
> >
> > getEnvelopeNamespaces(_returnEnv));
> >
> > _messageContext.getTransportOut().getSender().cleanup(_messageContext);
> > return
> > (com.example.www.onlinebooksadbimage.xsd.FindBooksResponse)object;
> >
> > }catch(org.apache.axis2.AxisFault f){
> > org.apache.axiom.om.OMElement faultElt = f.getDetail();
> > if (faultElt!=null){
> > if
> > (faultExeptionNameMap.containsKey(faultElt.getQName())){
> > //make the fault by reflection
> > try{
> > java.lang.String exceptionClassName =
> > (java.lang.String)faultExeptionClassNameMap.get(faultElt.getQName());
> > java.lang.Class exceptionClass =
> > java.lang.Class.forName(exceptionClassName);
> > java.rmi.RemoteException ex=
> >
> > (java.rmi.RemoteException)exceptionClass.newInstance();
> > //message class
> > java.lang.String messageClassName =
> > (java.lang.String)faultMessageMap.get(faultElt.getQName());
> > 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 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;
> > }
> > }
> > }
> >
> > /**
> > * Auto generated method signature for Asynchronous
> > Invocations
> > * @see
> > org.apache.axis2.OnlineBooksADBImageService#startFindBooks
> > * @param param12
> >
> > */
> > public void startFindBooks(
> >
> > com.example.www.onlinebooksadbimage.xsd.FindBooksRequest
> > param12,final
> > org.apache.axis2.OnlineBooksADBImageServiceCallbackHandler
> > callback)
> > throws java.rmi.RemoteException{
> > org.apache.axis2.client.OperationClient
> > _operationClient =
> > _serviceClient.createClient(_operations[0].getName());
> >
> > _operationClient.getOptions().setAction("http://www.example.com/OnlineBooksADBImage/FindBooks");
> >
> > _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);
> >
> > // create SOAP envelope with that payload
> > org.apache.axiom.soap.SOAPEnvelope env=null;
> >
> > //Style is Doc.
> >
> > env =
> > toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
> > param12, optimizeContent(new javax.xml.namespace.QName("", "FindBooks")));
> >
> > // create message context with that soap envelope
> > org.apache.axis2.context.MessageContext
> > _messageContext = new
> > org.apache.axis2.context.MessageContext() ;
> > _messageContext.setEnvelope(env);
> > // add the message contxt to the operation client
> >
> > _operationClient.addMessageContext(_messageContext);
> >
> >
> > _operationClient.setCallback(new
> > org.apache.axis2.client.async.Callback() {
> > public void onComplete(
> >
> > org.apache.axis2.client.async.AsyncResult result) {
> > java.lang.Object object = fromOM(getElement(
> > result.getResponseEnvelope(), "document"),
> >
> > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.class,
> >
> > getEnvelopeNamespaces(result.getResponseEnvelope())
> > );
> >
> > callback.receiveResultFindBooks((com.example.www.onlinebooksadbimage.xsd.FindBooksResponse)
> > object);
> > }
> > public void onError(java.lang.Exception e) {
> > callback.receiveErrorFindBooks(e);
> > }
> > });
> >
> > 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);
> > }
> >
> > /**
> > * 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.getName());
> > }
> > 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/axis2/services/OnlineBooksADBImageService
> > private org.apache.axiom.om.OMElement
> > toOM(com.example.www.onlinebooksadbimage.xsd.FindBooksResponse
> > param, boolean optimizeContent){
> > if (param instanceof
> > org.apache.axis2.databinding.ADBBean){
> >
> > org.apache.axiom.om.impl.builder.StAXOMBuilder builder
> > = new
> > org.apache.axiom.om.impl.builder.StAXOMBuilder
> >
> > (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),
> > new
> > org.apache.axis2.util.StreamWrapper(param.getPullParser(com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.MY_QNAME)));
> > org.apache.axiom.om.OMElement documentElement =
> > builder.getDocumentElement();
> >
> > ((org.apache.axiom.om.impl.OMNodeEx)
> > documentElement).setParent(null); // remove the parent link
> > return documentElement;
> > }else{
> >
> > //todo finish this onece the bean serializer has
> > the necessary methods
> > return null;
> > }
> > }
> > private
> > org.apache.axiom.soap.SOAPEnvelope
> > toEnvelope(org.apache.axiom.soap.SOAPFactory factory,
> > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse
> > param, boolean optimizeContent){
> > if (param instanceof
> > org.apache.axis2.databinding.ADBBean){
> >
> > org.apache.axis2.databinding.ADBSOAPModelBuilder builder =
> > new
> >
> > org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.MY_QNAME),
> >
> > factory);
> > return builder.getEnvelope();
> > }else{
> >
> > //todo finish this onece the bean serializer has
> > the necessary methods
> > return null;
> > }
> > }
> >
> > private org.apache.axiom.om.OMElement
> > toOM(com.example.www.onlinebooksadbimage.xsd.FindBooksRequest
> > param, boolean optimizeContent){
> > if (param instanceof
> > org.apache.axis2.databinding.ADBBean){
> >
> > org.apache.axiom.om.impl.builder.StAXOMBuilder builder
> > = new
> > org.apache.axiom.om.impl.builder.StAXOMBuilder
> >
> > (org.apache.axiom.om.OMAbstractFactory.getOMFactory(),
> > new
> > org.apache.axis2.util.StreamWrapper(param.getPullParser(com.example.www.onlinebooksadbimage.xsd.FindBooksRequest.MY_QNAME)));
> > org.apache.axiom.om.OMElement documentElement =
> > builder.getDocumentElement();
> >
> > ((org.apache.axiom.om.impl.OMNodeEx)
> > documentElement).setParent(null); // remove the parent link
> > return documentElement;
> > }else{
> >
> > //todo finish this onece the bean serializer has
> > the necessary methods
> > return null;
> > }
> > }
> > private
> > org.apache.axiom.soap.SOAPEnvelope
> > toEnvelope(org.apache.axiom.soap.SOAPFactory factory,
> > com.example.www.onlinebooksadbimage.xsd.FindBooksRequest
> > param, boolean optimizeContent){
> > if (param instanceof
> > org.apache.axis2.databinding.ADBBean){
> >
> > org.apache.axis2.databinding.ADBSOAPModelBuilder builder =
> > new
> >
> > org.apache.axis2.databinding.ADBSOAPModelBuilder(param.getPullParser(com.example.www.onlinebooksadbimage.xsd.FindBooksRequest.MY_QNAME),
> >
> > factory);
> > return builder.getEnvelope();
> > }else{
> >
> > //todo finish this onece the bean serializer has
> > the necessary methods
> > return null;
> > }
> > }
> >
> > /**
> > * 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){
> > try {
> >
> > if
> > (com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.class.equals(type)){
> > return
> > com.example.www.onlinebooksadbimage.xsd.FindBooksResponse.Factory.parse(param.getXMLStreamReaderWithoutCaching());
> > }
> >
> > if
> > (com.example.www.onlinebooksadbimage.xsd.FindBooksRequest.class.equals(type)){
> > return
> > com.example.www.onlinebooksadbimage.xsd.FindBooksRequest.Factory.parse(param.getXMLStreamReaderWithoutCaching());
> > }
> >
> > } catch (Exception e) {
> > throw new RuntimeException(e);
> > }
> > return null;
> > }
> >
> >
> > }
> >
> >
> >
> > >Hi,
> > >There was a considerable number of changes in MTOM as well as in ADB.
> > >Hope you are using the same set of jars to code generate as well as to
> > >compile. Please don't mix the stuff at any cost...
> >
> > >In the mean time please post your WSDL and any stack trace you are
> > >getting...
> >
> > >~Thilina
> >
> > On 10/29/06, moiz ghori wrote:
> > > Hi, I wanted to know that is there any difference b/w the implementation
> > of
> > > MTOM in Axis2 (1.0 release) and Axis2 1.0 SANPSHOT available. My code is
> > > working fine on Axis2 1.0 release but it is not working on the SNAPSHOT
> > and
> > > giving wired compile time errors.
> > > I am generating code from WSDLToJava(using ADB) and this genetated code is
> > > different and shows complile time errors. I spend whole day but I couldnt
> > > make it to work.
> >
> >
> > --
> > http://webservices.apache.org/~thilina/
> > http://thilinag.blogspot.com/
> >
> >
> > ________________________________
> > Now you can have a huge leap forward in email: get the new Yahoo! Mail.
> >
> >
>
>
> --
> http://webservices.apache.org/~thilina/
> http://thilinag.blogspot.com/
>


--
http://webservices.apache.org/~thilina/
http://thilinag.blogspot.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-user-help@ws.apache.org



All new Yahoo! Mail -
Get a sneak peak at messages with a handy reading pane. --0-1771695331-1162823757=:94342--