Chapter 29 Class keyword – PropertyClass

Add attribute parameters to the class.

usage

To add attribute parameters to the class, use the following syntax:

Class PropClass.MyClass Extends %RegisteredObject [ PropertyClass = PropClass.MyPropertyClass ] { //class members }
Copy the code

· PropertyClassList · is one of the following:

[ PropertyClass = PropClass.MyPropertyClass ]
Copy the code
  • A comma-separated list of class names, enclosed in parentheses.

details

To add a custom attribute parameter, perform the following operations:

  1. Defines and compiles a class that defines one or more class parameters. Such as:
Class PropClass.MyPropertyClass
{

Parameter MYPARM As %String = "XYZ";

}
Copy the code

These class parameters become attribute parameters in the next step.

  1. In the class that defines the attribute, specifiesPropertyClassThe keyword.

Impact on subclasses

Subclasses inherit the custom behavior that this keyword adds. If a subclass specifies a value for the keyword, that value specifies one or more additional classes that specify parameters for the attributes of the class.

Chapter 30 Class keyword – ServerOnly

Specifies whether this class is projected to the Java client.

usage

To override the default way of projecting classes onto Java clients, use the following syntax:

Class Sample.NewClass1  [ ServerOnly = serveronlyvalue ] { //class members }
Copy the code

Serveronlyvalue is one of the following values:

  • 0 indicates that this class can be projected.
  • 1 means the class will not be projected.

Break down

If the keyword is 1, the class is not projected to the Java client. If the keyword is 0, the class is projected.

Impact on subclasses

This keyword is not inherited.

The default

If you omit this keyword, the class will be projected if it is not a stub (but not if it is).

Chapter 31 Class keywords – Sharded

Specifies whether this class is sharded. Applies only to persistent classes in environments that contain sharded clusters.

usage

To define a class as a shard class, use the following syntax:

Class MyApp.MyClass Extends %Persistent [ Sharded = 1 ]  
{ //class members }
Copy the code

Otherwise, omit this keyword.

Break down

Sharding is a mechanism for extending data storage horizontally. If a class is sharded, instances of the class are distributed on any defined data node in the sharded cluster.

If you have a sharding environment and define a class as unsharded, instances of that class are stored only on the first data node, even though the data is visible to all nodes.

Impact on subclasses

This keyword is inherited.

The default

If you omit this keyword, the class will not be split.

Chapter 32 Class keywords – SoapBindingStyle

Specifies the binding style or SOAP invocation mechanism used by any Web methods defined in this class. This applies only to classes defined as Web services or Web clients.

usage

To specify the binding style used to define the Web Method in this class, use the following syntax:

Class MyApp.MyClass [ SoapBindingStyle = soapbindingstyle ]  { //class members }
Copy the code

Where soapBindingStyle is one of the following:

  • documentDocuments (default) – By default, in this classweb methodUse document-style bindings.

With this binding style, SOAP messages are formatted as documents and usually have only one part.

In SOAP messages, the element usually contains a child element. Each child of the element corresponds to a message part.

  • rpc– By default, this parameter is validweb methoduserpc(Remote procedure call) style binding.

With this binding style, SOAP messages are formatted as multi-part messages.

In a SOAP message, the element contains a child element whose name is taken from the corresponding operation name. This element is a generated wrapper element that contains one child element for each parameter in the method’s argument list.

If SoapBindingStyle is a document, and if ARGUMENTSTYLE is a message, the message style is very similar to RPC;

Important: For manually created Web Services, the default value for this keyword is usually appropriate. When the SOAP wizard is used to generate a Web client or service from a WSDL, InterSystems IRIS sets this keyword to fit that WSDL; If you change this value, the Web client or service may no longer work.

Break down

This keyword allows you to specify the default binding style used by any Web Method defined in this class. It affects the format of the SOAP body (but not any SOAP headers).

You can override the binding style of individual methods by using the SoapBindingStyle method keyword or the SoapBindingStyle query keyword.

Impact on subclasses

This keyword is not inherited.

The default

The default value is document.

Relationship to WSDL

The SoapBindingStyle class keyword specifies the value of the style attribute for the < SOAP :binding> element in the

section of the WSDL. For example, if SoapBindingStyle is a document, the WSDL might look like this:

.<binding .>
    <soap:binding . style="document"/>
    <operation .>
        <soap:operation . style="document"/>.Copy the code

As shown here, in the < Binding > section of the WSDL, the SoapBindingStyle class keyword also specifies the default value for the style attribute of the < SOAP: Operation > element; This property is further controlled by the SoapBindingStyle method keyword.

In contrast, if SoapBindingStyle is RPC, the WSDL can be changed to something like this:

.<binding .>
    <soap:binding . style="rpc"/>
    <operation .>
        <soap:operation . style="rpc"/>.Copy the code

Binding styles also affect

elements, as shown below:

  • If the binding style is a document, the message has only one part by default. Such as:
<message name="AddSoapIn">
    <part name="parameters" ./>
</message>
Copy the code

If the ARGUMENTSTYLE argument is Message, then a message can have multiple parts. Such as:

<message name="AddSoapIn">
   <part name="a" ./>
   <part name="b" ./>
</message>
Copy the code
  • If the binding style isrpc, a message can have multiple parts. Such as:
<message name="AddSoapIn">
    <part name="a" ./>
    <part name="b" ./>
</message>
Copy the code

Impact on SOAP messages

The main effect on SOAP messages is to control whether the SOAP body can contain more than one child element.

For web Methods that use RPC-style bindings and encoded style messages, an example of the request message body is shown below:

<SOAP-ENV:Body SOAP-ENV:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'>
   <types:Add>
      <a href="#id1" /><b href="#id2" />
   </types:Add>
   <types:ComplexNumber id="id1" xsi:type="types:ComplexNumber">
      <Real xsi:type="s:double">10</Real>
      <Imaginary xsi:type="s:double">5</Imaginary>
   </types:ComplexNumber>
   <types:ComplexNumber id="id2" xsi:type="types:ComplexNumber">
      <Real xsi:type="s:double">17</Real>
      <Imaginary xsi:type="s:double">2</Imaginary>
   </types:ComplexNumber>
</SOAP-ENV:Body>
Copy the code

In contrast, an example of a request message body for a Web method that uses literal binding and encoded style messages is shown below:

<SOAP-ENV:Body>
   <tns:Add>
      <tns:a xsi:type="tns:ComplexNumber">
         <Real xsi:type="s:double">10</Real>
         <Imaginary xsi:type="s:double">5</Imaginary>
      </tns:a>
      <tns:b xsi:type="tns:ComplexNumber">
         <Real xsi:type="s:double">17</Real>
         <Imaginary xsi:type="s:double">2</Imaginary>
      </tns:b>
      </tns:Add>
</SOAP-ENV:Body>
Copy the code

In this case, the SOAP body has only one child element.

with%XML.DataSetUsed together

For % xml. DataSet, not all perversions of the SoapBindingStyle and SoapBodyUse keywords are allowed, as summarized in the following table:

type Supported? Supported?
empty SoapBodyUse=literal (default) SoapBodyUse=encoded
SoapBindingStyle=document(default) supported not supported
SoapBindingStyle=rpc supported supported