Search in sources :

Example 11 with WSDLLocation

use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.

the class ProxyTests method testInvoke.

@Test
public void testInvoke() throws Exception {
    if (!runningOnAxis) {
        return;
    }
    TestLogger.logger.debug("---------------------------------------");
    File wsdl = new File(wsdlLocation);
    URL wsdlUrl = wsdl.toURI().toURL();
    Service service = Service.create(null, serviceName);
    String request = new String("some string request");
    Object proxy = service.getPort(portName, DocLitWrappedProxy.class);
    TestLogger.logger.debug(">>Invoking Binding Provider property");
    BindingProvider p = (BindingProvider) proxy;
    p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
    DocLitWrappedProxy dwp = (DocLitWrappedProxy) proxy;
    TestLogger.logger.debug(">> Invoking Proxy Synchronously");
    String response = dwp.invoke(request);
    TestLogger.logger.debug("Proxy Response =" + response);
    // Try again
    response = dwp.invoke(request);
    TestLogger.logger.debug("Proxy Response =" + response);
    TestLogger.logger.debug("---------------------------------------");
}
Also used : DocLitWrappedProxy(org.apache.axis2.jaxws.proxy.doclitwrapped.DocLitWrappedProxy) Service(javax.xml.ws.Service) ProxyDocLitWrappedService(org.apache.axis2.jaxws.proxy.doclitwrapped.ProxyDocLitWrappedService) BindingProvider(javax.xml.ws.BindingProvider) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 12 with WSDLLocation

use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.

the class ProxyTests method testInvokeAsyncPolling.

@Test
public void testInvokeAsyncPolling() throws Exception {
    TestLogger.logger.debug("---------------------------------------");
    File wsdl = new File(wsdlLocation);
    URL wsdlUrl = wsdl.toURI().toURL();
    Service service = Service.create(null, serviceName);
    DocLitWrappedProxy proxy = service.getPort(portName, DocLitWrappedProxy.class);
    String request = new String("some string request");
    TestLogger.logger.debug(">> Invoking Binding Provider property");
    BindingProvider p = (BindingProvider) proxy;
    p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
    TestLogger.logger.debug(">> Invoking Proxy with async polling request");
    Response<ReturnType> asyncResponse = proxy.invokeAsync(request);
    await(asyncResponse);
    ReturnType response = asyncResponse.get();
    assertNotNull(response);
    // Try again
    asyncResponse = proxy.invokeAsync(request);
    await(asyncResponse);
    response = asyncResponse.get();
    assertNotNull(response);
}
Also used : DocLitWrappedProxy(org.apache.axis2.jaxws.proxy.doclitwrapped.DocLitWrappedProxy) Service(javax.xml.ws.Service) ProxyDocLitWrappedService(org.apache.axis2.jaxws.proxy.doclitwrapped.ProxyDocLitWrappedService) BindingProvider(javax.xml.ws.BindingProvider) ReturnType(org.apache.axis2.jaxws.proxy.doclitwrapped.ReturnType) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 13 with WSDLLocation

use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.

the class ProxyTests method testInvokeWithWSDL.

@Test
public void testInvokeWithWSDL() throws Exception {
    if (!runningOnAxis) {
        return;
    }
    TestLogger.logger.debug("---------------------------------------");
    File wsdl = new File(wsdlLocation);
    URL wsdlUrl = wsdl.toURI().toURL();
    Service service = Service.create(wsdlUrl, serviceName);
    String request = new String("some string request");
    Object proxy = service.getPort(portName, DocLitWrappedProxy.class);
    TestLogger.logger.debug(">>Invoking Binding Provider property");
    BindingProvider p = (BindingProvider) proxy;
    p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, getEndpoint());
    DocLitWrappedProxy dwp = (DocLitWrappedProxy) proxy;
    TestLogger.logger.debug(">> Invoking Proxy Synchronously");
    String response = dwp.invoke(request);
    TestLogger.logger.debug("Proxy Response =" + response);
    // Try again
    response = dwp.invoke(request);
    TestLogger.logger.debug("Proxy Response =" + response);
    TestLogger.logger.debug("---------------------------------------");
}
Also used : DocLitWrappedProxy(org.apache.axis2.jaxws.proxy.doclitwrapped.DocLitWrappedProxy) Service(javax.xml.ws.Service) ProxyDocLitWrappedService(org.apache.axis2.jaxws.proxy.doclitwrapped.ProxyDocLitWrappedService) BindingProvider(javax.xml.ws.BindingProvider) File(java.io.File) URL(java.net.URL) Test(org.junit.Test)

Example 14 with WSDLLocation

use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.

the class RPCProxyTests method getProxy.

/**
 * Utility method to get the proxy
 * @return RPCLit proxy
 * @throws MalformedURLException
 */
