Which of the following two options enable addressing feature for proxy for the StockQuoteProvider SEI ? (Choose two)

Given stock quote web service endpoint:

and the corresponding client side artifacts for the above web service are :

StockQuoteService is the Service class and StockQuoteProvider is the corresponding SEI.

Which of the following two options enable addressing feature for proxy for the StockQuoteProvider SEI ? (Choose two)

Given stock quote web service endpoint:

and the corresponding client side artifacts for the above web service are :

StockQuoteService is the Service class and StockQuoteProvider is the corresponding SEI.

Which of the following two options enable addressing feature for proxy for the StockQuoteProvider SEI ? (Choose two)

A.
proxy = new StockQuoteService().getStockQuoteProvider()

B.
proxy = new StockQuoteService().getStockQuoteProvider(new AddressingFeature())

C.
proxy = new StockQuoteService().getStockQuoteProvider(new AddressingFeature(false))

D.
proxy = new StockQuoteService().getStockQuoteProvider(new AddressingFeature(false, true))



Leave a Reply 5

Your email address will not be published. Required fields are marked *


leo yu

leo yu

@Addressing indicates WS-adddressing has been enabled, what the proxy needs to do is to initiate one SEI( stockQuoteProvider is SEI- service end point interface and stockQuoteService is SIB – service implementation bean).

AddressingFeature(enabled=false, required=XXX) will explicitly disable the ws-addressing

http://java.boot.by/ocewsd6-guide/ch12.html

Mohamed Fayek Saber

Mohamed Fayek Saber

Web Services Addressing (WS-Addressing) is a specification of transport-neutral mechanism that allows web services to communicate addressing information.

WS-Addressing is a standardized way of including message routing data within SOAP headers. Instead of relying on network-level transport to convey routing information

The following provides an example of how to enable WS-Addressing starting from Java. In this example, WS-Addressing is enforced on the endpoint (required is set to true).

Example 2-3 Enabling WS-Addressing on the Web Service (Starting From Java)

package examples;
import javax.jws.WebService;
import javax.xml.ws.soap.Addressing;

@WebService(name=”HelloWorld”, serviceName=”HelloWorldService”)
@Addressing(enabled=true, required=false)

public class HelloWorld {
public String sayHelloWorld(String message) throws MissingName { … }
}

Mohamed Fayek Saber

Mohamed Fayek Saber

Enabling WS-Addressing on the Web Service (Starting from WSDL)

To enable WS-Addressing on the Web service starting from WSDL, add the wsaw:UsingAddressing element to the corresponding wsdl:binding element. Optionally, you can add the wsdl:required Boolean attribute to specify whether WS-Addressing rules are enforced for the inbound message. By default, this attribute is false.

The following provides an example of how to enable WS-Addressing starting from WSDL. In this example, WS-Addressing is enforced on the endpoint (wsdl:required is set to true).

Example 2-4 Enabling WS-Addressing on the Web Service (Starting From WSDL)

Mohamed Fayek Saber

Mohamed Fayek Saber

Mohamed Fayek Saber

Example below shows how to use the AddressingFeature class with a service port object to enable WS-Addressing on the client:

import javax.xml.ws.soap.AddressingFeature;

public class AddressingClient {
public static void main(String…args) {
try { // Call Web Service Operation
HelloAddressingWSService service = new HelloAddressingWSService();

//enable WS-Addressing
HelloAddressingWS port = service.getHelloAddressingWSPort(new AddressingFeature());

String result = port.sayHello(“Mikalai”);
System.out.println(“Result = ” + result);
} catch (Exception ex) {
ex.printStackTrace();
}
}
}

So all you have to do is create a new AddressingFeature using the default constructor. There are two boolean arguments that you can optionally pass to the constructor as well, indicating preferences for “enabled” and “required”:

public AddressingFeature() {
this.enabled = true;
}

public AddressingFeature(boolean enabled) {
this.enabled = enabled;
}

/**
* Create an AddressingFeature
*
* @param enabled specifies whether this feature should
* be enabled or not.
* @param required specifies whether
* WS-Addressing headers MUST be present on incoming messages. This property
* only has meaning on the endpoint and has no affect when
* used on the client.
*/
public AddressingFeature(boolean enabled, boolean required) {
this.enabled = enabled;
this.required = required;
}