use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class EprExtensionsContributorTest method testEprWithDispatchWithoutWSDL.
/**
* Tests client-side access to EPR extensions specified in WSDL
*
* @throws Exception
*/
public void testEprWithDispatchWithoutWSDL() throws Exception {
Service service = Service.create(serviceName);
service.addPort(portName, jakarta.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
WSEndpointReference wsepr = ((WSBindingProvider) dispatch).getWSEndpointReference();
assertTrue(wsepr.getEPRExtensions().isEmpty());
}
use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class WseprTest method testMetadataWithEmptyParams.
/**
* Empty Metadata element should not exsit in EndpointReference element.
* @throws Exception
*/
public void testMetadataWithEmptyParams() throws Exception {
WSEndpointReference wSEndpointReference = new WSEndpointReference(AddressingVersion.W3C, address, new QName("", ""), new QName("", ""), new QName("", ""), null, "", referenceParameters);
Node md = string2Doc(wSEndpointReference.toString(), "wsa:Metadata");
validateEndpointReference(wSEndpointReference.toString());
assertNull("EndpointReference element should not contain empty Metadata element.", md);
}
use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class WseprTest method validateEndpointReference.
private void validateEndpointReference(String wsepr) throws Exception {
InputStream is = new ByteArrayInputStream(wsepr.getBytes());
WSEndpointReference wSEndpointReference = new WSEndpointReference(is, AddressingVersion.W3C);
}
use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class EprExtensionsContributorTest method testEprWithDispatchWithoutWSDL.
/**
* Tests client-side access to EPR extensions specified in WSDL
*
* @throws Exception
*/
public void testEprWithDispatchWithoutWSDL() throws Exception {
Service service = Service.create(serviceName);
service.addPort(portName, jakarta.xml.ws.soap.SOAPBinding.SOAP11HTTP_BINDING, endpointAddress);
Dispatch dispatch = service.createDispatch(portName, Source.class, Service.Mode.PAYLOAD);
WSEndpointReference wsepr = ((WSBindingProvider) dispatch).getWSEndpointReference();
assertTrue(wsepr.getEPRExtensions().isEmpty());
}
use of com.sun.xml.ws.api.addressing.WSEndpointReference in project metro-jax-ws by eclipse-ee4j.
the class ReferenceParametersTest method testFaultToReferenceParametersStreamMessage1.
/**
* See if the ReferenceParamaters get added proeprly from FaultToEPR to fault response
* @throws Exception
*/
public void testFaultToReferenceParametersStreamMessage1() throws Exception {
String requestStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:user=\"http://foo.bar\" " + "xmlns:wsa=\"http://www.w3.org/2005/08/addressing\">" + "<S:Header>" + "<wsa:Action>http://example.org/action/echoIn</wsa:Action>" + "<wsa:To>http://www.w3.org/2005/08/addressing/anonymous</wsa:To>" + "<wsa:MessageID>urn:uuid:1234567890</wsa:MessageID>" + "<wsa:FaultTo>" + "<wsa:Address>http://www.w3.org/2005/08/addressing/anonymous</wsa:Address>" + "<wsa:ReferenceParameters>" + "<user:foo xmlns:wsa=\"http://www.w3.org/2005/08/addressing\" wsa:IsReferenceParameter='true'>bar</user:foo>" + "<user:bar xmlns:user=\"http://foo.bar\">" + "<user:foobar>barfoo</user:foobar>" + "</user:bar>" + "</wsa:ReferenceParameters>" + "</wsa:FaultTo>" + "</S:Header>" + "<S:Body><DataType xmlns=\"http://foo.org/xsd\"><param>foo bar</param></DataType></S:Body></S:Envelope>";
Message message = useStreamCodec(requestStr);
WSEndpointReference wsepr = message.getHeaders().getFaultTo(AddressingVersion.W3C, SOAPVersion.SOAP_11);
String responseStr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" + "<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"><S:Body><S:Fault>" + "<faultcode>echo:EmptyEchoString</faultcode>" + "<faultstring>The echo string was empty.</faultstring>" + "</S:Fault></S:Body></S:Envelope>";
Message m2 = useStreamCodec(responseStr);
wsepr.addReferenceParametersToList(m2.getHeaders());
ByteArrayBuffer baos = new ByteArrayBuffer();
XMLStreamWriter writer = XMLStreamWriterFactory.create(baos);
m2.writeTo(writer);
writer.flush();
XMLInputFactory readerFactory = XMLInputFactory.newInstance();
XMLStreamReader reader = readerFactory.createXMLStreamReader(baos.newInputStream());
Message sm = Messages.create(reader);
Packet sm_packet = new Packet(sm);
List<Element> refParams = sm_packet.getReferenceParameters();
assertEquals("Did n't get expected ReferenceParameters", 2, refParams.size());
for (Element e : refParams) {
assertTrue("isReferenceParameter attribute not present on header", e.getAttributeNodeNS(W3CAddressingConstants.WSA_NAMESPACE_NAME, "IsReferenceParameter") != null);
assertEquals("NS Decl did not match", "http://foo.bar", e.getNamespaceURI());
}
}
Aggregations