Web service collection files
<override-url> nodes in web service
collection files (.wsc files) as a way to override the defined WSDL
URL. To work with overridden URLs, use the following items: - Public interface IWsiWebserviceConfigurationProvider
- Public API gw.external.configuration.SubstitutionProperties
- Property
ServerOverrideUrlon theWsdlConfigobject.
It is a common practice to set or override specific values of the
WsdlConfig object, such as a sensitive user name and password. Property
ServerOverrideUrl is simply another field on the
WsdlConfig object.
For each web service, it is possible to create a custom implementation of interface
IWsiWebserviceConfigurationProvider that binds to a WSC file through
the <configuration-provider> node. Thus, in your implementation of
IWsiWebserviceConfigurationProvider, it is possible to use API method
SubstitutionProperties.lookupValue to retrieve the override URL then
set the WsdlConfig.ServerOverrideUrl property to this new value.
Example file testClient.wsc
Suppose that you want the ability to provide a WSDL URL for use in a production server environment and a separate WSDL URL for use in all other server environments. Accordingly, you set up file testClient.wsc in a similar fashion to the following code:<webservice-collection ... >
...
<settings>
<configuration-provider>
<type-name>gw.util.TestConfigurationProvider</type-name>
</configuration-provider>
<override-url>
<env>prod</env>
<url>http://someUrl</url>
</override-url>
<override-url>
<url>url_to_be_rewritten</url>
</override-url>
</settings>
...
</webservice-collection>- The
<configuration-provider>node binds class TestConfigurationProvider to this WSC file. Class TestConfigurationProvider manages the URL substitution process. - The code provides for two override URLs. One URL is active in a production
(
prod) environment. The other URL is active in all other environments.
Example file TestConfigurationProvider
The following code shows an implementation of class
gw.util.TestConfigurationProvider. Remember that
testClient.wsc binds this class to the WSC file using the
<configuration-provider> node.
package gw.util
uses gw.external.configuration.SubstitutionProperties
uses gw.xml.ws.IWsiWebserviceConfigurationProvider
uses gw.xml.ws.WsdlConfig
uses javax.xml.namespace.QName
class TestConfigurationProvider implements IWsiWebserviceConfigurationProvider {
override function configure(serviceName: QName, portName: QName, config: WsdlConfig) {
config.Guidewire.Authentication.Username = "..."
config.Guidewire.Authentication.Password = "..."
//Access the plugin through the public API
var newValue = new SubstitutionProperties().lookupValue("ServiceName", "urlForTestWsc")
config.ServerOverrideUrl = newValue
}
}
- The ConfigurationProvider class implements the IWsiWebserviceConfigurationProvider interface.
- The class uses the lookupValue method on the SubstitutionProperties API to retrieve the URL override value.
- The lookupValue method parameter ServiceName is a placeholder for an actual web service name.
- The
ServerOverrideUrlstatement writes the new URL to the non-production<overrideUrl>node in file testClient.wsc.
