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 component with a Java interface to a component with a WSDL interface. The assembly editor can generate a WSDL or Java reference to match the WSDL interface.

This task applies to situations where you create an assembly diagram before generating a mediation flow implementation.
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 that are backed by Java code, such as a JSP.
  1. In the assembly editor, drag an import from the palette onto the canvas.
  2. Click the Add Interface icon, Add Interface button, on the import.
  3. In the Add Interface dialog box, 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.
  4. From the palette, drag a Java component into your assembly diagram to the left of the import.
  5. Draw a wire from the Java component to the import 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 creating 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 rather than 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 moved, deleted, or changed, the generated interfaces will still exist. You will get an error message if the WSDL interfaces have been changed. 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 on the reference to a Java component to see the context menu, which contains that option.

Note: You cannot draw a wire directly from a WSDL reference to a Java interface. You need to use a mapper, as described in "Calling Java interfaces from WSDL references" (see the related tasks below for a link to the topic).
Related tasks
Configuring components for custom mediation
Calling Java interfaces from WSDL references

Feedback
(C) Copyright IBM Corporation 2005, 2006. All Rights Reserved.