protected SOAPBinding popSoapBinding() { if (pushedSoapBinding) soapBindingStack.pop(); SOAPBinding soapBinding = null; if (!soapBindingStack.empty()) { soapBinding = soapBindingStack.peek(); if (soapBinding.style().equals(SOAPBinding.Style.RPC)) { soapStyle = SOAPStyle.RPC; wrapped = true; } else { soapStyle = SOAPStyle.DOCUMENT; wrapped = soapBinding.parameterStyle().equals(ParameterStyle.WRAPPED); } } else { pushedSoapBinding = false; } return soapBinding; }
@WebResult(name = "CorporateAccount") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public CorporateAccount updateAccount(Account account) { LOGGER.info("Updating Account: {}", account); // Create new Corporate Account CorporateAccount ca = new CorporateAccount(); ca.setCompany(account.getCompany()); ca.setContact(account.getContact()); ca.setId(genRandom()); ca.setSalesContact(getRandomSales(sales)); LOGGER.info("New CorporateAccount created: {}", ca); return ca; }
@WebMethod(operationName = "Create", action = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create") @Action(input = "http://schemas.xmlsoap.org/ws/2004/09/transfer/Create", output = "http://schemas.xmlsoap.org/ws/2004/09/transfer/CreateResponse") @WebResult(name = "ResourceCreated", targetNamespace = "http://schemas.xmlsoap.org/ws/2004/09/transfer", partName = "ResourceCreated") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public ResourceCreated create( @WebParam(name = "Shell", targetNamespace = "http://schemas.microsoft.com/wbem/wsman/1/windows/shell") Shell shell, @WebParam(name = "ResourceURI", targetNamespace = "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", header = true) String resourceURI, @WebParam(name = "MaxEnvelopeSize", targetNamespace = "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", header = true) int maxEnvelopeSize, @WebParam(name = "OperationTimeout", targetNamespace = "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", header = true) String operationTimeout, @WebParam(name = "Locale", targetNamespace = "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", header = true) Locale locale, @WebParam(name = "OptionSet", targetNamespace = "http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd", header = true) OptionSetType optionSet ) { return null; }
public static TreeNodeImpl convertOperationParametersToGui(WSMethod wsMethod, WSDynamicClient client) { WiseTreeElementBuilder builder = new WiseTreeElementBuilder(client, true); TreeNodeImpl rootElement = new TreeNodeImpl(); Collection<? extends WebParameter> parameters = wsMethod.getWebParams().values(); SOAPBinding soapBindingAnn = wsMethod.getEndpoint().getUnderlyingObjectClass().getAnnotation(SOAPBinding.class); boolean rpcLit = false; if (soapBindingAnn != null) { SOAPBinding.Style style = soapBindingAnn.style(); rpcLit = style != null && SOAPBinding.Style.RPC.equals(style); } for (WebParameter parameter : parameters) { if (parameter.getMode() != WebParam.Mode.OUT) { WiseTreeElement wte = builder.buildTreeFromType(parameter.getType(), parameter.getName(), null, !rpcLit); rootElement.addChild(wte.getId(), wte); } } return rootElement; }
private static MethodMarshaller createDocLitMethodMarshaller(OperationDescription op, boolean isClient, ClassLoader cl) { SOAPBinding.ParameterStyle parameterStyle = null; SUBTYPE subType = SUBTYPE.NORMAL; if (isDocLitBare(op)) { if (isDocLitBareMinimal(op, cl)) { subType = SUBTYPE.MINIMAL; } parameterStyle = SOAPBinding.ParameterStyle.BARE; } else { if (isDocLitWrappedMinimal(op)) { subType = SUBTYPE.MINIMAL; } else if (isDocLitWrappedPlus(op)) { subType = SUBTYPE.PLUS; } parameterStyle = SOAPBinding.ParameterStyle.WRAPPED; } return createMethodMarshaller(SOAPBinding.Style.DOCUMENT, parameterStyle, subType, isClient); }
/** * This method passes an SWA attachment as a request * and expects an SWA attachment as a response. * Note that the body content in both cases is empty. * (See the wsdl) * @param attachment (swa) * @return attachment (swa) */ @WebMethod(operationName="swaAttachment", action="swaAttachment") @XmlJavaTypeAdapter(HexBinaryAdapter.class) @WebResult(name = "jpegImageResponse", targetNamespace = "", partName = "jpegImageResponse") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) public byte[] swaAttachment( @XmlJavaTypeAdapter(HexBinaryAdapter.class) @WebParam(name = "jpegImageRequest", targetNamespace = "", partName = "jpegImageRequest") byte[] attachment) { if (attachment == null || attachment.length == 0){ throw new RuntimeException("Received empty attachment"); } else { // Change the first three characters and return the attachment attachment[0] = 'S'; attachment[1] = 'W'; attachment[2] = 'A'; } return attachment; }
@WebMethod(operationName="mtomAttachment", action="mtomAttachment") @SOAPBinding(parameterStyle=ParameterStyle.BARE) public void mtomAttachment(Holder<byte[]> message) { byte[] attachment = message.value; if (attachment == null || attachment.length == 0){ throw new RuntimeException("Received empty mtom attachment"); } else { // Change the first characters attachment[0] = 'X'; attachment[1] = 'O'; attachment[2] = 'P'; } message.value = attachment; }
public String getAnnoWebParamName() { if (webParamName == null) { if (getAnnoWebParam() != null && !DescriptionUtils.isEmpty(getAnnoWebParam().name())) { webParamName = getAnnoWebParam().name(); } else if (getOperationDescription().getSoapBindingStyle() == SOAPBinding.Style.DOCUMENT && getOperationDescription().getSoapBindingParameterStyle() == SOAPBinding.ParameterStyle.BARE) { // Defaul per JSR-181 MR Sec 4.4.1, pg 19 // TODO: Validation: For BARE paramaterUse, only a single IN our INOUT paramater and a single output (either return or OUT or INOUT) is allowed // Per JSR-224, Sec 3.6.2.2, pg 37 webParamName = getOperationDescription().getOperationName(); } else { // Default per JSR-181 MR Sec 4.4.1, pg 20 // Return "argN" where N is the index of the parameter in the method signature webParamName = "arg" + parameterNumber; } } return webParamName; }
public String getAnnoWebResultTargetNamespace() { if (!isOperationReturningResult()) { return null; } if (webResultTargetNamespace == null) { if (getAnnoWebResult() != null && !DescriptionUtils.isEmpty(getAnnoWebResult().targetNamespace())) { webResultTargetNamespace = getAnnoWebResult().targetNamespace(); } else if (getAnnoSoapBindingStyle() == SOAPBinding.Style.DOCUMENT && getAnnoSoapBindingParameterStyle() == SOAPBinding.ParameterStyle.WRAPPED && !getAnnoWebResultHeader()) { // Default for operation style DOCUMENT and paramater style WRAPPED and the return value // does not map to a header per JSR-181 MR Sec 4.5.1, pg 23-24 webResultTargetNamespace = WebResult_TargetNamespace_DEFAULT; } else { // Default is the namespace from the WebService per JSR-181 MR Sec 4.5.1, pg 23-24 webResultTargetNamespace = ((EndpointDescriptionJava)getEndpointInterfaceDescription() .getEndpointDescription()).getAnnoWebServiceTargetNamespace(); } } return webResultTargetNamespace; }
public void testSOAPBindingDefault() { EndpointInterfaceDescription testEndpointInterfaceDesc = getEndpointInterfaceDesc(SOAPBindingDefaultTestImpl.class); assertNull( ((EndpointInterfaceDescriptionJava)testEndpointInterfaceDesc).getAnnoSoapBinding()); assertEquals(javax.jws.soap.SOAPBinding.Style.DOCUMENT, testEndpointInterfaceDesc.getSoapBindingStyle()); assertEquals(javax.jws.soap.SOAPBinding.Use.LITERAL, testEndpointInterfaceDesc.getSoapBindingUse()); assertEquals(javax.jws.soap.SOAPBinding.ParameterStyle.WRAPPED, testEndpointInterfaceDesc.getSoapBindingParameterStyle()); OperationDescription operationDesc = testEndpointInterfaceDesc.getOperationForJavaMethod("echoString")[0]; // Verify WebResult annotation default values for DOC/LIT/WRAPPED from a defaulted SOAPBinding assertNull(((OperationDescriptionJava)operationDesc).getAnnoWebResult()); assertEquals("return", operationDesc.getResultName()); assertEquals("return", operationDesc.getResultPartName()); assertEquals("", operationDesc.getResultTargetNamespace()); assertFalse(operationDesc.isResultHeader()); }
/** * creates a runtime model <code>SOAPBinding</code> from a <code>javax.jws.soap.SOAPBinding</code> object * @param soapBinding the <code>javax.jws.soap.SOAPBinding</code> to model * @return returns the runtime model SOAPBinding corresponding to <code>soapBinding</code> */ protected SOAPBindingImpl createBinding(SOAPBinding soapBinding) { SOAPBindingImpl rtSOAPBinding = new SOAPBindingImpl(); Style style = soapBinding!=null ? soapBinding.style() : Style.DOCUMENT; rtSOAPBinding.setStyle(style); assert bindingId != null; model.bindingId = bindingId; SOAPVersion soapVersion = bindingId.getSOAPVersion(); rtSOAPBinding.setSOAPVersion(soapVersion); return rtSOAPBinding; }
private void writeSOAPBinding(Port port, JDefinedClass cls) { JAnnotationUse soapBindingAnn = null; isDocStyle = port.getStyle() == null || port.getStyle().equals(SOAPStyle.DOCUMENT); if(!isDocStyle){ soapBindingAnn = cls.annotate(SOAPBinding.class); soapBindingAnn.param("style", SOAPBinding.Style.RPC); port.setWrapped(true); } if(isDocStyle){ boolean first = true; boolean isWrapper = true; for(Operation operation:port.getOperations()){ if(first){ isWrapper = operation.isWrapped(); first = false; continue; } sameParamStyle = (isWrapper == operation.isWrapped()); if (!sameParamStyle) { break; } } if (sameParamStyle) { port.setWrapped(isWrapper); } } if(sameParamStyle && !port.isWrapped()){ if (soapBindingAnn == null) { soapBindingAnn = cls.annotate(SOAPBinding.class); } soapBindingAnn.param("parameterStyle", SOAPBinding.ParameterStyle.BARE); } }
protected void preProcessWebService(WebService webService, TypeElement element) { processedMethods = new HashSet<String>(); seiContext = context.getSeiContext(element); String targetNamespace = null; if (webService != null) targetNamespace = webService.targetNamespace(); PackageElement packageElement = builder.getProcessingEnvironment().getElementUtils().getPackageOf(element); if (targetNamespace == null || targetNamespace.length() == 0) { String packageName = packageElement.getQualifiedName().toString(); if (packageName == null || packageName.length() == 0) { builder.processError(WebserviceapMessages.WEBSERVICEAP_NO_PACKAGE_CLASS_MUST_HAVE_TARGETNAMESPACE( element.getQualifiedName()), element); } targetNamespace = RuntimeModeler.getNamespace(packageName); } seiContext.setNamespaceUri(targetNamespace); if (serviceImplName == null) serviceImplName = seiContext.getSeiImplName(); if (serviceImplName != null) { seiContext.setSeiImplName(serviceImplName); context.addSeiContext(serviceImplName, seiContext); } portName = ClassNameInfo.getName(element.getSimpleName().toString().replace('$', '_')); packageName = packageElement.getQualifiedName(); portName = webService != null && webService.name() != null && webService.name().length() > 0 ? webService.name() : portName; serviceName = ClassNameInfo.getName(element.getQualifiedName().toString()) + WebServiceConstants.SERVICE.getValue(); serviceName = webService != null && webService.serviceName() != null && webService.serviceName().length() > 0 ? webService.serviceName() : serviceName; wsdlNamespace = seiContext.getNamespaceUri(); typeNamespace = wsdlNamespace; SOAPBinding soapBinding = element.getAnnotation(SOAPBinding.class); if (soapBinding != null) { pushedSoapBinding = pushSoapBinding(soapBinding, element, element); } else if (element.equals(typeElement)) { pushedSoapBinding = pushSoapBinding(new MySoapBinding(), element, element); } }
@Override public Void visitExecutable(ExecutableElement method, Object o) { // Methods must be public if (!method.getModifiers().contains(Modifier.PUBLIC)) return null; if (processedMethod(method)) return null; WebMethod webMethod = method.getAnnotation(WebMethod.class); if (webMethod != null && webMethod.exclude()) return null; SOAPBinding soapBinding = method.getAnnotation(SOAPBinding.class); if (soapBinding == null && !method.getEnclosingElement().equals(typeElement)) { if (method.getEnclosingElement().getKind().equals(ElementKind.CLASS)) { soapBinding = method.getEnclosingElement().getAnnotation(SOAPBinding.class); if (soapBinding != null) builder.log("using " + method.getEnclosingElement() + "'s SOAPBinding."); else { soapBinding = new MySoapBinding(); } } } boolean newBinding = false; if (soapBinding != null) { newBinding = pushSoapBinding(soapBinding, method, typeElement); } try { if (shouldProcessMethod(method, webMethod)) { processMethod(method, webMethod); } } finally { if (newBinding) { popSoapBinding(); } } return null; }
/** * Retrieve the pane configuration for a pane token. */ @WebMethod(operationName = "GetPaneConfiguration", action = "http://www.onvif.org/ver10/display/wsdl/GetPaneConfiguration") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "GetPaneConfigurationResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public GetPaneConfigurationResponse getPaneConfiguration( @WebParam(partName = "parameters", name = "GetPaneConfiguration", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") GetPaneConfiguration parameters );
/** * List all currently defined panes of a device for a specified video output * (regardless if this pane is visible at a moment). A Pane is a display area on the monitor that is attached to a video output. A pane has a * PaneConfiguration that describes which entities are associated with the pane. A client has to configure the pane according to the connection to be established by setting the * AudioOutput and/or AudioSourceToken. If a Token is not set, the corresponding session will * not be established. */ @WebMethod(operationName = "GetPaneConfigurations", action = "http://www.onvif.org/ver10/display/wsdl/GetPaneConfigurations") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "GetPaneConfigurationsResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public GetPaneConfigurationsResponse getPaneConfigurations( @WebParam(partName = "parameters", name = "GetPaneConfigurations", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") GetPaneConfigurations parameters );
/** * Return the current layout of a video output. The Layout assigns a pane configuration to a certain area of the display. The layout settings * directly affect a specific video output. The layout consists of a list of PaneConfigurations and * their associated display areas. */ @WebMethod(operationName = "GetLayout", action = "http://www.onvif.org/ver10/display/wsdl/GetLayout") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "GetLayoutResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public GetLayoutResponse getLayout( @WebParam(partName = "parameters", name = "GetLayout", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") GetLayout parameters );
/** * Change the layout of a display (e.g. change from * single view to split screen view).The Layout assigns a pane configuration to a certain area of the display. The layout settings * directly affect a specific video output. The layout consists of a list of PaneConfigurations and * their associated display areas. * A device implementation shall be tolerant against rounding errors when matching a layout against its fixed set of layouts by accepting differences of at least one percent. */ @WebMethod(operationName = "SetLayout", action = "http://www.onvif.org/ver10/display/wsdl/SetLayout") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "SetLayoutResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public SetLayoutResponse setLayout( @WebParam(partName = "parameters", name = "SetLayout", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") SetLayout parameters );
/** * Delete a pane configuration. A service must respond with an error if the pane configuration * is in use by the current layout. * This optional method is only supported by devices that signal support of dynamic pane creation via their capabilities. * */ @WebMethod(operationName = "DeletePaneConfiguration", action = "http://www.onvif.org/ver10/display/wsdl/DeletePaneConfiguration") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "DeletePaneConfigurationResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public DeletePaneConfigurationResponse deletePaneConfiguration( @WebParam(partName = "parameters", name = "DeletePaneConfiguration", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") DeletePaneConfiguration parameters );
/** * Create a new pane configuration describing the streaming and coding settings for a display area. * This optional method is only supported by devices that signal support of dynamic pane creation via their capabilities. * The content of the Token field may be ignored by the device. * */ @WebMethod(operationName = "CreatePaneConfiguration", action = "http://www.onvif.org/ver10/display/wsdl/CreatePaneConfiguration") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "CreatePaneConfigurationResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public CreatePaneConfigurationResponse createPaneConfiguration( @WebParam(partName = "parameters", name = "CreatePaneConfiguration", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") CreatePaneConfiguration parameters );
/** * Modify one or more configurations of the specified video output. * This method will only modify the provided configurations and leave the others unchanged. * Use to remove pane configurations. */ @WebMethod(operationName = "SetPaneConfigurations", action = "http://www.onvif.org/ver10/display/wsdl/SetPaneConfigurations") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "SetPaneConfigurationsResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public SetPaneConfigurationsResponse setPaneConfigurations( @WebParam(partName = "parameters", name = "SetPaneConfigurations", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") SetPaneConfigurations parameters );
/** * This command changes the configuration of the specified pane (tbd) */ @WebMethod(operationName = "SetPaneConfiguration", action = "http://www.onvif.org/ver10/display/wsdl/SetPaneConfiguration") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "SetPaneConfigurationResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public SetPaneConfigurationResponse setPaneConfiguration( @WebParam(partName = "parameters", name = "SetPaneConfiguration", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") SetPaneConfiguration parameters );
/** * The Display Options contain the supported layouts (LayoutOptions) and the decoding and * encoding capabilities (CodingCapabilities) of the device. The GetDisplayOptions command * returns both, Layout and Coding Capabilities, of a VideoOutput. */ @WebMethod(operationName = "GetDisplayOptions", action = "http://www.onvif.org/ver10/display/wsdl/GetDisplayOptions") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "GetDisplayOptionsResponse", targetNamespace = "http://www.onvif.org/ver10/display/wsdl", partName = "parameters") public GetDisplayOptionsResponse getDisplayOptions( @WebParam(partName = "parameters", name = "GetDisplayOptions", targetNamespace = "http://www.onvif.org/ver10/display/wsdl") GetDisplayOptions parameters );
/** * This operation returns the IEEE802.11 capabilities. The device shall support * this operation. */ @WebMethod(operationName = "GetDot11Capabilities", action = "http://www.onvif.org/ver10/device/wsdl/GetDot11Capabilities") @SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE) @WebResult(name = "GetDot11CapabilitiesResponse", targetNamespace = "http://www.onvif.org/ver10/device/wsdl", partName = "parameters") public GetDot11CapabilitiesResponse getDot11Capabilities( @WebParam(partName = "parameters", name = "GetDot11Capabilities", targetNamespace = "http://www.onvif.org/ver10/device/wsdl") GetDot11Capabilities parameters );