Details of the Generated Web Service and Client Classes
For reference, this topic provides information on the classes generated by %SOAP.WSDL.ReaderOpens in a new tab.
Overview of the Generated Classes
%SOAP.WSDL.ReaderOpens in a new tab generates classes as follows:
-
It generates the web client class, the web service class, or both, according to how you use %SOAP.WSDL.ReaderOpens in a new tab. If created, the web client class extends %SOAP.WebClientOpens in a new tab. If created, the web service class extends %SOAP.WebServiceOpens in a new tab.
In each of these classes, there is one web method for each web method defined in the WSDL. For a web client, the method looks like the following example:
Method DemoMethod() As %String [ Final, SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ] { Quit ..WebMethod("DemoMethod").Invoke($this,"https://tempuri.org/Demo.MyService.DemoMethod") }
For a web service, the method looks like the following:
Method DemoMethod() As %String [ Final, SoapAction = "https://tempuri.org/Demo.MyService.DemoMethod", SoapBindingStyle = document, SoapBodyUse = literal, WebMethod ] { // Web Service Method Implementation Goes Here. }
-
For each complex type that is used as input or output to a web method, there is an XML-enabled class.
-
For each complex type that is a component of the preceding types, there is an XML-enabled class.
%SOAP.WSDL.ReaderOpens in a new tab does this recursively so that the properties of the least complex type are simple datatype properties, which correspond directly to XSD types.
In these classes, the system specifies the class and method keywords and parameters as needed to specify encoding and binding style, namespace assignment, and other items.
Keywords That Control Encoding and Binding Style
The generated web client and web service classes contain settings for the following keywords, which control the encoding and message style needed to work with the given WSDL:
-
SoapBodyUse class keyword
-
SoapBodyUse method keyword
-
SoapBindingStyle class keyword
-
SoapBindingStyle method keyword
You should not modify these keywords, because the web client or web service would no longer obey the WSDL. For details on them, see the Class Definition Reference.
Parameters and Keywords That Control Namespace Assignment
The generated classes contain parameters and keywords to control namespace assignments. The following subsections discuss namespaces for messages and namespaces for types.
You should not modify these values, because the web client or web service would no longer obey the WSDL. For details on SoapNameSpace and SoapTypeNameSpace, see the Class Definition Reference.
Namespaces for the Messages
The following values control the namespaces used for the SOAP messages:
Item | Value Given by %SOAP.WSDL.ReaderOpens in a new tab |
---|---|
NAMESPACE (class parameter) | Namespace of the request messages, if all request messages use the same namespace. |
SoapNameSpace (method keyword) | Namespace of a given request message, if request messages use different namespaces. |
RESPONSENAMESPACE (class parameter) | Namespace of the response messages. If this is not specified, the response messages are in the namespace given by the NAMESPACE parameter. Note that the SoapNameSpace keyword has no effect on the namespaces of the response messages. |
Namespaces for the Types
The message types are assigned to namespaces as follows:
Item | Value Given by %SOAP.WSDL.ReaderOpens in a new tab |
---|---|
TYPENAMESPACE (class parameter) | %SOAP.WSDL.ReaderOpens in a new tab sets this parameter if all methods refer to types in the same namespace. |
RESPONSETYPENAMESPACE (class parameter) | %SOAP.WSDL.ReaderOpens in a new tab sets this parameter if the WSDL uses document-style binding and the response messages use types in a different namespace than the request messages. This parameter applies to all methods in the class. Note that all response types are assumed to be in the same namespace as each other. |
SoapTypeNameSpace (method keyword) | Value of the targetNamespace attribute of the <s:schema> element. %SOAP.WSDL.ReaderOpens in a new tab sets this keyword per method if methods use types from different namespaces.
This keyword does not override the RESPONSETYPENAMESPACE parameter. |
Creation of Array Properties
By default, %SOAP.WSDL.ReaderOpens in a new tab creates array-type properties in certain scenarios. You can use the NoArrayProperties option to create properties with a different structure if needed.
Specifically, consider a WSDL that includes the following types:
<s:complexType name="Obj">
<s:sequence>
<s:element minOccurs="0" name="MyProp" type="test:Array"/>
</s:sequence>
</s:complexType>
<s:complexType name="Array">
<s:sequence>
<s:element maxOccurs="unbounded" minOccurs="0" name="Item" nillable="true" type="test:Item"/>
</s:sequence>
</s:complexType>
<s:complexType name="Item">
<s:simpleContent>
<s:extension base="s:string">
<s:attribute name="Key" type="s:string" use="required"/>
</s:extension>
</s:simpleContent>
</s:complexType>
By default, %SOAP.WSDL.ReaderOpens in a new tab generates the following class:
Class testws.Obj Extends (%RegisteredObject, %XML.Adaptor)
{
Parameter ELEMENTQUALIFIED = 1;
Parameter NAMESPACE = "https://testws.org";
Parameter XMLNAME = "Obj";
Parameter XMLSEQUENCE = 1;
Property MyProp As array Of %String(MAXLEN = "", XMLITEMNAME = "Item",
XMLKEYNAME = "Key", XMLNAME = "MyProp", XMLPROJECTION = "COLLECTION");
}
If you specify NoArrayProperties as 1 when you generate the classes, the property MyProp in generated Obj class is defined as follows instead:
Property MyProp As list Of testws.Item(XMLITEMNAME = "Item", XMLNAME = "MyProp", XMLPROJECTION = "COLLECTION");
This property refers to the following class, which %SOAP.WSDL.ReaderOpens in a new tab also generates:
Class testws.Item Extends (%SerialObject, %XML.Adaptor)
{
Parameter ELEMENTQUALIFIED = 1;
Parameter NAMESPACE = "https://testws.org";
Parameter XMLNAME = "Item";
Parameter XMLSEQUENCE = 1;
Property content As %String(MAXLEN = "", XMLNAME = "content", XMLPROJECTION = "CONTENT");
Property Key As %String(MAXLEN = "", XMLNAME = "Key", XMLPROJECTION = "ATTRIBUTE")
[ Required, SqlFieldName = _Key ];
}
Additional Notes on Web Methods in the Generated Class
This section contains additional notes on the web methods in the generated web client classes.
-
InterSystems IRIS® data platform ensures that each method name is shorter than the limit on method names and is unique. (For information on the length of method names, see General System Limits,) This means that if the method names in the WSDL are longer than this limit, the names of the generated web methods are not the same as in the WSDL.
The algorithm used is not documented and is subject to change without notice.
-
If the soapAction attribute equals "" for a given method in the WSDL (which is valid), it is necessary to make one of the following changes to the generated client class so that this method will work:
-
Set the SOAPACTIONQUOTED parameter equal to 1.
-
Edit the web method in the generated client class. Originally it includes the following contents:
Quit ..WebMethod("HelloWorld").Invoke($this,"")
Edit this to the following:
Quit ..WebMethod("HelloWorld").Invoke($this,"""")
Alternatively, edit the WSDL before generating the web client. If you do so, edit the soapAction attribute to equal """" instead of ""
-