IBM BPM, V8.0.1, All platforms > Authoring services in Integration Designer > Advanced development topics > Adding Java to the application > Use Java in the assembly editor

Calling WSDL interfaces from Java references

In top-down development, if you want a Java™ component or stand-alone references to invoke a component that has a WSDL interface, you do not need to create the Java reference manually. You can wire a Java component to a component with a WSDL interface. The assembly editor automatically adds a reference to the Java component.

You can then choose to generate a Java interface for that reference that matches the WSDL interface on the other component. Otherwise, a WSDL interface will be generated for the reference.

This task applies to situations where you are doing top-down development, creating an assembly diagram before generating a business implementation. You can find out more about top-down development in the topic about that subject. See the related concepts below.

If you want to invoke a component that has a WSDL interface from a Java component, follow these steps. You can use the same steps to invoke a component that has a WSDL interface from stand-alone references. This ability is useful if, for example, you are using Java code, such as a JSP, to access the stand-alone references. For information about using Java classes and EJBs in bottom-up development, see "Calling Java interfaces from WSDL references" in the related tasks below.


Procedure

  1. Create a component with no implementation type.

  2. From the palette, drag a Java component into your assembly diagram to the left of the first component.

  3. Select the untyped component (the one on the right). Click the Add Interface icon,

    , on the component.

  4. In the Add Interface window, select Show WSDL as the interface type and select an existing interface, or click New and type a name for the interface in the Name field.
  5. Draw a wire from the Java component to the component with the WSDL interface. An information message tells you that a matching reference will be generated on the source. You are asked if you want to continue. Click OK.
  6. Next, you are asked if you want to generate a Java reference compatible with the target WSDL interface instead of generating a WSDL reference. Click Yes. By selecting this option, you are able to generate a Java reference on the source. This Java reference allows you to use static methods.

    If you use a WSDL-type reference, use dynamic invocation interface (DII) methods to interact with the target service. With this option, two interfaces are generated – synchronous interfaces and asynchronous interfaces. (The asynchronous interfaces will be created after the build run or when you regenerate the implementation.)

    The generated Java reference on the source will contain the Java interface.

    You will be able to open that interface by selecting the reference and right-clicking to select Open Interface. When you generate the implementation for the Java component, it will have a method to locate the referenced service. If you have already generated the Java implementation before adding the new reference, you can use the Synchronize > to implementation action to regenerate the implementation and add the new methods to it.

    You should not modify this generated code.

    If the WSDL interface is refactored, that is if it is moved or renamed, the generated interfaces will be refactored accordingly. However, if the WSDL interface is deleted, the generated interfaces will still exist. You will get an error message if the WSDL interfaces have been changed without refactoring. To fix the error, you can use the Regenerate Java Interface action on the source reference to regenerate the Java reference code.

    If you have already created a WSDL reference on the Java component to access a component that has a WSDL interface, you can use the Convert to Java Reference action to change the source WSDL reference into a Java reference. Right-click the reference to a Java component to see the pop-up menu, which contains that option. This action creates a Java interface on the reference that is equivalent to the WSDL interface and allows the user to access the target service with static methods.


Example

You cannot draw a wire from a WSDL reference to a Java interface, except in the special circumstance described in "Calling Java interfaces from WSDL references" (see the related tasks below for a link to that topic).

Use Java in the assembly editor


Related concepts:
SCA to Java bridge
Interfaces
Quality of service: Qualifiers for business services
Business services: Top-down development


Related tasks:
Create a Java component
Calling Java interfaces from WSDL references
Overriding the generated Service Component Architecture implementation
Overriding a Service Data Object (SDO) to Java conversion
Create and wiring components


Related reference:
Java to XML conversion