Controlling Server Configuration at Runtime

SOAP/AM Server Development > Advanced Topics >

Controlling Server Configuration at Runtime

Previous pageReturn to chapter overviewNext page

Service Definitions are typically configured to use a fixed set of server process names or Pathway serverclass names. Using the Server Group feature, it's possible to configure multiple groups of servers to be used by the service, and allow the client application to select the Server Group at runtime. For example, the following SDF fragment illustrates the server configuration for a fictitious Customer Account application. Using this configuration the service will always use the serverclasses in the $APP Pathway.

 

<servers>

 <server name="customerServer" processName="$APP" serverClass="CUSTOMER" />

 <server name="accountsServer" processName="$APP" serverClass="ACCOUNTS" />

</servers>

 

However, it may be desirable to configure multiple groups of servers that will use, for example, development or test Pathways. This can be achieved by configuring additional sets of servers in server groups as shown in the fragment below.

 

<servers>

 <server name="customerServer" processName="$APDEV" serverClass="CUSTOMER" />

 <server name="accountsServer" processName="$APDEV" serverClass="ACCOUNTS" />

 <serverGroup name="production">

         <server name="customerServer" processName="$APP" serverClass="CUSTOMER" />

         <server name="accountsServer" processName="$APP" serverClass="ACCOUNTS" />

 </serverGroup>

 <serverGroup name="qa">

         <server name="customerServer" processName="$APQA" serverClass="CUSTOMER" />

         <server name="accountsServer" processName="$APQA" serverClass="ACCOUNTS" />

 </serverGroup>

</servers>

 

Using this configuration, requests will by default be sent to the $APDEV Pathway. However, an alternate server group may be selected by the client application by configuring the serverGroup header for the method and by supplying the serverGroup SOAP header in the request. The header should be configured for the method as follows:

 

<method name="getCustomerInfo" server="customerServer">

 <headers>

         <header name="serverGroup" type="serverGroupType" namespace="http://soapam.com/types/" direction="in" />

 </headers>

 <parameters>

         <parameter name="result" type="customerInfoType" direction="out" />

         <parameter name="customerNumber" type="string" direction="in" />

 </parameters>

 ...

</method>

 

The serverGroup header has the following structure:

 

<ns:serverGroup xmlns:ns="http://soapam.com/types/">

 <ns:name>group name</ns:name>

</ns:serverGroup>

 

The following example shows a fictitious SOAP request that selects the "qa" server group. Because the serverGroup header is present and selects the "qa" group, the Pathway requests will be sent to the $APQA Pathway. If the header were not present, requests would be send to the default Pathway $APDEV.

 

<s:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">

   <s:Header>

      <n0:serverGroup xmlns:n0="http://soapam.com/types/" >

         <n0:name>qa</n0:name>

      </n0:serverGroup>

   </s:Header>

   <s:Body>

      <n1:getCustomerInfo xmlns:n1="http://example.com/example">

         <n1:customerNumber>123456</n1:customerNumber>

      </n1:getCustomerInfo>

   </s:Body>

</s:Envelope>

 

Note that it is possible to configure only server groups, with no default servers, as shown below. Using this configuration, if a serverGroup header is not present in the request, an error will be returned to the client.

 

<servers>

 <serverGroup name="production">

         <server name="customerServer" processName="$APP" serverClass="CUSTOMER" />

         <server name="accountsServer" processName="$APP" serverClass="ACCOUNTS" />

 </serverGroup>

 <serverGroup name="qa">

         <server name="customerServer" processName="$APQA" serverClass="CUSTOMER" />

         <server name="accountsServer" processName="$APQA" serverClass="ACCOUNTS" />

 </serverGroup>

 <serverGroup name="dev">

         <server name="customerServer" processName="$APDEV" serverClass="CUSTOMER" />

         <server name="accountsServer" processName="$APDEV" serverClass="ACCOUNTS" />

 </serverGroup>

</servers>