Using the Web Services Invocation Framework (WSIF) Java™ provider, WSIF can invoke Java code. This means that, in a
thin-client environment such as a Java virtual
machine (JVM) or Tomcat test runtime environment, you can define shortcuts
to local Java programs. Use
this procedure to help you to write the Web Services Description Language
(WSDL) extension that links your WSIF service to a local Java application.
Before you begin
The WSIF Java provider
is not intended for use in a Java Platform,
Enterprise Edition (Java EE)
environment. There is a difference between a client using the WSIF Java provider to invoke a Java component, and implementing
a web service as a Java component
on the server side.
About this task
The WSIF Java binding
exploits the format binding for type mapping. Using the format binding,
your WSDL can define the mapping between XML schema types and Java types.
The WSIFJava provider requires the targeted Java classes to be on the class
path of the client. The Java method
is invoked synchronously, in-process, in-thread, with the current
thread and Object Request Broker (ORB) contexts.
The WSIF Java provider is not transactional.
The
WSIF Java provider does not
support the WSIF synchronous timeout. The Java provider will not time out waiting for
a Java method to complete.
Use
the following procedure, and associated code fragments, to help you
to specify the WSDL extension that enables your WSIF service to invoke
a method on a local Java object.
Procedure
- Specify the Java binding.
To use the Java provider, you need the following
binding specified in the WSDL file:
<!-- Java binding -->
<binding .... >
<java:binding />
<format:typeMapping style="Java" encoding="Java"/>?
<format:typeMap name="qname" formatType="nmtoken"/>*
</format:typeMapping>
<operation>*
<java:operation
methodName="nmtoken"
parameterOrder="nmtoken"
returnPart="nmtoken"?
methodType="instance|constructor" />
<input name="nmtoken"? />?
<output name="nmtoken"? />?
<fault name="nmtoken"? />?
</operation>
</binding>
In this example:
- A question mark (
?) means optional, and an asterisk
(*) means 0 or more.
- The
name attribute of the <format:typeMap> element
is a qualified name of a simple or complex type used by one of the Java operations.
- The
formatType attribute of the <format:typeMap> element
is the fully qualified class name for the Java class to which the element specified by name maps.
- The
methodName attribute of the <java:operation> element
is the name of the method on the Java object
that is called by the operation.
- The
parameterOrder attribute of the <java:operation>
element contains a space-separated list of part names that define the order in which they are passed
to the Java object method.
- The
methodType attribute of the <java:operation> element
must be set to either instance or constructor.
The value specifies whether the method that is invoked on the object
is an instance method or a constructor for the object.
- Specify the
<java:address> element.
The className attribute of the <java:address> element
specifies the fully qualified class name of the object containing
the method to invoke:
<service ... >
<port>*
<java:address
className="nmtoken"/>
</port>
</service>