Configuring Service Endpoints
You must configure your application to use the endpoint addresses exposed by the particular BPM services you need to use.
The WSDL files used to generate the WCF clients contain default endpoint addresses:
- A WSDL extracted from the public API uses a default of
http://localhost:8080/servicePath. For example:
<wsdl:service name="EntityResolverService"> <wsdl:port name="EntityResolverService_EP" binding="impl:EntityResolverService_EP"> <soap:address location="http://localhost:8080/amxbpm/EntityResolverService"/ </wsdl:port> </wsdl:service> <wsdl:service name="WorkListService"> <wsdl:port name="WorkListService_EP" binding="impl:WorkListService_EP"> <soap:address location="http://localhost:8080/amxbpm/WorkListService"/ </wsdl:port> </wsdl:service>
- A WSDL generated for a service from TIBCO Administrator uses a default of
http://0.0.0.0:8080/servicePath. For example:
<wsdl:service name="WorkManager_implementation.de_1.2.0.001_service_EntityResolverService_1.2.0_EntityResolverService_EntityResolverService"> <wsdl:port name="EntityResolverService.soap" binding="tns:EntityResolverService.soap"> <soap:address location="http://0.0.0.0:8080/amxbpm/EntityResolverService"/ </wsdl:port> </wsdl:service>
If necessary, you should reconfigure these endpoints to values appropriate to your requirements (either programmatically or via configuration).
BPMTestApplication allows a user to select the BPM runtime to which they want to connect. It therefore includes logic to dynamically set the endpoint before calling a BPM service.
The ServiceClientFactory.cs file defines the ServiceClientFactory class. This class is the central entry point used to acquire the WCF client classes (defined in the services.cs file) which are used to call the BPM services.
ServiceClientFactory uses the following methods to configure the endpoints to be used to contact each BPM service. The methods use the data gathered from the user in the Login dialog (Host, Port and Use HTTPS values) to dynamically configure each endpoint.
Method | Description |
---|---|
GetEntityResolverClient, GetWorkItemManagementServiceClient, GetWorkListServiceClient | Gets the WCF client that calls the indicated service. |
GetEntityUrl, GetWorkItemManagementServiceURL, GetWorkListServiceURL | Returns the URL for the indicated service. |
GetUrl, GetBaseURL | Generic methods, used by the Get*Url methods, to generate a URL for the service endpoint. |
CreateHttpBinding | Creates an HTTP or HTTPS binding for the endpoint. |
For example, the GetWorkListServiceClient method creates a new WorkListServiceClient object.
public WorkListServiceClient GetWorkListServiceClient() { WorkListServiceClient clnt = new WorkListServiceClient( CreateHttpBinding("WorkListService.soap"), new EndpointAddress(GetWorkListServiceUrl())); clnt.Endpoint.Behaviors.Add(SecurityBehavior); return (clnt); } |
GetWorkListServiceClient uses the following methods:
- CreateHttpBinding is used to create the appropriate HTTP binding type - defining whether the SOAP message will be sent over HTTP (unsecured) or HTTPS (secured). The
_secure value is derived from the
Use HTTPS checkbox in the
Login dialog.
private BasicHttpBinding CreateHttpBinding(String name) { BasicHttpBinding binding; if (_secure) { binding = new BasicHttpBinding(BasicHttpSecurityMode.Transport); binding.Security.Transport.ClientCredentialType= HttpClientCredentialType.None; } else { binding = new BasicHttpBinding(BasicHttpSecurityMode.None); } binding.Name = name; return binding; }
- GetWorkListServiceUrl is used to build the endpoint address string. The _host, _port and _secure values are derived from the Host, Port and Use HTTPS fields from the Login dialog.