use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class TubelineAssemblerFactoryImplTest method testDispatch.
/**
* Execute a sequence that corresponds to:
* <pre>
* Service.createService(null, serviceName);
* Service.addPort(portName, bindingId, address);
* </pre>
*/
private Tube testDispatch(String configFileName) throws PolicyException {
final URL wsdlLocation = null;
final QName serviceName = new QName(NAMESPACE, "Service1Service");
// Corresponds to Service.createService(wsdlLocation, serviceName)
final WSServiceDelegate serviceDelegate = new WSServiceDelegate(wsdlLocation, serviceName, Service.class);
final QName portName = new QName(NAMESPACE, "Service1Port");
final BindingID bindingId = BindingID.SOAP11_HTTP;
// Corresponds to Service.addPort(portName, bindingId, address)
serviceDelegate.addPort(portName, bindingId.toString(), ADDRESS_URL.toString());
final EndpointAddress address = new EndpointAddress(ADDRESS_URL);
final WSDLPort port = null;
final WSPortInfo portInfo = serviceDelegate.safeGetPort(portName);
final WSBinding binding = bindingId.createBinding(new AddressingFeature(true));
final Container container = MockupMetroConfigLoader.createMockupContainer("tubes-config/" + configFileName);
WSBindingProvider wsbp = new WSBindingProvider() {
public void setOutboundHeaders(List<Header> headers) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setOutboundHeaders(Header... headers) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setOutboundHeaders(Object... headers) {
throw new UnsupportedOperationException("Not supported yet.");
}
public List<Header> getInboundHeaders() {
throw new UnsupportedOperationException("Not supported yet.");
}
public void setAddress(String address) {
throw new UnsupportedOperationException("Not supported yet.");
}
public WSEndpointReference getWSEndpointReference() {
throw new UnsupportedOperationException("Not supported yet.");
}
public WSPortInfo getPortInfo() {
return portInfo;
}
public Map<String, Object> getRequestContext() {
throw new UnsupportedOperationException("Not supported yet.");
}
public Map<String, Object> getResponseContext() {
throw new UnsupportedOperationException("Not supported yet.");
}
public Binding getBinding() {
return binding;
}
public EndpointReference getEndpointReference() {
throw new UnsupportedOperationException("Not supported yet.");
}
public <T extends EndpointReference> T getEndpointReference(Class<T> clazz) {
throw new UnsupportedOperationException("Not supported yet.");
}
public void close() throws IOException {
throw new UnsupportedOperationException("Not supported yet.");
}
public ManagedObjectManager getManagedObjectManager() {
return null;
}
public Set<Component> getComponents() {
throw new UnsupportedOperationException("Not supported yet.");
}
public <S> S getSPI(Class<S> type) {
throw new UnsupportedOperationException("Not supported yet.");
}
};
final ClientTubeAssemblerContext context = new ClientTubeAssemblerContext(address, port, wsbp, binding, container, ((BindingImpl) binding).createCodec(), null, null);
return getAssembler(bindingId).createClient(context);
}
use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersClient method testAddressingWithNoWSDL.
public void testAddressingWithNoWSDL() throws Exception {
Service service = Service.create(SERVICE_QNAME);
service.addPort(PORT_QNAME, SOAPBinding.SOAP11HTTP_BINDING, getAddress());
Dispatch<SOAPMessage> dispatch = service.createDispatch(PORT_QNAME, SOAPMessage.class, Service.Mode.MESSAGE, new AddressingFeature());
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_USE_PROPERTY, true);
dispatch.getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, ADD_NUMBERS_ACTION);
String message = "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body>" + "<addNumbers xmlns=\"http://example.com/\">" + "<number1>10</number1>" + "<number2>10</number2>" + "</addNumbers>" + "</S:Body></S:Envelope>";
WsaUtils.invoke(dispatch, message);
}
use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class W3CEPRTest method testEPRWithReferenceParameters.
public void testEPRWithReferenceParameters() throws Exception {
W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
builder = builder.address(getEndpointAddress());
DOMSource domsrc = makeDOMSource(xmlInterfaceName);
Document document = (Document) domsrc.getNode();
builder = builder.metadata(document.getDocumentElement());
builder = builder.serviceName(SERVICE_QNAME);
builder = builder.endpointName(PORT_QNAME);
// builder = builder.wsdlDocumentLocation(wsdlurl.toString());
domsrc = makeDOMSource(xmlRefParam1);
document = (Document) domsrc.getNode();
builder = builder.referenceParameter(document.getDocumentElement());
domsrc = makeDOMSource(xmlRefParam2);
document = (Document) domsrc.getNode();
builder = builder.referenceParameter(document.getDocumentElement());
W3CEndpointReference epr = builder.build();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
epr.writeTo(new StreamResult(baos));
AddNumbersService service = new AddNumbersService();
AddNumbersPortType myport = (AddNumbersPortType) service.getPort(epr, AddNumbersPortType.class, new AddressingFeature(true, true));
myport.addNumbers(10, 10);
}
use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class HelloLiteralTest method testHelloDispatch.
// tests EPR in wsdl
// wsdl epr has two reference parameters
public void testHelloDispatch() throws Exception {
try {
String arg = "foo";
String extra = "bar";
Hello_Type req = new Hello_Type();
req.setArgument(arg);
req.setExtra(extra);
Hello_Service service = new Hello_Service();
JAXBContext jc = jakarta.xml.bind.JAXBContext.newInstance(fromwsdl.wsdl_with_epr.client.ObjectFactory.class);
QName port = new QName("urn:test", "HelloPort");
Dispatch<Object> dispatch = service.createDispatch(port, jc, Service.Mode.PAYLOAD, new AddressingFeature());
HelloResponse response = (HelloResponse) dispatch.invoke(req);
assertEquals(arg, response.getArgument());
assertEquals(extra, response.getExtra());
} catch (Exception e) {
e.printStackTrace();
assertTrue(false);
}
}
use of jakarta.xml.ws.soap.AddressingFeature in project metro-jax-ws by eclipse-ee4j.
the class EndpointFeaturesTest method testCreateImplFeatures.
// Tests Endpoint.create(impl, features)
public void testCreateImplFeatures() throws Exception {
int port = PortAllocator.getFreePort();
String address = "http://localhost:" + port + "/hello";
Endpoint endpoint = Endpoint.create(new FeaturesEndpoint(), new AddressingFeature(true, true, AddressingFeature.Responses.ANONYMOUS));
publishVerifyStop(address, endpoint);
}
Aggregations