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 silver17 <si...@hotmail.com> on 2008/04/15 05:06:13 UTC

Which Annotations work in Axis 2.1.3?

Hi guys,

I've been experimenting with annotations and axis2 web services, and have
some degree of success, but would like some help.  Some things i've noticed:

1.  @WebResult has seems to have no affect when you load the services
auto-generated ?WSDL
2.  the targetNamespace functionality in both the @WebResult and @WebParam
don't seem to work when trying to access the services wsdl via ?WSDL.

Is there something i'm missing?

My development setting is Eclipse Europa with the Axis2-1.3 service archiver
and code-gen plugins.  I build a java project and develop a service like
this:

import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.soap.SOAPBinding;

/**
 * Implementation of a calculator web service.
 * @author Bill
 *
 */
@WebService(
	serviceName="CalculatorService",
	targetNamespace="http://services.agr.gc.ca/CalculatorService"
)
@SOAPBinding(
		style=SOAPBinding.Style.DOCUMENT,
		use=SOAPBinding.Use.LITERAL,
		parameterStyle=SOAPBinding.ParameterStyle.BARE
)
public class CalculatorService {

	/**
	 * Adds two numbers.
	 * @param a
	 * @param b
	 * @return the addition of two numbers.
	 */
	@WebMethod (
		action="action:Add",
		operationName="Add"
	)
	public @WebResult(name="Add") int add(
			@WebParam (mode=WebParam.Mode.IN, 
					   name="param1") int a, 
			@WebParam (mode=WebParam.Mode.IN, 
					   name="param2") int b) {
		return a + b;
	}
}

Everything seems to be hit and miss with the annotations.  For the
@WebMethod the targetNamespace and operationName seems to have no effect. 
The @WebResult has no effect.  So if I want to have a document literal web
service with a response parameter as addResult instead of addResponse I
can't seem to do that.

Is there something i'm missing?

-- 
View this message in context: http://www.nabble.com/Which-Annotations-work-in-Axis-2.1.3--tp16694164p16694164.html
Sent from the Axis - User mailing list archive at Nabble.com.


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


Re: Which Annotations work in Axis 2.1.3?

Posted by Davanum Srinivas <da...@gmail.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Get latest nightly or the latest release candidate and look at the several jaxws samples in the samples directory.

- -- dims

silver17 wrote:
| Hi guys,
|
| I've been experimenting with annotations and axis2 web services, and have
| some degree of success, but would like some help.  Some things i've noticed:
|
| 1.  @WebResult has seems to have no affect when you load the services
| auto-generated ?WSDL
| 2.  the targetNamespace functionality in both the @WebResult and @WebParam
| don't seem to work when trying to access the services wsdl via ?WSDL.
|
| Is there something i'm missing?
|
| My development setting is Eclipse Europa with the Axis2-1.3 service archiver
| and code-gen plugins.  I build a java project and develop a service like
| this:
|
| import javax.jws.WebService;
| import javax.jws.WebMethod;
| import javax.jws.WebParam;
| import javax.jws.WebResult;
| import javax.jws.soap.SOAPBinding;
|
| /**
|  * Implementation of a calculator web service.
|  * @author Bill
|  *
|  */
| @WebService(
| 	serviceName="CalculatorService",
| 	targetNamespace="http://services.agr.gc.ca/CalculatorService"
| )
| @SOAPBinding(
| 		style=SOAPBinding.Style.DOCUMENT,
| 		use=SOAPBinding.Use.LITERAL,
| 		parameterStyle=SOAPBinding.ParameterStyle.BARE
| )
| public class CalculatorService {
|
| 	/**
| 	 * Adds two numbers.
| 	 * @param a
| 	 * @param b
| 	 * @return the addition of two numbers.
| 	 */
| 	@WebMethod (
| 		action="action:Add",
| 		operationName="Add"
| 	)
| 	public @WebResult(name="Add") int add(
| 			@WebParam (mode=WebParam.Mode.IN,
| 					   name="param1") int a,
| 			@WebParam (mode=WebParam.Mode.IN,
| 					   name="param2") int b) {
| 		return a + b;
| 	}
| }
|
| Everything seems to be hit and miss with the annotations.  For the
| @WebMethod the targetNamespace and operationName seems to have no effect.
| The @WebResult has no effect.  So if I want to have a document literal web
| service with a response parameter as addResult instead of addResponse I
| can't seem to do that.
|
| Is there something i'm missing?
|
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Cygwin)

iD8DBQFIBISggNg6eWEDv1kRAqlCAJ9G1FNqHgv5eLlSe5kCpP4K75rb3QCgjebo
vbk10eS1AvFbSzl/tyiJD+w=
=Jp8a
-----END PGP SIGNATURE-----

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