Search in sources :

Example 26 with Service

use of com.predic8.wsdl.Service in project service-proxy by membrane.

the class AdminPageBuilder method createHelpIcon.

private void createHelpIcon(Interceptor i, String id) {
    String helpId = i.getHelpId();
    if (helpId != null) {
        div().style("float:right;");
        a().href("http://membrane-soa.org/service-proxy-doc/" + getVersion() + "/configuration/reference/" + helpId + ".htm");
        span().classAttr("ui-icon ui-icon-help").title("help").end();
        end();
        end();
    }
}
Also used : URLParamUtil.createQueryString(com.predic8.membrane.core.util.URLParamUtil.createQueryString)

Example 27 with Service

use of com.predic8.wsdl.Service in project service-proxy by membrane.

the class HelpLinkExistenceTest method doit.

@Test
public void doit() throws Exception {
    Set<Class<?>> classes = getElementClasses();
    Assert.assertNotEquals(0, classes.size());
    HttpClient hc = new HttpClient();
    for (Class<?> clazz : classes) {
        if (Interceptor.class.isAssignableFrom(clazz)) {
            Interceptor i = (Interceptor) clazz.newInstance();
            String helpId = i.getHelpId();
            String url = "http://membrane-soa.org/service-proxy-doc/" + getVersion() + "/configuration/reference/" + helpId + ".htm";
            Response r = hc.call(new Request.Builder().get(url).buildExchange()).getResponse();
            try {
                Assert.assertEquals(200, r.getStatusCode());
            } catch (Throwable e) {
                throw new RuntimeException(url, e);
            }
        }
    }
}
Also used : Response(com.predic8.membrane.core.http.Response) HttpClient(com.predic8.membrane.core.transport.http.HttpClient) Interceptor(com.predic8.membrane.core.interceptor.Interceptor) Test(org.junit.Test)

Example 28 with Service

use of com.predic8.wsdl.Service in project service-proxy by membrane.

the class RewriteInterceptorIntegrationTest method setUp.

@Before
public void setUp() throws Exception {
    interceptor = new RewriteInterceptor();
    interceptor.getMappings().add(new Mapping("/blz-service\\?wsdl", "/axis2/services/BLZService?wsdl", null));
    Rule rule = new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", 3006), "thomas-bayer.com", 80);
    rule.getInterceptors().add(interceptor);
    router = new HttpRouter();
    router.getRuleManager().addProxyAndOpenPortIfNew(rule);
}
Also used : Mapping(com.predic8.membrane.core.interceptor.rewrite.RewriteInterceptor.Mapping) Rule(com.predic8.membrane.core.rules.Rule) HttpRouter(com.predic8.membrane.core.HttpRouter)

Example 29 with Service

use of com.predic8.wsdl.Service in project service-proxy by membrane.

the class MyApplication method main.

public static void main(String[] args) throws Exception {
    System.out.println("Starting up");
    // create a new service proxy that listens on port 8080 and has a target to localhost:2001
    ServiceProxy sp = createServiceProxy();
    // create an enclosing WebSocket interceptor to add our own Logging interceptor to it
    WebSocketInterceptor ws = new WebSocketInterceptor();
    ws.getInterceptors().add(new MyWebSocketLogInterceptor());
    // attach the WebSocket interceptor to the service proxy
    sp.getInterceptors().add(ws);
    // add the service proxy to a new router instance and start it
    HttpRouter router = new HttpRouter();
    router.add(sp);
    router.init();
    System.out.println("Starting finished - Waiting for WebSocket communication");
}
Also used : ServiceProxy(com.predic8.membrane.core.rules.ServiceProxy) WebSocketInterceptor(com.predic8.membrane.core.interceptor.tunnel.WebSocketInterceptor) MyWebSocketLogInterceptor(com.predic8.membrane.core.interceptor.websocket.custom.MyWebSocketLogInterceptor) HttpRouter(com.predic8.membrane.core.HttpRouter)

Example 30 with Service

use of com.predic8.wsdl.Service in project service-proxy by membrane.

the class WebServiceExplorerInterceptor method createOperationResponse.

@Mapping("[^?]*/operation/([^/?]+)/([^/?]+)/([^/?]+)")
public Response createOperationResponse(QueryParameter params, String relativeRootPath) throws Exception {
    try {
        final String bindingName = params.getGroup(1);
        final String portName = params.getGroup(2);
        final String operationName = params.getGroup(3);
        final Definitions w = getParsedWSDL();
        final Service service = getService(w);
        StringWriter sw = new StringWriter();
        new StandardPage(sw, null) {

            @Override
            protected void createContent() {
                h1().text("Service Proxy for " + service.getName());
                h2().text("Operation: " + operationName).end();
                h3().text("Sample Request").end();
                pre().text(generateSampleRequest(portName, operationName, bindingName, w)).end();
            }
        };
        return Response.ok(sw.toString()).build();
    } catch (IllegalArgumentException e) {
        log.error("", e);
        return Response.internalServerError().build();
    }
}
Also used : StringWriter(java.io.StringWriter) Definitions(com.predic8.wsdl.Definitions) Service(com.predic8.wsdl.Service) Mapping(com.predic8.membrane.core.interceptor.administration.Mapping)

Aggregations

Test (org.junit.Test)39 Process2 (com.predic8.membrane.examples.Process2)35 File (java.io.File)29 StringWriter (java.io.StringWriter)5 AbstractServiceProxy (com.predic8.membrane.core.rules.AbstractServiceProxy)4 Rule (com.predic8.membrane.core.rules.Rule)4 ServiceProxy (com.predic8.membrane.core.rules.ServiceProxy)4 JsonGenerator (com.fasterxml.jackson.core.JsonGenerator)3 HttpRouter (com.predic8.membrane.core.HttpRouter)3 ProxiesXmlUtil (com.predic8.membrane.examples.ProxiesXmlUtil)3 BufferLogger (com.predic8.membrane.examples.util.BufferLogger)3 SubstringWaitableConsoleEvent (com.predic8.membrane.examples.util.SubstringWaitableConsoleEvent)3 Definitions (com.predic8.wsdl.Definitions)3 Port (com.predic8.wsdl.Port)3 Service (com.predic8.wsdl.Service)3 IOException (java.io.IOException)3 ArrayList (java.util.ArrayList)3 Exchange (com.predic8.membrane.core.exchange.Exchange)2 Request (com.predic8.membrane.core.http.Request)2 Response (com.predic8.membrane.core.http.Response)2