下面列出了怎么用javax.jws.WebMethod的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* Method to remotely close rooms. If a room is closed all users
* inside the room and all users that try to enter it will be redirected to
* the redirectURL that is defined in the ROOM-Object.
*
* Returns positive value if authentication was successful.
*
* @param sid
* The SID of the User. This SID must be marked as Loggedin
* @param id
* the room id
*
* @return - 1 in case of success, -2 otherwise
*/
@WebMethod
@GET
@Path("/close/{id}")
public ServiceResult close(@WebParam(name="sid") @QueryParam("sid") String sid, @WebParam(name="id") @PathParam("id") long id) {
return performCall(sid, User.Right.SOAP, sd -> {
Long userId = sd.getUserId();
Room room = roomDao.get(id);
room.setClosed(true);
roomDao.update(room, userId);
WebSocketHelper.sendRoom(new RoomMessage(room.getId(), userDao.get(userId), RoomMessage.Type.ROOM_CLOSED));
return new ServiceResult("Closed", Type.SUCCESS);
});
}
private void setWsaActions(MetadataReader metadataReader) {
Action action = (metadataReader != null)? metadataReader.getAnnotation(Action.class, seiMethod):seiMethod.getAnnotation(Action.class);
if(action != null) {
inputAction = action.input();
outputAction = action.output();
}
//@Action(input) =="", get it from @WebMethod(action)
WebMethod webMethod = (metadataReader != null)? metadataReader.getAnnotation(WebMethod.class, seiMethod):seiMethod.getAnnotation(WebMethod.class);
soapAction = "";
if (webMethod != null )
soapAction = webMethod.action();
if(!soapAction.equals("")) {
//non-empty soapAction
if(inputAction.equals(""))
// set input action to non-empty soapAction
inputAction = soapAction;
else if(!inputAction.equals(soapAction)){
//both are explicitly set via annotations, make sure @Action == @WebMethod.action
//http://java.net/jira/browse/JAX_WS-1108
//throw new WebServiceException("@Action and @WebMethod(action=\"\" does not match on operation "+ method.getName());
}
}
}
/**
* Returns a list of events of a user between 2 dates. As this one requires 2 Date objects,
* it is the one to be called as a normal webservice.
* @param eid is the user that we want to query
* @param startDate limit the query ti these dates
* @param endDate limit the query ti these dates
* @return String as the result of the Query in xml
*/
@WebMethod
@Path("/getUserActivity")
@Produces("text/plain")
@GET
public String getUserActivity(
@WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid,
@WebParam(name = "eid", partName = "eid") @QueryParam("eid") String eid,
@WebParam(name = "startDate", partName = "startDate") @QueryParam("startDate") Date startDate,
@WebParam(name = "endDate", partName = "endDate") @QueryParam("endDate") Date endDate) {
Session session = establishSession(sessionid);
if (!securityService.isSuperUser()) {
log.warn("WS getUserActivity(): Permission denied. Restricted to super users.");
throw new RuntimeException("WS getUserActivity(): Permission denied. Restricted to super users.");
}
return eventQueryService.getUserActivity(eid, startDate, endDate);
}
/**
* @param sessionid
* @param propNames - comma separated list of property names
* @return
*/
@WebMethod
@Path("/getProperties")
@Produces("text/plain")
@GET
public String getProperties(
@WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid,
@WebParam(name = "propNames", partName = "propNames") @QueryParam("propNames") String propNames) {
Session session = establishSession(sessionid);
if (!securityService.isSuperUser()) {
log.warn("NonSuperUser trying to collect configuration: " + session.getUserId());
throw new RuntimeException("NonSuperUser trying to collect configuration: " + session.getUserId());
}
String[] propNamesArray = propNames.split(",");
Map<String, String> propertyMap = new HashMap();
for (int i = 0; i < propNamesArray.length; i++) {
String propValue = lookupConfigValue(propNamesArray[i]);
String propName = propNamesArray[i].trim().replace("@", "-").replace(".", "_");
propertyMap.put(propName, propValue);
}
log.debug(getXML("properties", propertyMap));
return getXML("properties", propertyMap);
}
@WebMethod
public DashboardDocumentResult[] getUserLastUploadedDocuments(@WebParam(name = "token") String token)
throws AccessDeniedException, RepositoryException, DatabaseException {
log.debug("getUserLastUploadedDocuments({})", new Object[]{token});
DashboardModule dm = ModuleManager.getDashboardModule();
List<DashboardDocumentResult> col = dm.getUserLastUploadedDocuments(token);
DashboardDocumentResult[] result = col.toArray(new DashboardDocumentResult[col.size()]);
log.debug("getUserLastUploadedDocuments: {}", result);
return result;
}
@WebMethod(operationName = "canSuperUserApproveDocument")
@WebResult(name = "isSuperUser")
@XmlElement(name = "isSuperUser", required = true)
boolean canSuperUserApproveDocument(
@WebParam(name = "principalId") String principalId,
@WebParam(name = "documentTypeName") String documentTypeName,
@WebParam(name = "routeNodeInstances") List<RouteNodeInstance> routeNodeInstances,
@WebParam(name = "routeStatusCode") String routeStatusCode)
throws RiceIllegalArgumentException;
/**
* Returns all KEW types that for a given namespace.
*
* @return all KEW types for a namespace
*/
@WebMethod(operationName = "findAllTypesByNamespace")
@WebResult(name = "namespaceTypes")
@XmlElementWrapper(name = "namespaceTypes", required = false)
@XmlElement(name = "namespaceType", required = false)
List<KewTypeDefinition> findAllTypesByNamespace(
@WebParam(name = "namespace") String namespace) throws RiceIllegalArgumentException;
/**
* Modify a video input configuration. A device that has one or more video
* sources shall support the setting of the VideoSourceConfiguration through this command.
*
*/
@WebMethod(operationName = "SetVideoSourceConfiguration", action = "http://www.onvif.org/ver10/deviceio/wsdl/SetVideoSourceConfiguration")
@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
@WebResult(name = "SetVideoSourceConfigurationResponse", targetNamespace = "http://www.onvif.org/ver10/deviceIO/wsdl", partName = "parameters")
public SetVideoSourceConfigurationResponse setVideoSourceConfiguration(
@WebParam(partName = "parameters", name = "SetVideoSourceConfiguration", targetNamespace = "http://www.onvif.org/ver10/deviceIO/wsdl")
SetVideoSourceConfiguration parameters
);
@WebMethod
public byte[] getProcessDefinitionImage(@WebParam(name = "token") String token, @WebParam(name = "pdId") long pdId,
@WebParam(name = "node") String node) throws AccessDeniedException, RepositoryException, DatabaseException, WorkflowException {
log.debug("getProcessDefinitionImage({}, {}, {})", new Object[]{token, pdId, node});
WorkflowModule wm = ModuleManager.getWorkflowModule();
byte[] result = wm.getProcessDefinitionImage(token, pdId, node);
log.debug("getProcessDefinitionImage: {}", result);
return result;
}
@WebMethod(
action = "urn:be:fgov:ehealth:gfddpp:protocol:v1:UpdateData"
)
@WebResult(
name = "UpdateDataResponse",
targetNamespace = "urn:be:fgov:ehealth:gfddpp:protocol:v1",
partName = "body"
)
SimpleResponseType updateData(@WebParam(name = "UpdateDataRequest",targetNamespace = "urn:be:fgov:ehealth:gfddpp:protocol:v1",partName = "body") SealedMessageRequestType var1) throws SystemError_Exception;
/**
* If the profile token is already known, a profile can be fetched through
* the GetProfile command.
*
*/
@WebMethod(operationName = "GetProfile", action = "http://www.onvif.org/ver10/media/wsdlGetProfile/")
@RequestWrapper(localName = "GetProfile", targetNamespace = "http://www.onvif.org/ver10/media/wsdl", className = "org.onvif.ver10.media.wsdl.GetProfile")
@ResponseWrapper(localName = "GetProfileResponse", targetNamespace = "http://www.onvif.org/ver10/media/wsdl", className = "org.onvif.ver10.media.wsdl.GetProfileResponse")
@WebResult(name = "Profile", targetNamespace = "http://www.onvif.org/ver10/media/wsdl")
public org.onvif.ver10.schema.Profile getProfile(
@WebParam(name = "ProfileToken", targetNamespace = "http://www.onvif.org/ver10/media/wsdl")
java.lang.String profileToken
);
@WebMethod
@Path("/executeQuery2")
@Produces("text/plain")
@GET
public String executeQuery2(
@WebParam(name = "sessionid", partName = "sessionid") @QueryParam("sessionid") String sessionid,
@WebParam(name = "query", partName = "query") @QueryParam("query") String query,
@WebParam(name = "hash", partName = "hash") @QueryParam("hash") String hash,
@WebParam(name = "rowCount", partName = "rowCount") @QueryParam("rowCount") int rowCount,
@WebParam(name = "format", partName = "format") @QueryParam("format") String format) {
return executeQueryInternal(sessionid, query, hash, rowCount, convertFormatToEnum(format));
}
@WebMethod
public Bookmark get(@WebParam(name = "token") String token, @WebParam(name = "bmId") int bmId)
throws AccessDeniedException, RepositoryException, DatabaseException {
log.debug("get({}, {})", new Object[]{token, bmId});
BookmarkModule bm = ModuleManager.getBookmarkModule();
Bookmark bookmark = bm.get(token, bmId);
log.debug("get: {}", bookmark);
return bookmark;
}
/**
* Returns the capabilities of the display service. The result is returned in
* a typed answer.
*
*/
@WebMethod(operationName = "GetServiceCapabilities", action = "http://www.onvif.org/ver10/display/wsdl/GetServiceCapabilities")
@RequestWrapper(localName = "GetServiceCapabilities", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", className = "org.onvif.ver10.display.wsdl.GetServiceCapabilities")
@ResponseWrapper(localName = "GetServiceCapabilitiesResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", className = "org.onvif.ver10.display.wsdl.GetServiceCapabilitiesResponse")
@WebResult(name = "Capabilities", targetNamespace = "http://www.onvif.org/ver10/display/wsdl")
public org.onvif.ver10.display.wsdl.Capabilities getServiceCapabilities()
;
@RequestWrapper(
localName = "markAsArchived",
targetNamespace = "http://services.recipe.be",
className = "be.recipe.services.MarkAsArchived"
)
@WebMethod
@ResponseWrapper(
localName = "markAsArchivedResponse",
targetNamespace = "http://services.recipe.be",
className = "be.recipe.services.MarkAsArchivedResponse"
)
void markAsArchived(@WebParam(name = "MarkAsArchivedParamSealed", targetNamespace = "") byte[] var1, @WebParam(name = "PartyIdentificationParam", targetNamespace = "") PartyIdentification var2) throws RecipeException;
/**
* Returns the capabilities of the device service. The result is returned in
* a typed answer.
*
*/
@WebMethod(operationName = "GetServiceCapabilities", action = "http://www.onvif.org/ver10/device/wsdl/GetServiceCapabilities")
@RequestWrapper(localName = "GetServiceCapabilities", targetNamespace = "http://www.onvif.org/ver10/device/wsdl", className = "org.onvif.ver10.device.wsdl.GetServiceCapabilities")
@ResponseWrapper(localName = "GetServiceCapabilitiesResponse", targetNamespace = "http://www.onvif.org/ver10/device/wsdl", className = "org.onvif.ver10.device.wsdl.GetServiceCapabilitiesResponse")
@WebResult(name = "Capabilities", targetNamespace = "http://www.onvif.org/ver10/device/wsdl")
public org.onvif.ver10.device.wsdl.DeviceServiceCapabilities getServiceCapabilities()
;
@WebMethod
public QueryParams[] getUserSearchs(@WebParam(name = "token") String token) throws AccessDeniedException, RepositoryException,
DatabaseException {
log.debug("getUserSearchs({})", new Object[]{token});
DashboardModule dm = ModuleManager.getDashboardModule();
List<QueryParams> col = dm.getUserSearchs(token);
QueryParams[] result = col.toArray(new QueryParams[col.size()]);
log.debug("getUserSearchs: {}", result);
return result;
}
@WebMethod(
action = "urn:be:fgov:ehealth:gfddpp:protocol:v1:GetDataTypes"
)
@WebResult(
name = "GetDataTypesResponse",
targetNamespace = "urn:be:fgov:ehealth:gfddpp:protocol:v1",
partName = "body"
)
SealedResponseType getDataTypes(@WebParam(name = "GetDataTypesRequest", targetNamespace = "urn:be:fgov:ehealth:gfddpp:protocol:v1", partName = "body") SealedRequestType var1) throws SystemError_Exception;
@WebMethod
public DashboardDocumentResult[] getUserLastModifiedDocuments(@WebParam(name = "token") String token)
throws AccessDeniedException, RepositoryException, DatabaseException {
log.debug("getUserLastModifiedDocuments({})", new Object[]{token});
DashboardModule dm = ModuleManager.getDashboardModule();
List<DashboardDocumentResult> col = dm.getUserLastModifiedDocuments(token);
DashboardDocumentResult[] result = col.toArray(new DashboardDocumentResult[col.size()]);
log.debug("getUserLastModifiedDocuments: {}", result);
return result;
}
/**
* Returns the capabilities of the replay service. The result is returned in
* a typed answer.
*
*/
@WebMethod(operationName = "GetServiceCapabilities", action = "http://www.onvif.org/ver10/replay/wsdl/GetServiceCapabilities")
@RequestWrapper(localName = "GetServiceCapabilities", targetNamespace = "http://www.onvif.org/ver10/replay/wsdl", className = "org.onvif.ver10.replay.wsdl.GetServiceCapabilities")
@ResponseWrapper(localName = "GetServiceCapabilitiesResponse", targetNamespace = "http://www.onvif.org/ver10/replay/wsdl", className = "org.onvif.ver10.replay.wsdl.GetServiceCapabilitiesResponse")
@WebResult(name = "Capabilities", targetNamespace = "http://www.onvif.org/ver10/replay/wsdl")
public org.onvif.ver10.replay.wsdl.Capabilities getServiceCapabilities()
;
@WebResult(name = "return", targetNamespace = "")
@RequestWrapper(localName = "getAwardAccounts", targetNamespace = KcConstants.KC_NAMESPACE_URI, className = "kc.GetAwardAccounts")
@WebMethod
@ResponseWrapper(localName = "getAwardAccountsResponse", targetNamespace = KcConstants.KC_NAMESPACE_URI, className = "kc.GetAwardAccountsResponse")
public java.util.List<AwardAccountDTO> getAwardAccounts(
@WebParam(name = "financialAccountNumber", targetNamespace = "")
java.lang.String financialAccountNumber,
@WebParam(name = "chartOfAccounts", targetNamespace = "")
java.lang.String chartOfAccounts
);
@WebMethod
@WebResult(name = "result")
public double calculatePower(@WebParam(name = "base") double base,
@WebParam(name = "exponent") double exponent) {
return Math.pow(base, exponent);
}
@WebMethod( operationName = "sum", action = "tns:sum" )
public Integer sum( @WebParam( name = "x" ) Integer x, @WebParam( name = "y" ) Integer y ) {
return Calculator.sum( x, y );
}
@WebMethod
@Metered
public String echo(String input) {
return input;
}
@WebResult(name = "GetStandardVersionResult", targetNamespace = "urn:epcglobal:epcis-query:xsd:1", partName = "getStandardVersionReturn")
@WebMethod
public java.lang.String getStandardVersion(
@WebParam(partName = "parms", name = "GetStandardVersion", targetNamespace = "urn:epcglobal:epcis-query:xsd:1") org.fosstrak.epcis.model.EmptyParms parms)
throws ImplementationExceptionResponse, SecurityExceptionResponse, ValidationExceptionResponse;
@WebMethod
public String getMethod1Value() {
return "from Method1";
}
@WebMethod
String hello(@WebParam(name = "text") String text);
@WebMethod(action = "determineIfcVersion")
String determineIfcVersion(
@WebParam(name = "head", partName = "determineIfcVersion.head") byte[] head,
@WebParam(name = "zipped", partName = "determineIfcVersion.zipped") Boolean zipped) throws UserException, ServiceException;
/**
*
* Performs actions on {@link ForecastAdjustment} objects that match the given {@link
* Statement#query}.
*
* <p>This method requires that use of traffic forecast segments and forecast adjustments is
* enabled for this network, and will throw an exception if it is not enabled.
*
* @param forecastAdjustmentAction the action to perform
* @param filterStatement a Publisher Query Language statement used to filter a set of forecast
* adjustments
* @return the result of the action performed
*
*
* @param forecastAdjustmentAction
* @param filterStatement
* @return
* returns com.google.api.ads.admanager.jaxws.v202005.UpdateResult
* @throws ApiException_Exception
*/
@WebMethod
@WebResult(name = "rval", targetNamespace = "https://www.google.com/apis/ads/publisher/v202005")
@RequestWrapper(localName = "performForecastAdjustmentAction", targetNamespace = "https://www.google.com/apis/ads/publisher/v202005", className = "com.google.api.ads.admanager.jaxws.v202005.AdjustmentServiceInterfaceperformForecastAdjustmentAction")
@ResponseWrapper(localName = "performForecastAdjustmentActionResponse", targetNamespace = "https://www.google.com/apis/ads/publisher/v202005", className = "com.google.api.ads.admanager.jaxws.v202005.AdjustmentServiceInterfaceperformForecastAdjustmentActionResponse")
public UpdateResult performForecastAdjustmentAction(
@WebParam(name = "forecastAdjustmentAction", targetNamespace = "https://www.google.com/apis/ads/publisher/v202005")
ForecastAdjustmentAction forecastAdjustmentAction,
@WebParam(name = "filterStatement", targetNamespace = "https://www.google.com/apis/ads/publisher/v202005")
Statement filterStatement)
throws ApiException_Exception
;
/**
* Deletes the given organizational unit in the organization of the calling
* user.
* <p>
* Required role: administrator of the organization to which the
* organizational unit belongs
*
* @param organizationalUnitName
* the name of the unit to be deleted
* @throws ObjectNotFoundException
* if the unit is not found in the calling user's organization
* @throws OperationNotPermittedException
* if the unit does not belong to the calling user's
* organization or if subscriptions are assigned to it
* @throws DeletionConstraintException
* @throws MailOperationException
*/
@WebMethod
void deleteUnit(
@WebParam(name = "organizationalUnitName") String organizationalUnitName)
throws ObjectNotFoundException,
OperationNotPermittedException, DeletionConstraintException,
MailOperationException;