Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.
24.4. Implementing the Consumer's Business Logic
Overview Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
Once you instantiate a service proxy for a remote endpoint, you can invoke its methods as if it were a local object. The calls block until the remote method completes.
Note
If a method is annotated with the
@OneWay annotation, the call returns immediately.
Example Link kopierenLink in die Zwischenablage kopiert!
Link kopierenLink in die Zwischenablage kopiert!
Example 24.7, “Consumer Implemented without a WSDL Contract” shows a consumer for the service defined in Example 23.7, “Fully Annotated SEI”.
Example 24.7. Consumer Implemented without a WSDL Contract
package com.fusesource.demo;
import java.io.File;
import java.net.URL;
import javax.xml.namespace.QName;
import javax.xml.ws.Service;
public class Client
{
public static void main(String args[])
{
QName serviceName = new QName("http://demo.eric.org", "stockQuoteReporter");
1 Service s = Service.create(serviceName);
QName portName = new QName("http://demo.eric.org", "stockQuoteReporterPort");
2 s.addPort(portName, "http://schemas.xmlsoap.org/soap/", "http://localhost:9000/EricStockQuote");
3 quoteReporter proxy = s.getPort(portName, quoteReporter.class);
4 Quote quote = proxy.getQuote("ALPHA");
System.out.println("Stock "+quote.getID()+" is worth "+quote.getVal()+" as of "+quote.getTime());
}
}
The code in Example 24.7, “Consumer Implemented without a WSDL Contract” does the following: