use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.
the class J2SETester method main.
public static void main(String[] args) throws Exception {
File file = new File("etc/external-metadata.xml");
WebServiceFeature feature = ExternalMetadataFeature.builder().addFiles(file).build();
Endpoint endpoint = Endpoint.create(new BlackboxService(), feature);
endpoint.publish("http://localhost:8080/jaxws-external-metadata-fromjava/WS");
// Stops the endpoint if it receives request http://localhost:9090/stop
new EndpointStopper(9090, endpoint);
}
use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.
the class PacketTest method testEncodeDecodedPacketMtom.
/**
* Tests that a server response Packet with MTOM feature, but
* decoded from an InputStream with a user specified non-MTOM
* content type, does NOT use MTOM when re-encoded
*/
public void testEncodeDecodedPacketMtom() throws Exception {
String msg = "<?xml version='1.0' encoding='UTF-8'?>" + "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\">" + "<soapenv:Body><soapenv:Fault>" + "<faultcode>soapenv:Server</faultcode>" + "<faultstring>ABC-380001:Internal Server Error</faultstring>" + "<detail><con:fault xmlns:con=\"http://www.bea.com/wli/sb/context\">" + "<con:errorCode>ABC-380001</con:errorCode>" + "<con:reason>Internal Server Error</con:reason>" + "<con:location><con:node>RouteNode1</con:node><con:path>response-pipeline</con:path></con:location>" + "</con:fault></detail>" + "</soapenv:Fault></soapenv:Body></soapenv:Envelope>";
WebServiceFeature[] features = { new MTOMFeature(true, 0) };
MessageContextFactory mcf = new MessageContextFactory(features);
Packet fakeRequest = (Packet) mcf.createContext();
Packet p = (Packet) mcf.createContext(new ByteArrayInputStream(msg.getBytes()), "text/xml");
fakeRequest.relateServerResponse(p, null, null, BindingImpl.create(BindingID.SOAP11_HTTP, features));
ByteArrayOutputStream bos = new ByteArrayOutputStream();
p.writeTo(bos);
String writtenMsg = new String(bos.toByteArray());
System.out.println(writtenMsg);
assertEquals("text/xml", p.getContentType().getContentType());
// try reading the message as a soap message with text/xml - this should succeed
// in parsing the message
Packet reReadPacket = (Packet) mcf.createContext(new ByteArrayInputStream(writtenMsg.getBytes()), "text/xml");
SOAPMessage soap = reReadPacket.getAsSOAPMessage();
Node bodyChild = soap.getSOAPBody().getFirstChild();
assertEquals("Fault", bodyChild.getLocalName());
}
use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.
the class PolicyUtil method getPortScopedFeatures.
/**
* Returns the list of features that correspond to the policies in the policy
* map for a give port
*
* @param policyMap The service policies
* @param serviceName The service name
* @param portName The service port name
* @return List of features for the given port corresponding to the policies in the map
*/
public static Collection<WebServiceFeature> getPortScopedFeatures(PolicyMap policyMap, QName serviceName, QName portName) {
LOGGER.entering(policyMap, serviceName, portName);
Collection<WebServiceFeature> features = new ArrayList<>();
try {
final PolicyMapKey key = PolicyMap.createWsdlEndpointScopeKey(serviceName, portName);
for (PolicyFeatureConfigurator configurator : CONFIGURATORS) {
Collection<WebServiceFeature> additionalFeatures = configurator.getFeatures(key, policyMap);
if (additionalFeatures != null) {
features.addAll(additionalFeatures);
}
}
} catch (PolicyException e) {
throw new WebServiceException(e);
}
LOGGER.exiting(features);
return features;
}
use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.
the class BindingImpl method setOperationFeatures.
public void setOperationFeatures(@NotNull final QName operationName, WebServiceFeature... newFeatures) {
if (newFeatures != null) {
WebServiceFeatureList featureList = operationFeatures.get(operationName);
if (featureList == null) {
featureList = new WebServiceFeatureList();
}
for (WebServiceFeature f : newFeatures) {
featureList.add(f);
}
operationFeatures.put(operationName, featureList);
}
}
use of jakarta.xml.ws.WebServiceFeature in project metro-jax-ws by eclipse-ee4j.
the class BindingImpl method setInputMessageFeatures.
public void setInputMessageFeatures(@NotNull final QName operationName, WebServiceFeature... newFeatures) {
if (newFeatures != null) {
WebServiceFeatureList featureList = inputMessageFeatures.get(operationName);
if (featureList == null) {
featureList = new WebServiceFeatureList();
}
for (WebServiceFeature f : newFeatures) {
featureList.add(f);
}
inputMessageFeatures.put(operationName, featureList);
}
}
Aggregations