Example: Writing the WSDL extension that enables your WSIF service to invoke a method on a local Java object
Use the WSIF Java provider, WSIF can invoke Java code. This means that, in a thin-client environment such as a JVM or Tomcat test run-time environment, you can define shortcuts to local Java programs. Use this information, and associated code fragments, to help you to write the WSDL extension that links your WSIF service to a local Java application.
The Web Services Invocation Framework (WSIF) Java provider is not intended for use in a J2EE 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.
The 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 Java provider requires that the targeted Java classes reside in 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 Java provider is not transactional.
The Java provider does not support the WSIF synchronous timeout. The Java provider will not time out waiting for a Java method to complete.
To use the Java provider, we need the following binding specified in the WSDL file:
Example
<!-- 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 white 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.
In the next example, 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>
Related tasks
Linking a WSIF service to a SOAP over HTTP service
Linking a WSIF service to a JMS-provided service
Linking a WSIF service to the underlying implementation of the service
Related Reference
Example: Writing the WSDL extension that enables your WSIF service to invoke an enterprise bean
Reference topic