Java Reference
In-Depth Information
System.out.println("author:
"+au-
thors.item(i).getFirstChild()
.getNodeValue().trim());
System.out.println("isbn: "+isbn);
System.out.println("publication year: "+pubYear);
System.out.println("publisher: "+publisher);
}
}
catch (TransformerException e)
{
System.err.println(e);
}
catch (XPathExpressionException xpee)
{
System.err.println(xpee);
}
System.out.println();
}
This method first invokes Service 's Service create(QName ser-
viceName) method to create a Service instance that provides a client view of a
web service. Incontrast to a Service instance created from a WSDL file, where the
qualified name of the service implementation class and other information is known to
the Service instance, a Service instance created byadispatch client doesn'tneed
tohaveknowledgeoftheservicewhencreated;theinformationwillbeprovidedtothis
instance shortly. As a result, a QName instance with an empty qualified name can be
passed to create() .
A Dispatch<T> instance must be bound to a specific port and endpoint before
use. As a result, doGet() next invokes Service 's void addPort(QName
portName, String bindingId, String endpointAddress) method
tocreateanewportfortheservice.(PortscreatedwiththismethodcontainnoWSDL
port type information and can be used only for creating Dispatch instances.) The
QName argumentpassedto portName cancontainanemptyqualifiedname.However,
an appropriate binding must be specified via a String -based binding identifier. This
example specifies HTTPBinding.HTTP_BINDING because we are communicating
withaRESTfulwebserviceviaHTTP.Also,thetargetservice'sendpointaddressmust
Search WWH ::




Custom Search