Search in sources :

Example 1 with WebServiceFeature

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);
}
Also used : Endpoint(jakarta.xml.ws.Endpoint) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) File(java.io.File)

Example 2 with WebServiceFeature

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());
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) MTOMFeature(jakarta.xml.ws.soap.MTOMFeature) Node(org.w3c.dom.Node) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) ByteArrayOutputStream(java.io.ByteArrayOutputStream) SOAPMessage(jakarta.xml.soap.SOAPMessage)

Example 3 with WebServiceFeature

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;
}
Also used : PolicyFeatureConfigurator(com.sun.xml.ws.policy.jaxws.spi.PolicyFeatureConfigurator) WebServiceException(jakarta.xml.ws.WebServiceException) PolicyMapKey(com.sun.xml.ws.policy.PolicyMapKey) PolicyException(com.sun.xml.ws.policy.PolicyException) WebServiceFeature(jakarta.xml.ws.WebServiceFeature) ArrayList(java.util.ArrayList)

Example 4 with WebServiceFeature

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);
    }
}
Also used : WebServiceFeature(jakarta.xml.ws.WebServiceFeature)

Example 5 with WebServiceFeature

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);
    }
}
Also used : WebServiceFeature(jakarta.xml.ws.WebServiceFeature)

Aggregations

WebServiceFeature (jakarta.xml.ws.WebServiceFeature)52 DatabindingModeFeature (com.oracle.webservices.api.databinding.DatabindingModeFeature)19 DatabindingConfig (com.sun.xml.ws.api.databinding.DatabindingConfig)19 QName (javax.xml.namespace.QName)13 BindingImpl (com.sun.xml.ws.binding.BindingImpl)6 SchemaInfo (com.sun.xml.ws.db.sdo.SchemaInfo)6 SOAPMessage (jakarta.xml.soap.SOAPMessage)6 File (java.io.File)6 Method (java.lang.reflect.Method)6 Map (java.util.Map)6 WSDLPort (com.sun.xml.ws.api.model.wsdl.WSDLPort)5 MTOMFeature (jakarta.xml.ws.soap.MTOMFeature)5 HashMap (java.util.HashMap)5 Databinding (com.oracle.webservices.api.databinding.Databinding)4 DatabindingFactory (com.oracle.webservices.api.databinding.DatabindingFactory)4 JavaCallInfo (com.oracle.webservices.api.databinding.JavaCallInfo)4 ImpliesWebServiceFeature (com.sun.xml.ws.api.ImpliesWebServiceFeature)4 MemberSubmissionAddressingFeature (com.sun.xml.ws.developer.MemberSubmissionAddressingFeature)4 BindingContext (com.sun.xml.ws.spi.db.BindingContext)4 HelperContext (commonj.sdo.helper.HelperContext)4