axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Moiz Ghori <moizghor...@yahoo.ca>
Subject Re: MTOM issues on different Axis version
Date Mon, 06 Nov 2006 14:35:57 GMT
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.
Mime
View raw message