Skip to topic | Skip to bottom
Grimoires
Grimoires.JavaManual

Start of topic | Skip to actions

Grimoires client Java API Tutorial

WSDL2Java: Building client Java API from WSDL files

A WSDL (Web Service Description Language) file explicitly defines the technical interface of a Web Service. Axis provides a "WSDL2Java" tool to generate stubs, skeletons, and data types from WSDL files. Stubs are client-side bindings, skeleton are server-side bindings, and data types are Java objects corresponding to XML types defined in XML schemas. Please refer to the WSDL2Java documentation for how to use WSDL2Java.

Grimoires provides the WSDL files and associated XML schemas for all its interfaces. Developers can use WSDL2Java to generate Java stubs from them, and use the stubs to interact with Grimoires. Below we use Grimiores' WSDL interface as an example to demonstrate the usage of Grimoires client Java API generated from the WSDL file using WSDL2Java.

WSDL Interface

The simplest way to invoke the WSDL interface is to use Axis' wsdl2java to generate the stub from wsdl.wsdl, then use the stub to communicate with Grimoires.

Java API Reference

addWSDLFile

public String addWSDLFile(String filename) throws RemoteException; 

Add a WSDL file to the repository.

Parameters:

filename - a string representing the url of the wsdl file.

Returns:

a string representing the WSDL key, which is the UUID for this WSDL file.

addWSDLFileAdvert

public String addWSDLFileAdvert(AddWSDLFileAdvertRequest body) throws RemoteException;

public class AddWSDLFileAdvertRequest  implements java.io.Serializable {
    private java.lang.String url;
    private java.lang.String content;
    ......
}

Add a WSDL file with content to the repository.

Parameters:

body - contain a string representing the url of the wsdl file, and a string representing the content of wsdl file.

Returns

a string representing the WSDL key, which is the UUID for this WSDL file.

getWSDLAdvertContent

public String getWSDLAdvertContent(String key) throws RemoteException;

Return the WSDL content of the advert identified by the given key.

parameters:

key - WSDL key.

Returns:

the content of WSDL file.

getWSDLAdvertContentByURL

public String getWSDLAdvertContentByURL(String wsdlURL);

Return the WSDL content of the advert identified by the url of WSDL.

Parameters:

wsdlURL - the url of WSDL file.

Returns:

the content of WSDL file.

removeWSDLFile

public boolean removeWSDLFile(String filename) throws RemoteException;

Remove a WSDL file from the repository.

Parameters:

filename - the url of WSDL file.

Returns:

true or false indicating whether the deletion operation is successful.

findServicesByInterface

public FindServicesByInterfaceResponse findServicesByInterface(String filename) throws RemoteException;

public class FindServicesByInterfaceResponse  implements java.io.Serializable {
    private java.lang.String[] wsdlKey;
    ......
}

Return all UDDI services that are registered as implementing the WSDL interface at the given url.

Parameters:

filename - the url of wsdl file.

Returns:

the UDDI service keys.

getAllWSDLFiles

public GetAllWSDLFilesResponse getAllWSDLFiles() throws RemoteException;

public class GetAllWSDLFilesResponse  implements java.io.Serializable {
    private java.lang.String[] url;
    ......
}

Return the URLs of all WSDL adverts registered in Grimoires.

Parameters:

Returns:

the urls of all registered WSDLs.

getOperationsByURL

public GetOperationsByURLResponse getOperationsByURL(String url) throws RemoteException;

public class GetOperationsByURLResponse  implements java.io.Serializable {
    private OperationDetail[] operationDetail;
    ......
}


class OperationDetail {
    java.lang.String portTypeNamespace; // PortType namespace
    java.lang.String portTypeName;      // PortType name
    java.lang.String operationName;     // Operation name
}

Get the names of all operations in a WSDL file.

Parameters:

url - the url of the WSDL.

Returns:

an array of OperationDetail? that describes the names of all operations defined in this WSDL. Each OperationDetail? unambiguously describes the name of an operation.

getInputMessageOfOperation

getOutputMessageOfOperation

getFaultMessageOfOperation

public MessageDetail getInputMessageOfOperation(OperationDetail opDetail) throws RemoteException;
public MessageDetail getOutputMessageOfOperation(OperationDetail opDetail) throws RemoteException;
public MessageDetail getFaultMessageOfOperation(OperationDetail opDetail) throws RemoteException;

class MessageDetail {
    java.lang.String messageNamespace; // Message namespace
    java.lang.String messageName;      // Message name
    java.lang.String[] partName;       // Names of message parts
}

Get the input, output, or fault message information for a certain operation.

Parameters:

opDetail - an OperationDetail? object describing a certain operation.

Returns:

an MessageDetail? object that gives the information for an input, output, or fault message: the namespace of the message, the name of the message, and the names of all parts of the message.

-- WeijianFang - 25 Aug 2005
to top


Copyright 2004 by the University of Southampton