SOAP stands for:
- Simple Object Access Protocol
- Sophisticated Object Architecture Paradigm
- Serializable Object Architecture Process
- Serial Object Access Protocol
- Simplified Objects And Processes
SOAP is best described as a:
- Protocol
- Implementation
- Library
- Component
- Distributed Object System
It is not a DOS, just a protocol.
A SOAP message is an XML document that consists of:
- A mandatory SOAP envelope, an optional SOAP header, and a mandatory SOAP body.
- A mandatory SOAP envelope, and a mandatory SOAP body.
- A mandatory SOAP title, and a mandatory SOAP body.
- A mandatory SOAP tile, and an optional SOAP body.
- A mandatory SOAP header, and an optional SOAP body.
If you wanted to encode a variable named "height" of type
"float" with a value of 5.9 using SOAP, the result would look
like:
-
<element name="height" type="float"/>
<height>5.9</height>
-
<height type="float">5.9</height>
-
<height>5.9</height>
-
<element name="height" type="float">
</element>
-
<element name="height" type="float"/>
The fact that SOAP can be used with HTTP means that
- The SOAP protocol specifies how to send SOAP messages as
the body of an HTTP POST command.
- SOAP cannot be used with HTTP, they are incompatible protocols.
- SOAP added a new command to HTTP.
- SOAP can act as a transport layer for HTTP commands.
- HTTP and SOAP can be used interchangeably.
The purpose of the Jini architecture is to
- Federate groups of devices and software components into a single, dynamic distributed system.
- Provide wireless services for distributed object systems.
- Enable cross-language and cross-platform interoperability in Java.
- Enable the automatic distribution of centralized services.
- Facilitate the deployment of distribute Java systems in cellular and handheld applications.
Jini services communicate with each other via
- RMI
- Corba
- DCOM
- Jini XML protocol.
- Jini remote socket calls.
The hear of the Jini system is a trio of protocols called
- Discovery, join, and lookup.
- Register, call, and lookup.
- Initialize, destroy, and commit.
- Send, receive, and lookup.
- Get, post, and head.
Say you write a Jini service and it registers with the Lookup
service. At a later time the service dies. What will happen?
- When it fails to renew its lease, the lookup service will remove it from its list.
- It will be garbage-collected by the JVM.
- Nothing.
- Any current users of this service are responsible for deleting it.
- The Jini garbage-collection service will eventually delete it.
A Jini service is in fact
- An implementation of an interface.
- A webserver.
- A Java servlet.
- A serializable object.
- An RMI registry.
The correct Java notation for chaining a
BufferedInputStream
around a given
FileInputStream fin
is:
BufferedInputStream bin = new BufferedInputStream(fin);
BufferedInputStream bin = new FileInputStream(fin);
BufferedInputStream bin = BufferedInputStream.chain(fin);
BufferedInputStream bin = fin.getBufferedInputStream()
BufferedInputStream bin = FileInputStream
The difference between the OutputStreamWriter
and
the OutputStream
class hierarchies lies in the fact
that:
OutputStreamWriter
works with many
character sets, not just ASCII.
OutputStreamWriter
buffers data.
OutputStreamWriter
output is
machine-dependent, so it ends lines with /n in some architectures
and /r/c in others.
OutputStreamWriter
has methods for
controlling the speed of the output.
- There is no
OutputStreamWriter
class!
If you type the URL
ftp://www.sc.edu:index.html@file1/help
into a good web
browser, the browser will:
- Try to fetch, using ftp, a file called "help" from a
machine called "file1" using username "www.sc.edu" and
password "index.html".
- Try to fetch, using ftp, a file called "index.html" from a
machine called "www.sc.edu".
- Return an error because the URL is malformed.
- Try to fetch, using ftp, a file called "file1/help" from a
machine called "www.sc.edu" using username "index.html".
- Try to fetch, using ftp, a file called "index.html" from a
machine called "file1" using username "index.html".
After you issue a GET command to an http server and receive
a response from the server:
- The connection is closed.
- If the response was an error code, you can resend a new
command on the open socket.
- You have to send /r/n/r/n/ to indicate that your command
is done.
- The server will send /r/n/r/n after the file contents, at
which point you can close the connection.
- You have to send /r/n/r/n and then close the connection.
In Java, the code for sending a UDP message String msg =
"Hello"
to InetAddress ia
at port 4848 is:
DatagramPacket dp = new
DatagramPacket(msg, msg.length, ia, 4848); DatagramSocket socket =
new DatagramSocket(); socket.send(dp);
DatagramPacket dp = new
DatagramPacket(msg, msg.length, ia, 4848); Socket socket =
new DatagramSocket(); socket.send(dp);
DatagramSocket socket =
new DatagramSocket(); socket.send(msg);
DatagramSocket socket =
new DatagramSocket(); socket.send(msg, msg.length, ia, 4848)
DatagramPacket dp = new
DatagramPacket(msg, msg.length, ia, 4848); dp.send(dp);
Most machines on the Internet use the SMTP protocol to exchange
email. If you are not receiving email sent to you it could be because:
- The firewall you are behind is blocking the
SMTP port.
- A virus is deleting the email in transit.
- Your webserver is down.
- You are using SSL.
- The SMTP network is using UDP.
Which one of these statements about TCP and UDP is true?
- TCP guarantees that all packets are received and are in order, while UDP does neither.
- TCP guarantees that all packets are received, while UDP guarantees that they are in order.
- UDP guarantees that all packets are received, while TCP guarantees that they are in order.
- TCP is like FTP, while UDP is like MDP.
- Both TCP and UDP are faster than IP.
On January 2001 Microsoft's websites could not be reached
because of a DNS misconfiguration, which meant that:
- People were unable to find the IP number for www.microsoft.com.
- The webservers could not be reached in any way from the
rest of the Internet.
- A denial of service attack prevented the webservers from responding.
- TCP packets from the webservers were being routed to the
wrong machines.
- TCP packets from browsers could not reach the webservers
because they were being routed in a loop.
The difference between a class B and a class C address is that:
- Class C only leave the last number free, while
Class B leave the last two numbers free, as in 199.1.2.* and
199.1.*.*, respectively.
- Class B only leave the last number free, while
Class C leave the last two numbers free, as in 199.1.2.* and
199.1.*.*, respectively.
- Class C are of the form *.net, while class B are of the
form *.com
- Class B are of the form *.net, while class C are of the
form *.com
- Class C use four numbers, as in 129.1.2.2, while class B
use five, as in 129.1.2.3.4
In order to fetch a file pointed to by some URL held in
String myurl
, you need to:
URL u = new URL(myurl); InputStream in =
u.openStream()
, then start reading from in
- Open a socket to the given machine and send a GET
command with the appropriate filename (as given by
myurl
).
URLConnection u = new URLConnection(myurl);
InputStream in = u.openStream()
, then start reading from
in
URL u = new URL(myurl);
, then start reading
from u
InputStream in = new InputStream(myurl);
,
then start reading from in
The RemoteObject
extends Object
and implements (overrides) which methods?
- hashCode, equals, and toString.
- None.
- The constructors.
-
RemoteObject
does not extend Object
.
- All methods defined in the remote interface.
Say your RMI client has a reference to a remote object which
extends UnicastRemoteObject
. Then, the server for
that object dies but is quickly restarted. If you were to invoke
a method call on that object, what would happen?
- You would get an exception since the object is no longer valid.
- Everything would work fine.
- The call would be made but it might never return.
- It would return some unpredictable value.
- It depends on whether rmid was running or not.
The following are implementations of Distributed Object Systems (DOS):
- Java RMI, CORBA, and DCOM.
- Sockets, RMI, CORBA.
- HTTP, FTP, SMTP
- None of these choices is an implementation of a DOS.
- C++, Java.
In a Distributed Object System each call to a member function of
a remore object instance is sent to the object server as a
message containing (pick best):
- The ID of the actual instance, the method ID, and the parameter values.
- The code for the method instance and the parameter values.
- The parameter values.
- The class name and the parameter values.
- A magic string and the parameter values.
The codebase property value contains:
- A list of URLs.
- A list of filenames.
- A list of classnames.
- A list of remote interfaces.
- A list of object implementations.
The steps to get an RMI system running are:
-
- Compile with javac.
- Compile with rmic.
- Run rmiregistry.
- Run object server.
-
- Compile with javac.
- Run rmiregistry.
- Run object server.
- Compile with rmic.
-
- Compile with javac and "-rmic" option.
- Run rmiregistry.
- Run object server.
-
- Compile remote interface.
- Compile implementation.
- Run rmiregistry.
- Run object server.
-
- Compile remote implementation.
- Compile remote object
- Run rmiregistry.
- Run object server.
In RMI, when can a remote interface extend a non-remote interface?
- When all of the non-remote interface methods satisfy the requirements for a remote interface.
- It cannot extend a non-remote interface.
- When the non-remote interface implements
Serializable
.
- When the non-remote interface extends
RemoteException
.
- When the remote interface is
Activatable
.
The following code is (assume the ... are replaced by the appropiate code):
public interface Hello extends Remote {
String sayHello() throws RemoteException;
}
public class HelloImpl extends UnicastRemoteObject
implements Hello {
public HelloImpl() throws RemoteException { ...};
public String sayHello() { ... }
private String sayGoodbye(){ ... };
}
- Correct.
- Incorrect because
sayGoodbye
is not on the interface.
- Incorrect because
HelloImpl
should not implement Hello
.
- Incorrect because
sayGoodbye
does not throw RemoteException
.
- Incorrect because
String
is non-remote.
The primary goal of a Distributed Object System is to:
- Enable the invocation of methods on objects that are hosted by a different machine.
- Enable the construction of objects whose parts can then be distributed among different machines.
- Enable to contruction of an object that can move between machines.
- Enable the construction of compilers that can be run on various platforms.
- Enable the implementation of objects using different machines.
Your boss asks you to build a system that will allow people on
their workstations to do their heavy computing work on the
supercomputer. You decide to use RMI and implement remote
object. Your deployment will look like:
- The supercomputer runs the object server and rmiregistry, the workstations are the clients.
- The supercomputer runs the client, while the workstations run the object servers and rmiregistry.
- The supercomputer run the object server, while the workstations run the clients and rmiregistry.
- There is not way to do this with RMI.
- The object server code can migrate from the worksations to the supercomputer, which runs the rmiregistry.
The CORBA Interface Repository
- Allows the OMG type system to be accessed and written programmatically at runtime.
- Stores the interfaces for a given CORBA
module
- Is an interface that can be implemented by any CORBA object, if it wishes to do so.
- Maps operation invocation to the equivalent of a function call in the programming language.
- Does not exist.
The CORBA IIOP is:
- The CORBA Internet Inter-ORB Protocol.
- The CORBA International Interaction Object Protocol.
- The CORBA Interactive Inter-Object Platform.
- The CORBA Internet Interactive Object Platform.
- The CORBA Interactive Internet ORB Platform.
The creation of a new CORBA object is achieved by:
- Invoking a creation request on a factory object.
- Starting with an object reference and asking the ORB to create an object from it.
- Asking the Naming Service to create a new one.
- Asking the ORB to create a new one.
- Issuing a
new
command.
A CORBA IDL file is mapped into a domain language by
- Following the standarized language mapping defined by the OMG for that language.
- Converting the keywords to their closest semantic equivalent in the target language.
- Various conversion programs from various vendors, each optimized for a language or platform.
- The programmer.
- The CORBA Translation Service.
In Sun's Java CORBA implementation, the Naming Service is provided by:
- tnameserv
- namingservice
- omg.corba.Object
- omg.corba.Object.NamingService
- registry
Which one of the following lists contains one or more keywords
not supported by the CORBA IDL?
- class, interface, int.
- long, short.
- module, struct, string.
- string, sequence, short.
- any, fixed, octet.
A Java Bean is (pick one that matches Sun's definition):
- A reusable software component that can be manipulated visually in a builder tool.
- A distributed object implementation that can be manipulated visually in a builder tool.
- An object implementation with a graphical representation.
- An applet with special properties that allows its display on a builder tool.
- An RMI object that can be manipulated visually in a builder tool.
The minimum requirements for a Java class to be consitered a Java Bean are:
- Implement
Serializable
and have the name of all member-variable changing methods
start with either "get" or "set".
- Extend
Bean
and have the name of all member-variable changing methods
start with either "get" or "set".
- Implement
Bean
.
- Extend
Bean
.
- Implement the proper event-handling member functions.
Object references can be obtained by:
-
- Object creation
- Directory service
- Convert to string and back
-
- Object creation
- Convert to string and back
-
- Invoking a factory.
-
- ORB invocation.
- Object reference modification
-
- ORB invocation.
- Determination of server host and creation of reference string from it.
All CORBA interfaces
- Inherit from
CORBA::Object
.
- Must define a factory method.
- Must be defined as part of the same module.
- Have a limit on the number of methods.
- Must follow the proper naming scheme for method names.
An out-of-process COM component knows that it is time to kill itself when
- It receives the appropriate win32 event.
- It receives a call to
ComponentRelease
.
- All its objects are dead.
- Someone calls
IUnknown:Release
.
- Someone calls
Release
.
If you run the following code:
class IFoo{
public:
virtual int _stdcall GetFirst();
private:
int m_nFirst;
};
Ifoo * i = ...(get an object)
Ifoo * j = ...(get a different object)
How many vptr and vtbl will be created for this code?
- Two vptr and one vtbl.
- One vptr and two vtbl.
- One vptr and two vtbl.
- Two vptr and two vtbl.
- Three vtbl and one vptr.
In a MIDL file, an attribute is
- Always enclosed in brackets.
- One of the reserved types.
- A comment to an argument.
- Always one of "in", "out", or "in, out".
- A directive to include another file.
In MIDL, the attribute that tells us that this is a COM interface is
- object
- COMInterface
- IUnknown
- com
- COM
The library
keyword in a MIDL interface file tells the MIDL compiler to
- Create a type library for a given component.
- Link with the given library.
- Create a DLL.
- Use only standard types.
- Use only automation types.
An in-process COM component knows that it is time to kill itself when
- It never kills itself.
- It receives the appropriate win32 event.
- It receives a call to
ComponentRelease
.
- All its object references are dead.
- Someone calls
Release
.
COM components keep their own reference count by
- Calling
ComponentAddRef
- Calling
IUnknown::AddRef
- Incrementing a member variable with ++.
- Calling
AddRef
on their default object.
- Components do not keep a reference count, objects do.
Say you generate a program that implements the MIDL function
HRESULT foo([in,ref] wchar_t * a, [in,ref] wchar_t *b );
and is then called be the client with:
p->foo(x,x);
inside the function foo(), a and b are:
- Pointers to two different instances of the same character.
- Pointers to the same instance of a character.
- Pointers to different strings.
- Exactly the same.
- Pointers to different instances of different characters.
The IDispatch
interface in COM supports
- Dynamic invocation and activation.
- Event-handling.
- Aggregation.
- Composition.
- Reference counting.
When a client is done using COM interface it should
- Call
Release
on it.
- Call
Release
on its object
- Call
InterfaceRelease
on it.
- Call
delete
- Call
delete
but only if the reference count is zero.