You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@axis.apache.org by Bruno Negrao <bn...@gmail.com> on 2006/07/09 16:42:49 UTC

Bug? Cannot instantiate AxisOperation object

Hi guys,

when I try to instantiate an AxisOperation object with:

AxisOperation agendaPesquisa =  new AxisOperation();

that gives me an "Unresolved compilation problem":

Exception in thread "main" java.lang.Error: Unresolved compilation problem:
	Cannot instantiate the type AxisOperation

	at teste.TestAgenda.main(TestAgenda.java:46)

Is this a bug?

(i'm downloading the latest nightly snapshot anyway...)
thanks,
bruno

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


Re: Bug? Cannot instantiate AxisOperation object

Posted by Martin Gainty <mg...@hotmail.com>.
Take a look at org.apache.axis2.Axis2SampleDocLitServiceStub.java for the following example code
(I took a peek at it in between watching the World Cup)

From what I can see you need to establish array of NameOfAxisOperation [] in this fashion

//establish Array of AxisOperations on stack
protected static org.apache.axis2.description.AxisOperation[] _operations;

//Allocate the necessary byes from heap for all Operations
_operations = new org.apache.axis2.description.AxisOperation[3];

//Create the service
 _service = new org.apache.axis2.description.AxisService("Axis2SampleDocLitService");

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

//Define if this operation is Request and Response or Just Request
__operation = new org.apache.axis2.description.OutInAxisOperation();
//set the operation name
__operation.setName(new javax.xml.namespace.QName("", "NameOfAxisOperation"));

//Add the configured operation to your array of operations
_operations[0]=__operation;
//Add the operation to the service
_service.addOperation(__operation);

//Establish a new client to the service
_serviceClient = new org.apache.axis2.client.ServiceClient(configurationContext,_service);

//Establish a new endpoint..
final EndpointReference targetEPR = new EndpointReference("http://localhost:8080/pfappspabxutils");
//Assign the _serviceClient's options to accept the new endpont
_serviceClient.getOptions().setTo(new org.apache.axis2.addressing.EndpointReference(targetEPR));

try
{
    org.apache.axis2.client.OperationClient _operationClient = _serviceClient.createClient(_operations[0].getName());
    _operationClient.getOptions().setAction("NameOfAxisOperation");
//enable this (true) if you have properly configured your SOAPFault
// _operationClient.getOptions().setExceptionToBeThrownOnSOAPFault(true);

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

org.apache.axis2.Axis2SampleDocLitServiceStub.NameOfAxisOperationParam param6                    
//Style is Doc.

//Establish the envelope   ..be careful with the QName 1st parameter which indicates the namespace                                 
org.apache.axiom.soap.SOAPEnvelope env = toEnvelope(getFactory(_operationClient.getOptions().getSoapVersionURI()),
                                                param6,
                                                optimizeContent(new javax.xml.namespace.QName("",
                                                "NameofAxisOperation")));
                                            

// create message context 
org.apache.axis2.context.MessageContext _messageContext = new org.apache.axis2.context.MessageContext() ;
//associate the envelope with the created MessageContext
_messageContext.setEnvelope(env);

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

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

//Acquire the messageContext returned
org.apache.axis2.context.MessageContext _returnMessageContext = _operationClient.getMessageContext(
                                           org.apache.axis2.wsdl.WSDLConstants.MESSAGE_LABEL_IN_VALUE);

//Acquire the returned envelope
 org.apache.axiom.soap.SOAPEnvelope _returnEnv = _returnMessageContext.getEnvelope();

//Pull back the 'Object' Model part for later retrieval
java.lang.Object object = fromOM(getElement(_returnEnv,"rpc"),
} //end try
catch(org.apache.axis2.AxisFault f)
{ //put out the appropriate Fault Message
            org.apache.axiom.om.OMElement faultElt = f.getDetail();
}

Bon Chance!
Martin --
                


*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Bruno Negrao" <bn...@gmail.com>
To: <ax...@ws.apache.org>; "Martin Gainty" <mg...@hotmail.com>
Sent: Sunday, July 09, 2006 11:07 AM
Subject: Re: Bug? Cannot instantiate AxisOperation object


> Good morning Martin. I'm not using a wsdl for this test. TestAgenda
> class is attached.
> try it out there in your machine and tell me what happens.
> I already installed the latest nightly build and I'm still having the error.
> 
>> Can we see the code for TestAgenda (line 46 specifically)
> on line 46 is the code:
> 
> AxisOperation agendaPesquisa =  new AxisOperation();
> 
> thank you,
> bruno
>


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


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

Re: Bug? Cannot instantiate AxisOperation object

Posted by Bruno Negrao <bn...@gmail.com>.
Good morning Martin. I'm not using a wsdl for this test. TestAgenda
class is attached.
try it out there in your machine and tell me what happens.
I already installed the latest nightly build and I'm still having the error.

> Can we see the code for TestAgenda (line 46 specifically)
on line 46 is the code:

 AxisOperation agendaPesquisa =  new AxisOperation();

thank you,
bruno

Re: Bug? Cannot instantiate AxisOperation object

Posted by Martin Gainty <mg...@hotmail.com>.
Good Morning Bruno

Can we see the code for TestAgenda (line 46 specifically)
Can we see the WSDL?

Martin--
*********************************************************************
This email message and any files transmitted with it contain confidential
information intended only for the person(s) to whom this email message is
addressed.  If you have received this email message in error, please notify
the sender immediately by telephone or email and destroy the original
message without making a copy.  Thank you.



----- Original Message ----- 
From: "Bruno Negrao" <bn...@gmail.com>
To: <ax...@ws.apache.org>
Sent: Sunday, July 09, 2006 10:42 AM
Subject: Bug? Cannot instantiate AxisOperation object


> Hi guys,
> 
> when I try to instantiate an AxisOperation object with:
> 
> AxisOperation agendaPesquisa =  new AxisOperation();
> 
> that gives me an "Unresolved compilation problem":
> 
> Exception in thread "main" java.lang.Error: Unresolved compilation problem:
> Cannot instantiate the type AxisOperation
> 
> at teste.TestAgenda.main(TestAgenda.java:46)
> 
> Is this a bug?
> 
> (i'm downloading the latest nightly snapshot anyway...)
> thanks,
> bruno
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
> 
>

Re: Bug? Cannot instantiate AxisOperation object

Posted by Bruno Negrao <bn...@gmail.com>.
Hi Deepal,
> AxisOperation is abstract class so you can not call;
> new AxisOperation();
Oh, I didn't notice that... sorry. :-)

> So what you can do is create sub class of that , like InOutAxisOperation;
> AxisOperation op = new InOutAxisOperation();
>
> Axis2 has different implementation of AxisOperation for different MEP.
> If you can pls have a look at;
> org.apache.axis2.description.AxisOperationFactory;

Thank you,
bruno

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


Re: Bug? Cannot instantiate AxisOperation object

Posted by Deepal Jayasinghe <de...@opensource.lk>.
Hi Negrao;
AxisOperation is abstract class so you can not call;
new AxisOperation();
So what you can do is create sub class of that , like InOutAxisOperation;
AxisOperation op = new InOutAxisOperation();

Axis2 has different implementation of AxisOperation for different MEP.
If you can pls have a look at;
org.apache.axis2.description.AxisOperationFactory;

Bruno Negrao wrote:

> Hi guys,
>
> when I try to instantiate an AxisOperation object with:
>
> AxisOperation agendaPesquisa =  new AxisOperation();
>
> that gives me an "Unresolved compilation problem":
>
> Exception in thread "main" java.lang.Error: Unresolved compilation
> problem:
>     Cannot instantiate the type AxisOperation
>
>     at teste.TestAgenda.main(TestAgenda.java:46)
>
> Is this a bug?
>
> (i'm downloading the latest nightly snapshot anyway...)
> thanks,
> bruno
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: axis-user-unsubscribe@ws.apache.org
> For additional commands, e-mail: axis-user-help@ws.apache.org
>
>
>

-- 
Thanks,
Deepal
................................................................
~Future is Open~ 




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