public RPCLit getProxy() throws Exception {
    File wsdl = new File(wsdlLocation);
    URL wsdlUrl = wsdl.toURI().toURL();
    Service service = Service.create(null, serviceName);
    Object proxy = service.getPort(portName, RPCLit.class);
    BindingProvider p = (BindingProvider) proxy;
    p.getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, server.getEndpoint("RPCLitService.RPCLitImplPort"));
    return (RPCLit) proxy;
}
Also used : RPCLit(org.apache.axis2.jaxws.proxy.rpclit.sei.RPCLit) Service(javax.xml.ws.Service) BindingProvider(javax.xml.ws.BindingProvider) File(java.io.File) URL(java.net.URL)

Example 15 with WSDLLocation

use of org.apache.axis2.addressing.metadata.WSDLLocation in project axis-axis2-java-core by apache.

the class ServiceDescriptionImpl method setWSDLDefinitionOnDBC.

/**
 * This method accepts a location of a WSDL document and attempts to
 * load and set the WSDL definition on the DBC object.
 * @param wsdlLocation
 */
private void setWSDLDefinitionOnDBC(String wsdlLocation) {
    if (log.isDebugEnabled()) {
        log.debug("Attempting to load WSDL file from location specified in annotation: " + wsdlLocation);
    }
    if (composite.getClassLoader() == null) {
        if (log.isDebugEnabled()) {
            log.debug("A classloader could not be found for class: " + composite.getClassName() + ". The WSDL file: " + wsdlLocation + " will not be " + "processed, and the ServiceDescription will be built from " + "annotations");
        }
    }
    try {
        if (log.isDebugEnabled()) {
            log.debug("Attempting to read WSDL: " + wsdlLocation + " for web " + "service endpoint: " + composite.getClassName());
        }
        if (log.isDebugEnabled()) {
            if (configContext != null) {
                log.debug("new WSDL4JWrapper-ConfigContext not null5");
            } else {
                log.debug("new WSDL4JWrapper-ConfigContext null5");
            }
        }
        URL url = getWSDLURL(wsdlLocation);
        ConfigurationContext cc = composite.getConfigurationContext();
        if (cc != null) {
            this.wsdlWrapper = new WSDL4JWrapper(url, cc, this.catalogManager);
        } else {
            // Probably shouldn't get here.  But if we do, use a memory sensitive
            // wsdl wrapper
            this.wsdlWrapper = new WSDL4JWrapper(url, this.catalogManager, true, 2);
        }
        composite.setWsdlDefinition(wsdlWrapper.getDefinition());
    } catch (Exception e) {
        if (log.isDebugEnabled()) {
            log.debug("The WSDL file: " + wsdlLocation + " for class: " + composite.getClassName() + "could not be processed. The ServiceDescription will be built from " + "annotations");
        }
    }
}
Also used : ConfigurationContext(org.apache.axis2.context.ConfigurationContext) WSDL4JWrapper(org.apache.axis2.jaxws.util.WSDL4JWrapper) URL(java.net.URL) FileNotFoundException(java.io.FileNotFoundException) ConnectException(java.net.ConnectException) PrivilegedActionException(java.security.PrivilegedActionException) IOException(java.io.IOException) UnknownHostException(java.net.UnknownHostException) WSDLException(javax.wsdl.WSDLException) WebServiceException(javax.xml.ws.WebServiceException)

Aggregations

URL (java.net.URL)38 DescriptionBuilderComposite (org.apache.axis2.jaxws.description.builder.DescriptionBuilderComposite)27 File (java.io.File)23 Definition (javax.wsdl.Definition)21 Service (javax.xml.ws.Service)18 HashMap (java.util.HashMap)15 QName (javax.xml.namespace.QName)15 AxisService (org.apache.axis2.description.AxisService)14 WebServiceAnnot (org.apache.axis2.jaxws.description.builder.WebServiceAnnot)14 ServiceDescription (org.apache.axis2.jaxws.description.ServiceDescription)13 WSDL4JWrapper (org.apache.axis2.jaxws.util.WSDL4JWrapper)13 MethodDescriptionComposite (org.apache.axis2.jaxws.description.builder.MethodDescriptionComposite)12 ParameterDescriptionComposite (org.apache.axis2.jaxws.description.builder.ParameterDescriptionComposite)12 BindingProvider (javax.xml.ws.BindingProvider)10 Test (org.junit.Test)10 WebServiceClientAnnot (org.apache.axis2.jaxws.description.builder.WebServiceClientAnnot)8 WebServiceClient (javax.xml.ws.WebServiceClient)7 DocLitWrappedProxy (org.apache.axis2.jaxws.proxy.doclitwrapped.DocLitWrappedProxy)7 ProxyDocLitWrappedService (org.apache.axis2.jaxws.proxy.doclitwrapped.ProxyDocLitWrappedService)7 WSDLLocation (org.apache.axis2.addressing.metadata.WSDLLocation)6