LibraryToggle FramesPrintFeedback

Example 2.2 shows code for creating a Service object for the SEI shown in Example 1.7.

Example 2.2. Creating a Service Object

package com.fusesource.demo;

import javax.xml.namespace.QName;
import javax.xml.ws.Service;

public class Client
{
public static void main(String args[])
  {
1    QName serviceName = new QName("http://demo.fusesource.com", "stockQuoteReporter");
2    Service s = Service.create(serviceName);
   ...
  }
}

The code in Example 2.2 does the following:

1

Builds the QName for the service using the targetNamespace property and the name property of the @WebService annotation.

2

Calls the single parameter create() method to create a new Service object.

[Note]Note

Using the single parameter create() frees you from having any dependencies on accessing a WSDL contract.

Comments powered by Disqus
loading table of contents...