Search in sources :

Example 16 with Endpoint

use of org.apache.cxf.endpoint.Endpoint in project tomee by apache.

the class EjbMessageContext method getEndpointReference.

public EndpointReference getEndpointReference(Element... referenceParameters) {
    org.apache.cxf.message.Message msg = getWrappedMessage();
    Endpoint ep = msg.getExchange().get(Endpoint.class);
    W3CEndpointReferenceBuilder builder = new W3CEndpointReferenceBuilder();
    builder.address(ep.getEndpointInfo().getAddress());
    builder.serviceName(ep.getService().getName());
    builder.endpointName(ep.getEndpointInfo().getName());
    if (referenceParameters != null) {
        for (Element referenceParameter : referenceParameters) {
            builder.referenceParameter(referenceParameter);
        }
    }
    return builder.build();
}
Also used : W3CEndpointReferenceBuilder(javax.xml.ws.wsaddressing.W3CEndpointReferenceBuilder) Endpoint(org.apache.cxf.endpoint.Endpoint) Message(org.apache.cxf.message.Message) Element(org.w3c.dom.Element)

Example 17 with Endpoint

use of org.apache.cxf.endpoint.Endpoint in project ddf by codice.

the class PolicyWSDLGetInterceptor method handleMessage.

// Majority of this method is from the WSDLGetInterceptor, in-line comments
// specify which areas were added
@Override
public void handleMessage(Message message) throws Fault {
    String method = (String) message.get(Message.HTTP_REQUEST_METHOD);
    String query = (String) message.get(Message.QUERY_STRING);
    if (!"GET".equals(method) || StringUtils.isEmpty(query)) {
        return;
    }
    String baseUri = (String) message.get(Message.REQUEST_URL);
    String ctx = (String) message.get(Message.PATH_INFO);
    Map<String, String> map = UrlUtils.parseQueryString(query);
    if (isRecognizedQuery(map, baseUri, ctx, message.getExchange().getEndpoint().getEndpointInfo())) {
        Document doc = getDocument(message, baseUri, map, ctx);
        // DDF- start ADDED code
        if (map.containsKey("wsdl")) {
            doc = addPolicyToWSDL(doc, loader.getPolicy());
            doc = configureAddress(doc);
        }
        // DDF- end of ADDED code
        Endpoint e = message.getExchange().get(Endpoint.class);
        Message mout = new MessageImpl();
        mout.setExchange(message.getExchange());
        mout = e.getBinding().createMessage(mout);
        mout.setInterceptorChain(OutgoingChainInterceptor.getOutInterceptorChain(message.getExchange()));
        message.getExchange().setOutMessage(mout);
        mout.put(WSDLGetInterceptor.DOCUMENT_HOLDER, doc);
        mout.put(Message.CONTENT_TYPE, "text/xml");
        // just remove the interceptor which should not be used
        cleanUpOutInterceptors(mout);
        // notice this is being added after the purge above, don't swap the order!
        mout.getInterceptorChain().add(WSDLGetOutInterceptor.INSTANCE);
        // DDF- CHANGED TRANSFORM_SKIP to transform.skip because private field 
        message.getExchange().put("transform.skip", Boolean.TRUE);
        // skip the service executor and goto the end of the chain.
        message.getInterceptorChain().doInterceptStartingAt(message, OutgoingChainInterceptor.class.getName());
    }
}
Also used : Endpoint(org.apache.cxf.endpoint.Endpoint) Message(org.apache.cxf.message.Message) OutgoingChainInterceptor(org.apache.cxf.interceptor.OutgoingChainInterceptor) Document(org.w3c.dom.Document) MessageImpl(org.apache.cxf.message.MessageImpl)

Aggregations

Endpoint (org.apache.cxf.endpoint.Endpoint)17 HashMap (java.util.HashMap)8 Client (org.apache.cxf.endpoint.Client)8 WSS4JOutInterceptor (org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor)8 URL (java.net.URL)7 QName (javax.xml.namespace.QName)7 Service (javax.xml.ws.Service)7 SAAJOutInterceptor (org.apache.cxf.binding.soap.saaj.SAAJOutInterceptor)7 Message (org.apache.cxf.message.Message)6 IOException (java.io.IOException)5 Callback (javax.security.auth.callback.Callback)5 CallbackHandler (javax.security.auth.callback.CallbackHandler)5 UnsupportedCallbackException (javax.security.auth.callback.UnsupportedCallbackException)5 WSPasswordCallback (org.apache.wss4j.common.ext.WSPasswordCallback)4 MessageImpl (org.apache.cxf.message.MessageImpl)3 List (java.util.List)2 SAAJInInterceptor (org.apache.cxf.binding.soap.saaj.SAAJInInterceptor)2 OutgoingChainInterceptor (org.apache.cxf.interceptor.OutgoingChainInterceptor)2 Attachment (org.apache.cxf.message.Attachment)2 ClientPasswordHandler (com.evolveum.midpoint.cli.ninja.util.ClientPasswordHandler)1