Skip to end of metadata
Go to start of metadata

Contents


 

How to configure a Service Consumer

To configure a consumer to access a particular service, you need to create and configure one or more logical ports.
A logical port is created for a specific consumer proxy to access one particular binding on the provider system.
You can create more than one logical port for the same consumer proxy. However, each logical port can point to only one binding.

Concept

The logical port is based on the WSDL document generated for a binding. The WSDL document describes how to access the binding, and includes the URLs for all the bindings defined for a service.

Prerequisites

You can create a logical port based on a WSDL document or manually.

To use the WSDL based configuration the binding WSDL has to be used, not the design time WSDL. The binding WSDL can only be generated after a binding was created for the provider in transaction SOAMANAGER.

Depending on the way you choose to create a logical port, you need the following information:

Method to Create a Logical Port

What You Need to Know

Based on the WSDL document for a service

  • The URL that points to the WSDL document for the service.
    This is the URL for the binding that was generated for the Web service provider.
  • The access parameters for the WSDL document
    (Alternatively, you have the WSDL document stored as a file.)

Manually
If a WSDL document is not available, you need to create a logical port manually.

  • The URL of the binding
  • The configuration settings that the provider expects

Procedure

  1. From the main screen of SOA Manager, go to the Service Administration tab.
  2. Select Web Service Configuration.
  3. In the Search by menu, choose Consumer Proxy.
  4. In the Search Pattern field, specify a consumer proxy or a search string.
    Here, we will use CO_SRT_TEST_PROVIDER.



  5. Select the row with the consumer proxy and choose Apply Selection.
    Design-time information about the consumer proxy is displayed.
  6. Go to the Configurations tab.
    An overview of logical ports is displayed if any have been created.

  7. To create a new logical port, choose Create.
    A dialog box is displayed.
  8. Specify the following information for the new logical port.

                                                           

    Here, we will use the name CO_SRT_TEST_PROVIDER2.
  9. Select the configuration type WSDL-Based Configuration.
    For WSDL-Based Configuration, the system extracts the binding URL from the WSDL document for the service.
  10. Specify the WSDL access settings.
    Here, use Via HTTP access. Additionally, you need to specify the path to the WSDL document and a user and password.

    The user for WSDL Access needs to be authorized to access the WSDL in the system you are working in.


    For URL for WSDL Access, you need the URL for the binding generated for the Web service provider.

  11. Choose Apply Settings.
    A dialog box displays overview of bindings that could be used for this logical port.

  12. Select the appropriate binding for your logical port.
  13. Choose Apply Settings.
    The logical port is now created in memory.
  14. If an authentication method is used, go to the Consumer Security tab and specify a user and a password.

    The user must have runtime access and application authorization.

  15. Save.
    The new logical port with the default settings is created and displayed in the overview.
  16. Optionally, you can check whether the logical port can access the binding by selecting the consumer proxy and choose Ping Web Service.

Result

You now have created a logical port which can be used in your application to send a SOAP message to the respective Web Service Provider.

Example Application Code Snippet

To invoke a Web Service you could use the following code snippet as an example:

data lr_consumer_proxy type ref to co_my_consumer_proxy.

" instantiate consumer proxy
CREATE OBJECT lr_consumer_proxy
EXPORTING
logical_port_name = 'MY_LOGICAL_PORT_NAME'.

" invoke WebService operation
lr_consumer_proxy->my_webservice_operation( ... ).

Quick Testing

It's also possible to test the Consumer Proxy without creating a program, using transaction SE80. Follow these steps to trigger a test-call:

  1. Go to transaction SE80 and display the Consumer Proxy object (Edit Object > Enhanced Options > Enterprise Services > Client Proxy).
  2. Click on the Test (F8) button. 
  3. On the selection screen specify the Logical Port and select the Method.
  4. Click on Execute (F8).
  5. With the XML Editor (Ctrl+F2) you can edit the input values of the request XML.
  6. To trigger the call, click on Execute (F8).

1 Comment

  1. Thanks for the article. (smile)

    I have a query regarding logical port and could not find answer to it. Would appreciate if you could help.

    I wanted to know the details regarding Logical Port for Consumer Mapping (not the Consumer Proxy). I have a scenario in which I am using a Consumer Mapping to map asynchronous source consumer proxy to synchronous target consumer proxy. I have also created a Logical Port for Consumer Mapping and mapped it to the Logical Port of target consumer proxy in SOAMANAGER. However, I did not understand the real use of Consumer Mapping Logical Port.

    Moreover, even though I have mapping between Logical Port for Consumer Mapping and the Logical Port of target consumer proxy, I still have to call the consumer proxy using logical port via coding. Same as below - 

    " instantiate consumer proxy
    CREATE OBJECT lr_consumer_proxy
    EXPORTING
    logical_port_name = 'MY_LOGICAL_PORT_NAME'.

    " invoke WebService operation
    lr_consumer_proxy->my_webservice_operation( ... ).

    If I have the mapping configured, then why it is required to create an object reference using Logical Port Name? Can't system determine the target logical port from the consumer mapping?

    I would appreciate if I could get some advice on consumer mapping logical port usage.

    Thank you.

    Regards,

    Sud