• Entries (RSS)
  • Comments (RSS)

Dynamically assign web service endpoint urls

Posted by | Posted in Websphere Process Server / Integration Developer | Posted on 04-03-2009

Tagged Under : , , , ,

Dynamically assign web service endpoint urls

How do we assign an end point URL dynamically to a web service in WebSphere Process Server? Or how do we change the endpoint URL of the web service. If any our business process invokes an external web service, we may need to change the web service URLs for different environments. For e.g.: for DEV WPS server we will have one web service end point URL where for PROD there will be a different one. So in this case we should be able to set the endpoint urls dynamically depending on the environment so that we do not need to change our EAR file for each environment.

To assign a dynamic end point url for an external web service we have two different ways. One needs some administrative effort and one needs some programmatic effect.

To change the endpoint url from the admin console follow the below steps.

1. Login to your admin console

2. Click on Applications -> SCA Modules from the left hand Menu

sca_module

3. This will list all the SCA Modules installed in your server.

sca_module_display

4. Now click on your module.

sca_module_details

5. Now from Module components click on Imports. It will display all the imports present in your module. Expand the import for which you want to change the end point url. Once expanded, expand Binding which will display your service.

sca_module_component

6. Now click on the web service import.

webservice_import_binding

7. Enter the new endpoint url and click on Apply and OK.

I will blog about the second way of assigning a dynamic end point url for a webservice import in the next post.

Share

Read More

Comments

9 comments posted onDynamically assign web service endpoint urls

  1. Hi,
    Nice concise explanation. I’m new to WebSphere and the Process Server. I’m looking at a SCA component written by somebody else. I want to send a SOAP message to the component but I don’t see any imports. There are exports defined. Is there a way to send a SOAP message to a component from an external client without defining imports?
    If you know of a guide or site that discusses the specifics of making a SOAP call to a component I’d be grateful for the pointer. I’m Googling all over without much luck.

    Thanks.

    Doug

  2. This might be helpful if you are to design a business process which invokes services whose endpoint references are determined at runtime.

    PS: A caveat in this approach is that it works only if the service being looked up is exported using web service binding.

    EndpointReferenceFactory eprFactory = EndpointReferenceFactory.INSTANCE;
    epr = eprFactory.createEndpointReference();
    epr.setService(new QName(, ));
    epr.setAddress();
    epr.setPort();

    setServiceRefToPartnerLink(“”,epr);

    The values within can be configured externally (DB or properties file).

  3. The page ate up the text within “less than” and “greater than” symbols. Reposting…

    EndpointReferenceFactory eprFactory = EndpointReferenceFactory.INSTANCE;
    epr = eprFactory.createEndpointReference();
    epr.setService(new QName({importNamespace}, {importService}));
    epr.setAddress({address});
    epr.setPort({port});
     
    setServiceRefToPartnerLink({Partner Name},epr);

    The values {} within can be configured externally (DB or properties file).

  4. Hi Albin,

    Very informative post. You mentioned in this post that you will blog about another way of dynamic binding in the next post. I am eagerly waiting for that post. Please post the link here in case you have already blogged about it.

    Thanks,
    Sunil

  5. I did not make that post yet. I will inform you once that is done. Sorry for the inconvenience.

  6. Hi – Is there any catch in this approach when we generate an EAR and try to deploy it on a run-time WPS server ?

    I had turned on WS-Addressing Schema on in WID and generated the EAR , but I get the following exception when I try to publish the EAR -

    ejbModule/sca/webservice/client/LookupServiceImport.java(12): Syntax error, annotations are only available if source level is 5.0

  7. I was just going through the preferences window. I see something related to XSD annotations. May be this could be the reason. Go to Window -> preferences -> Business Integration -> WSDL/Interface Export and check the checkbox. May be this helps.

  8. Ashwin,

    I have used the piece of code published by you. the setServiceRefToPartnerLink is throwing an error as shown below .. Any suggestions

    The method setServiceRefToPartnerLink(String, DataObject) in the type GeneratedCompilationUnitName_1297949569183 is not applicable for the arguments (String, EndpointReference)

  9. Albin,

    Nice post. By any chance, did you blog about the other way of dynamic binding? Iam waiting for the post.

    Thanks
    Santosh

Post a Comment