use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersClient method testReplyToRefpsWithWSDL.
public void testReplyToRefpsWithWSDL() throws Exception {
MemberSubmissionAddressingFeature addressingFeature = new MemberSubmissionAddressingFeature(false);
WebServiceFeature[] features = new WebServiceFeature[] { addressingFeature };
Dispatch dispatch = createDispatchWithWSDL(features);
BindingImpl binding = (BindingImpl) dispatch.getBinding();
boolean enabled = AddressingVersion.isEnabled(binding);
assertTrue(enabled);
SOAPMessage response = WsaUtils.invoke(dispatch, WsaUtils.REPLY_TO_REFPS_MESSAGE, WsaUtils.S11_NS, WsaUtils.W3C_WSA_NS, getAddress(), W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS, CORRECT_ACTION);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
response.writeTo(baos);
assertXpathExists(REPLY_TO_REFPS, baos.toString());
assertXpathEvaluatesTo(REPLY_TO_REFPS_VALUE, baos.toString(), "Key#123456789");
assertXpathExists(REPLY_TO_REFPS_ISREFP, baos.toString());
}
use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.
the class AddNumbersClient method testMissingActionWithWSDL.
public void testMissingActionWithWSDL() throws Exception {
try {
WebServiceFeature[] features = new WebServiceFeature[] { new AddressingFeature(false) };
Dispatch dispatch = createDispatchWithWSDL(features);
BindingImpl binding = (BindingImpl) dispatch.getBinding();
AddressingVersion addressingVersion = AddressingVersion.fromBinding(binding);
System.out.println("Addressing version is " + addressingVersion);
assertFalse(AddressingVersion.isEnabled(binding));
WsaUtils.invoke(dispatch, WsaUtils.MISSING_ACTION_MESSAGE, WsaUtils.S11_NS, WsaUtils.W3C_WSA_NS, getAddress(), W3CAddressingConstants.WSA_ANONYMOUS_ADDRESS);
fail("SOAPFaultException must be thrown");
} catch (SOAPFaultException sfe) {
assertFault(sfe, W3CAddressingConstants.MAP_REQUIRED_QNAME);
}
}
use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.
the class CharactersTest method handleCharacters.
private void handleCharacters(int size) throws Exception {
BindingID bid = BindingID.parse(SOAPBinding.SOAP11HTTP_MTOM_BINDING);
BindingImpl binding = (BindingImpl) bid.createBinding();
Codec codec = binding.createCodec();
TestMessage msg = new TestMessage(size);
Packet packet = new Packet();
codec.decode(msg.getInputStream(), msg.getContentType(), packet);
ByteArrayOutputStream bout = new ByteArrayOutputStream();
XMLStreamWriter sw = XMLStreamWriterFactory.create(bout);
packet.getMessage().writeTo(sw);
sw.close();
InputStream in = new ByteArrayInputStream(bout.toByteArray());
XMLStreamReader sr = XMLStreamReaderFactory.create(null, in, true);
while (sr.hasNext()) {
sr.next();
if (sr.getEventType() == XMLStreamReader.START_ELEMENT && sr.getLocalName().equals("doc1")) {
assertEquals(msg.getEncodedText(), sr.getElementText().trim());
}
}
}
use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.
the class NonAnonymousResponseProcessor method process.
/**
* Send a response to a non-anonymous address. Also closes the transport back channel
* of {@link Packet} if it's not closed already.
*
* @param packet
* The response from our server, which will be delivered to the destination.
* @return The response packet that should be used to complete the tubeline response processing
*/
public Packet process(Packet packet) {
Fiber.CompletionCallback fiberCallback = null;
Fiber currentFiber = Fiber.getCurrentIfSet();
if (currentFiber != null) {
// Link completion of the current fiber to the new fiber that will
// deliver the async response. This allows access to the response
// packet that may be generated by sending a new message for the
// current async response.
final Fiber.CompletionCallback currentFiberCallback = currentFiber.getCompletionCallback();
if (currentFiberCallback != null) {
fiberCallback = new Fiber.CompletionCallback() {
public void onCompletion(@NotNull Packet response) {
currentFiberCallback.onCompletion(response);
}
public void onCompletion(@NotNull Throwable error) {
currentFiberCallback.onCompletion(error);
}
};
currentFiber.setCompletionCallback(null);
}
}
// we need to assemble a pipeline to talk to this endpoint.
WSEndpoint<?> endpoint = packet.endpoint;
WSBinding binding = endpoint.getBinding();
Tube transport = TransportTubeFactory.create(Thread.currentThread().getContextClassLoader(), new ClientTubeAssemblerContext(packet.endpointAddress, endpoint.getPort(), (WSService) null, binding, endpoint.getContainer(), ((BindingImpl) binding).createCodec(), null, null));
Fiber fiber = endpoint.getEngine().createFiber();
fiber.start(transport, packet, fiberCallback);
// then we'll proceed the rest like one-way.
Packet copy = packet.copy(false);
copy.endpointAddress = null;
return copy;
}
use of com.sun.xml.ws.binding.BindingImpl in project metro-jax-ws by eclipse-ee4j.
the class SEIPortInfoTest method testCreateBindingWSFList.
public void testCreateBindingWSFList() throws MalformedURLException {
SEIPortInfo seiPortInfo = createSEIPortInfo();
BindingImpl b = seiPortInfo.createBinding(new WebServiceFeatureList(), PORT_INTERFACE);
boolean understands = ((SOAPBindingImpl) b).understandsHeader(EXTRA_HEADER);
assertTrue("header " + EXTRA_HEADER + " must be understood", understands);
}
Aggregations