Many answers:
Gartner regularly publishes a graph on the state of software. The latest (at August 2002) is
The site XMethods (www.xmethods.com) is an open site for registering Web services. It includes
Web services are basically RPC across port 80. They require the following environmental support
An RPC system consists of the following pieces
RPC requirement | SOAP |
---|---|
defined data types | defined by SOAP |
wire format for data | defined by SOAP using XML |
wire format for messages | defined by SOAP over HTTP |
an IDL | defined by WSDL |
generation of client stubs | vendor specific |
generation of server stubs | vendor specific |
linking implementation | vendor specific |
Web services use data types that can be supported by a range of languages. Typically, these are the XML Schema Standard Data Types
Converter service:
float inchToMM(float)
float mmToInch(float)
A CORBA IDL specification would look like
interface Converter {
float inchToMM(in float value);
float mmToInch(in float value);
};
inchToMMRequest
inchToMMResponse
java_rmi_RemoteException
inchToMM(inchToMMRequest, inchToMMResponse,
java_rmi_RemoteException)
ConverterBinding
operation: inchToMM/rpc
"inchToMM"
"inchToMMResponse"
"java_rmi_RemoteException"
name: Converter
address: http://...
...
This is poor design: the location of a service
should not be part of the specification of the service
<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="urn:Converter" targetNamespace="urn:Converter" name="ConverterService">
<message name="inchToMMRequest">
<part name="param1" type="xsd:float"/>
</message>
<message name="inchToMMResponse">
<part name="return" type="xsd:float"/>
</message>
<message name="mmToInchRequest">
<part name="param1" type="xsd:float"/>
</message>
<message name="mmToInchResponse">
<part name="return" type="xsd:float"/>
</message>
<message name="java_rmi_RemoteException">
<part type="xsd:string" name="java_rmi_RemoteException"/>
</message>
<message name="com_iona_xmlbus_webservices_ejbserver_ConversionException">
<part type="xsd:string" name="com_iona_xmlbus_webservices_ejbserver_ConversionException"/>
</message>
<portType name="ConverterPortType">
<operation name="inchToMM">
<input message="tns:inchToMMRequest" name="inchToMM"/>
<output message="tns:inchToMMResponse" name="inchToMMResponse"/>
<fault message="tns:java_rmi_RemoteException" name="java_rmi_RemoteException"/>
</operation>
<operation name="mmToInch">
<input message="tns:mmToInchRequest" name="mmToInch"/>
<output message="tns:mmToInchResponse" name="mmToInchResponse"/>
<fault message="tns:java_rmi_RemoteException" name="java_rmi_RemoteException"/>
<fault
message="tns:com_iona_xmlbus_webservices_ejbserver_ConversionException" name="com_iona_xmlbus_webservices_ejbserver_ConversionException"/>
</operation>
</portType>
<binding name="ConverterBinding" type="tns:ConverterPortType">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http/" style="rpc"/>
<operation name="inchToMM">
<soap:operation soapAction="" style="rpc"/>
<input name="inchToMM">
<soap:body use="encoded" namespace="urn:Converter" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output name="inchToMMResponse">
<soap:body use="encoded" namespace="urn:Converter" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
<fault name="java_rmi_RemoteException">
<soap:fault name="java_rmi_RemoteException"
use="encoded" namespace="urn:Converter" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</fault>
</operation>
<operation name="mmToInch">
<soap:operation soapAction="" style="rpc"/>
<input name="mmToInch">
<soap:body use="encoded" namespace="urn:Converter" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output name="mmToInchResponse">
<soap:body use="encoded" namespace="urn:Converter" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
<fault name="java_rmi_RemoteException">
<soap:fault name="java_rmi_RemoteException"
use="encoded" namespace="urn:Converter" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</fault>
<fault name="com_iona_xmlbus_webservices_ejbserver_ConversionException">
<soap:fault
name="com_iona_xmlbus_webservices_ejbserver_ConversionException"
use="encoded" namespace="urn:Converter" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</fault>
</operation>
</binding>
<service name="Converter">
<port name="ConverterPort" binding="tns:ConverterBinding">
<soap:address location="http://www.xmlbus.com:9010/ionasoap/servlet/Converter"/>
</port>
</service>
</definitions>
interface ConverterInterface {
float inchToMM(float value);
float mmToInch(float value);
};
java -cp "$WSTK_CP:$APP_CP" org.apache.axis.wsdl.Java2WSDL \
-o ConverterInterface.ibm.wsdl \
-l http://localhost/wstk/services/ConverterInterface \
-m "inchToMM mmToInch" \
ConverterInterface
(WSTK_CP
can be set by
. wstk-3.2/bin/wstkenv.sh $WSTK_HOME
)
java -cp $WSTK_CP org.apache.axis.wsdl.WSDL2Java \
ConverterInterface.ibm.wsdl
interface ConverterInterface {
float inchToMM(float value);
float mmToInch(float value);
};
package DefaultNamespace;
public interface Converter extends java.rmi.Remote {
public float inchToMM(float in0) throws java.rmi.RemoteException;
public float mmToInch(float in0) throws java.rmi.RemoteException;
}
application/soap
.../jakarta-tomcat/webapps/axis
jws
extension to
the toplevel of the Axis directory e.g.
.../jakarta-tomcat/webapps/axis/Converter.jws
http://localhost:8088/axis/Converter.jws
Here is a part of a client that can run when the location of a WSDL document is known
URL wsdlURL = ...;
String namespace = "http://www.getquote.com/StockQuoteService" ;
QName serviceQN = new QName( namespace, "SimpleStockQuoteService" );
QName portQN = new QName( namespace, "Demo" );
Service service = new Service(new URL(wsdlURL), serviceQN );
call = (Call) service.createCall( portQN, "getQuote" );
Float result = (Float) call.invoke( new Object[] { "XXX" } );
Classes are found in packages such as
import java.net.URL;
import org.apache.axis.client.Service ;
import org.apache.axis.client.Call;
import javax.xml.namespace.QName;
uddi.ibm.com
, uddi.microsoft.com
, ...)
$JWSP_HOME/samples/registry-server
public class Publish{
public static void main(String[] args) throws Exception {
try {
//------------------------------------------------------
// let's collect the input arguments
//------------------------------------------------------
String serviceImplementationWSDL = args[0];
String serviceInterfaceWSDL = args[1];
String serviceDeployment = "";
String serviceMgr = "";
//------------------------------------------------------
// this will use whatever UDDI registry you selected
// in the WSTK Configuration Tool
//------------------------------------------------------
UDDIWSDLProxy uwp =
new UDDIWSDLProxy(WSTKConstants.UDDI_INQUIRY_URL,
WSTKConstants.UDDI_PUBLISH_URL,
WSTKConstants.UDDI_USERID,
WSTKConstants.UDDI_CRED,
WSTKConstants.TRANSPORT_CLASS);
//------------------------------------------------------
// assuming that you haven't yet registered yourself as
// a Service Provider, do the following steps. If you
// have already registered as a service provider, you
// should use your existing registration
//------------------------------------------------------
KeyedReference keyedReference =
new KeyedReference(TModelKeyTable.UNSPSC, "84.12.18.01.00");
keyedReference.setTModelKey(TModelKeyTable.UNSPSC_TMODEL_KEY);
Vector keyedReferenceVector = new Vector();
keyedReferenceVector.add(keyedReference);
// Create category bag
CategoryBag spCatList = new CategoryBag();
spCatList.setKeyedReferenceVector(keyedReferenceVector);
ServiceProvider sp = new ServiceProvider("WSTK 3.1 Tutorial",
"WSTK 3.1 Tutorial",
spCatList);
sp = uwp.publish(sp);
System.out.println();
System.out.println("Service Provider Published");
System.out.println("\t" + sp.getName());
System.out.println("\t" + sp.getBusinessKey());
System.out.println();
//------------------------------------------------------
// now we publish the service interface
//------------------------------------------------------
ServiceInterface si = new ServiceInterface(serviceInterfaceWSDL);
si = uwp.publish(si);
System.out.println();
System.out.println("Service Interface Published");
System.out.println("\t" + si.getName());
System.out.println("\t" + si.getTModelKey());
System.out.println();
//------------------------------------------------------
// now we deploy and publish the service itself
//------------------------------------------------------
keyedReference =
new KeyedReference(TModelKeyTable.UNSPSC, "84.12.18.01.00");
keyedReference.setTModelKey(TModelKeyTable.UNSPSC_TMODEL_KEY);
keyedReferenceVector = new Vector();
keyedReferenceVector.add(keyedReference);
// Create category bag
CategoryBag sdCatList = new CategoryBag();
spCatList.setKeyedReferenceVector(keyedReferenceVector);
//
AxisServiceDefinition sd = new AxisServiceDefinition(
serviceImplementationWSDL,
sdCatList,
serviceDeployment,
serviceMgr);
uwp.publish(sp, sd); //- publish the service
System.out.println();
System.out.println("Service Description Published");
System.out.println("\t" + sd.getName());
System.out.println("\t" + ceKey());
System.out.println("\t" + serviceImplementationWSDL);
System.out.println();
System.out.println("Done!");
} catch (Exception e) {
System.err.println(e);
}
}
}
public static String findUDDI(String service) throws Exception {
try {
UDDIWSDLProxy uwp = new UDDIWSDLProxy(WSTKConstants.UDDI_INQUIRY_URL,
WSTKConstants.UDDI_PUBLISH_URL,
WSTKConstants.UDDI_USERID,
WSTKConstants.UDDI_CRED,
WSTKConstants.TRANSPORT_CLASS);
Vector providerNameVector = new Vector();
providerNameVector.add(new Name("WSTK 3.2 Tutorial"));
ServiceProvider[] sps = uwp.findAllServiceProviders(null,
providerNameVector,
null,null,null,null,
true);
if (sps.length > 0) {
ServiceDefinition sd = sps[0].getServiceDefinition(service);
return sd.getServiceImplementation().getWSDLFilename();
} else {
return null;
}
} catch (Exception e) {
System.out.println(e.getMessage());
System.exit(0);
return null;
}
}