Java Reference
In-Depth Information
Therefore, the RPC is more tightly coupled because if you make any changes in the mes-
sage structure, you'll need to change all the clients and servers processing this kind of
message.
A document-style web service, on the other hand, contains no restrictions for how the
SOAP body must be constructed. It allows you to include whatever XML data you want
and also a schema for this XML. Therefore, the document style is probably more flexible,
but the effort to implement the web service and clients may be slightly more.
In the end, the likelihood of change is a factor that one has to consider when choosing
whether to use RPC- or Document-style web services.
Attaching the @WebMethod attribute to a public method indicates that you want the
method exposed as part of the web service.
The @WebParam annotation is used to specify the parameter's name that needs to be ex-
hibited in the WSDL. You should always consider using a WebParam annotation, espe-
cially when using multiple parameters, otherwise the WSDL will use the default argument
parameter (in this case, arg0 ), which is meaningless for web service consumers.
The @WebResult annotation is quite similar to @WebParam in the sense that it can be
used to specify the name of the value returned by the WSDL.
Your web service is now complete. In order to deploy your web service, run the following
Maven goal, which will package and deploy your web service to your running WildFly in-
stance:
mvn package wildfly:deploy
WildFly will provide a minimal output on the console; this will inform you that the web
service project has been deployed and the WSDL file has been generated:
14:25:37,195 INFO [org.jboss.weld.deployer] (MSC service
thread 1-11) JBAS016005: Starting Services for CDI
deployment: ticket-agency-ws.war
14:25:37,198 INFO [org.jboss.ws.cxf.metadata] (MSC service
thread 1-11) JBWS024061: Adding service endpoint metadata:
id=com.packtpub.wflydevelopment.chapter7.boundary.CalculatePowerWebService
address=http://localhost:8080/ticket-agency-ws/
CalculatePowerService
Search WWH ::




Custom Search