Example: Writing the WSDL extension that enables your WSIF service to invoke a method on a local Java object

Using the 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 run-time environment, we 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 Java 2 platform, Enterprise Edition (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:

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