Java 类javax.xml.rpc.Stub 实例源码

项目:Telepathology    文件:FederationProxyV2.java   
private void setMetadataCredentials(ImageFederationMetadata imageMetadata)
{
    try
    {
        ProxyService metadataService = proxyServices.getProxyService(ProxyServiceType.metadata);

        System.out.println("Metadata parameters is " + (metadataService == null ? "NULL" : "NOT NULL") );

        System.out.println("UID = '" + metadataService.getUid() + "'.");
        System.out.println("PWD = '" + metadataService.getCredentials() + "'.");

        if(metadataService.getUid() != null)
            ((Stub)imageMetadata)._setProperty(Stub.USERNAME_PROPERTY, metadataService.getUid());

        if(metadataService.getCredentials() != null)
            ((Stub)imageMetadata)._setProperty(Stub.PASSWORD_PROPERTY, metadataService.getCredentials());

    }
    catch(ProxyServiceNotFoundException psnfX)
    {
        logger.error(psnfX);
    }
}
项目:Telepathology    文件:FederationProxy.java   
private void setMetadataCredentials(ImageFederationMetadata imageMetadata)
{
    try
    {
        ProxyService metadataService = proxyServices.getProxyService(ProxyServiceType.metadata);

        System.out.println("Metadata parameters is " + (metadataService == null ? "NULL" : "NOT NULL") );

        System.out.println("UID = '" + metadataService.getUid() + "'.");
        System.out.println("PWD = '" + metadataService.getCredentials() + "'.");

        if(metadataService.getUid() != null)
            ((Stub)imageMetadata)._setProperty(Stub.USERNAME_PROPERTY, metadataService.getUid());

        if(metadataService.getCredentials() != null)
            ((Stub)imageMetadata)._setProperty(Stub.PASSWORD_PROPERTY, metadataService.getCredentials());

    }
    catch(ProxyServiceNotFoundException psnfX)
    {
        logger.error(psnfX);
    }
}
项目:Telepathology    文件:FederationProxyV3.java   
private ImageFederationMetadata getImageMetadataService(ProxyServiceType proxyServiceType) 
throws ConnectionException
{
    try
    {
        URL localTestUrl = new URL(proxyServices.getProxyService(proxyServiceType).getConnectionURL());
        gov.va.med.imaging.federation.webservices.soap.v3.ImageMetadataFederationServiceLocator locator = 
            new gov.va.med.imaging.federation.webservices.soap.v3.ImageMetadataFederationServiceLocator();
        ImageFederationMetadata imageMetadata = locator.getImageMetadataFederationV3(localTestUrl);
        ((org.apache.axis.client.Stub)imageMetadata).setTimeout(getMetadataTimeoutMs());
        return imageMetadata;
    }
    catch(MalformedURLException murlX)
    {
        logger.error("Error creating URL to access service.", murlX);
        throw new ConnectionException(murlX);
    }
    catch(ServiceException sX)
    {
        logger.error("Service exception." + sX);
        throw new ConnectionException(sX);
    }
}
项目:Telepathology    文件:FederationProxyV3.java   
private void setMetadataCredentials(ImageFederationMetadata imageMetadata, ProxyServiceType proxyServiceType)
{
    try
    {
        ProxyService metadataService = proxyServices.getProxyService(ProxyServiceType.metadata);

        System.out.println("Metadata parameters is " + (metadataService == null ? "NULL" : "NOT NULL") );

        System.out.println("UID = '" + metadataService.getUid() + "'.");
        System.out.println("PWD = '" + metadataService.getCredentials() + "'.");

        if(metadataService.getUid() != null)
            ((Stub)imageMetadata)._setProperty(Stub.USERNAME_PROPERTY, metadataService.getUid());

        if(metadataService.getCredentials() != null)
            ((Stub)imageMetadata)._setProperty(Stub.PASSWORD_PROPERTY, metadataService.getCredentials());

    }
    catch(ProxyServiceNotFoundException psnfX)
    {
        logger.error(psnfX);
    }
}
项目:Telepathology    文件:FederationProxyV2.java   
private ImageFederationMetadata getImageMetadataService() 
throws ConnectionException
{
    try
    {
        URL localTestUrl = new URL(proxyServices.getProxyService(ProxyServiceType.metadata).getConnectionURL());
        ImageMetadataFederationServiceLocator locator = new ImageMetadataFederationServiceLocator();
        ImageFederationMetadata imageMetadata = locator.getImageMetadataFederationV2(localTestUrl);
        ((org.apache.axis.client.Stub)imageMetadata).setTimeout(getMetadataTimeoutMs());
        return imageMetadata;
    }
    catch(MalformedURLException murlX)
    {
        logger.error("Error creating URL to access service.", murlX);
        throw new ConnectionException(murlX);
    }
    catch(ServiceException sX)
    {
        logger.error("Service exception." + sX);
        throw new ConnectionException(sX);
    }
}
项目:class-guard    文件:JaxRpcPortClientInterceptor.java   
/**
 * Prepare the given JAX-RPC port stub, applying properties to it.
 * Called by {@link #prepare}.
 * <p>Just applied when actually creating a JAX-RPC port stub, in case of a
 * compliant port interface. Else, JAX-RPC dynamic calls will be used.
 * @param stub the current JAX-RPC port stub
 * @see #setUsername
 * @see #setPassword
 * @see #setEndpointAddress
 * @see #setMaintainSession
 * @see #setCustomProperties
 * @see #setPortInterface
 * @see #prepareJaxRpcCall
 */
protected void preparePortStub(Stub stub) {
    String username = getUsername();
    if (username != null) {
        stub._setProperty(Stub.USERNAME_PROPERTY, username);
    }
    String password = getPassword();
    if (password != null) {
        stub._setProperty(Stub.PASSWORD_PROPERTY, password);
    }
    String endpointAddress = getEndpointAddress();
    if (endpointAddress != null) {
        stub._setProperty(Stub.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);
    }
    if (isMaintainSession()) {
        stub._setProperty(Stub.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
    }
    if (this.customPropertyMap != null) {
        for (Map.Entry<String, Object> entry : this.customPropertyMap.entrySet()) {
            stub._setProperty(entry.getKey(), entry.getValue());
        }
    }
}
项目:class-guard    文件:JaxRpcSupportTests.java   
public void testJaxRpcPortProxyFactoryBean() throws Exception {
    JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
    factory.setServiceFactoryClass(MockServiceFactory.class);
    factory.setNamespaceUri("myNamespace");
    factory.setServiceName("myService1");
    factory.setPortName("myPort");
    factory.setPortInterface(IRemoteBean.class);
    factory.afterPropertiesSet();
    assertTrue("Correct singleton value", factory.isSingleton());
    assertTrue(factory.getPortStub() instanceof Stub);

    assertTrue(factory.getObject() instanceof IRemoteBean);
    IRemoteBean proxy = (IRemoteBean) factory.getObject();
    proxy.setName("myName");
    assertEquals("myName", RemoteBean.name);
}
项目:class-guard    文件:JaxRpcSupportTests.java   
public void testJaxRpcPortProxyFactoryBeanWithProperties() throws Exception {
    JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
    factory.setServiceFactoryClass(MockServiceFactory.class);
    factory.setNamespaceUri("myNamespace");
    factory.setServiceName("myService1");
    factory.setPortName("myPort");
    factory.setUsername("user");
    factory.setPassword("pw");
    factory.setEndpointAddress("ea");
    factory.setMaintainSession(true);
    factory.setPortInterface(IRemoteBean.class);
    factory.afterPropertiesSet();
    assertTrue("Correct singleton value", factory.isSingleton());

    assertTrue(factory.getPortStub() instanceof Stub);
    Stub stub = (Stub) factory.getPortStub();
    assertEquals("user", stub._getProperty(Stub.USERNAME_PROPERTY));
    assertEquals("pw", stub._getProperty(Stub.PASSWORD_PROPERTY));
    assertEquals("ea", stub._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY));
    assertTrue(((Boolean) stub._getProperty(Stub.SESSION_MAINTAIN_PROPERTY)).booleanValue());

    assertTrue(factory.getObject() instanceof IRemoteBean);
    IRemoteBean proxy = (IRemoteBean) factory.getObject();
    proxy.setName("myName");
    assertEquals("myName", RemoteBean.name);
}
项目:class-guard    文件:JaxRpcSupportTests.java   
public void testJaxRpcPortProxyFactoryBeanWithCustomProperties() throws Exception {
    JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
    factory.setServiceFactoryClass(MockServiceFactory.class);
    factory.setNamespaceUri("myNamespace");
    factory.setServiceName("myService1");
    factory.setPortName("myPort");
    factory.setUsername("user");
    factory.setPassword("pw");
    Properties customProps = new Properties();
    customProps.setProperty("myProp", "myValue");
    factory.setCustomProperties(customProps);
    factory.setPortInterface(IRemoteBean.class);
    factory.afterPropertiesSet();
    assertTrue("Correct singleton value", factory.isSingleton());

    assertTrue(factory.getPortStub() instanceof Stub);
    Stub stub = (Stub) factory.getPortStub();
    assertEquals("user", stub._getProperty(Stub.USERNAME_PROPERTY));
    assertEquals("pw", stub._getProperty(Stub.PASSWORD_PROPERTY));
    assertEquals("myValue", stub._getProperty("myProp"));

    assertTrue(factory.getObject() instanceof IRemoteBean);
    IRemoteBean proxy = (IRemoteBean) factory.getObject();
    proxy.setName("myName");
    assertEquals("myName", RemoteBean.name);
}
项目:Telepathology    文件:FederationProxy.java   
private ImageFederationMetadata getImageMetadataService() 
throws MalformedURLException, ServiceException, ProxyServiceNotFoundException
{
    URL localTestUrl = new URL(proxyServices.getProxyService(ProxyServiceType.metadata).getConnectionURL());
    ImageMetadataFederationServiceLocator locator = new ImageMetadataFederationServiceLocator();
    ImageFederationMetadata imageMetadata = locator.getImageMetadataFederation(localTestUrl);
    ((org.apache.axis.client.Stub)imageMetadata).setTimeout(getMetadataTimeoutMs());
    return imageMetadata;
}
项目:class-guard    文件:JaxRpcSupportTests.java   
public void testJaxRpcPortProxyFactoryBeanWithCustomPropertyMap() throws Exception {
    JaxRpcPortProxyFactoryBean factory = new JaxRpcPortProxyFactoryBean();
    factory.setServiceFactoryClass(MockServiceFactory.class);
    factory.setNamespaceUri("myNamespace");
    factory.setServiceName("myService1");
    factory.setPortName("myPort");
    factory.setEndpointAddress("ea");
    factory.setMaintainSession(true);
    Map customProps = new HashMap();
    customProps.put("myProp", new Integer(1));
    factory.setCustomPropertyMap(customProps);
    factory.addCustomProperty("myOtherProp", "myOtherValue");
    factory.setPortInterface(IRemoteBean.class);
    factory.afterPropertiesSet();
    assertTrue("Correct singleton value", factory.isSingleton());

    assertTrue(factory.getPortStub() instanceof Stub);
    Stub stub = (Stub) factory.getPortStub();
    assertEquals("ea", stub._getProperty(Stub.ENDPOINT_ADDRESS_PROPERTY));
    assertTrue(((Boolean) stub._getProperty(Stub.SESSION_MAINTAIN_PROPERTY)).booleanValue());
    assertEquals(new Integer(1), stub._getProperty("myProp"));
    assertEquals("myOtherValue", stub._getProperty("myOtherProp"));

    assertTrue(factory.getObject() instanceof IRemoteBean);
    IRemoteBean proxy = (IRemoteBean) factory.getObject();
    proxy.setName("myName");
    assertEquals("myName", RemoteBean.name);
}
项目:Lucee    文件:XmlRpcService.java   
public abstract Stub getWebService(String arg0, String arg1, String arg2,
int arg3, String arg4, String arg5, String arg6, String arg7,
String arg8);
项目:class-guard    文件:JaxRpcPortClientInterceptor.java   
/**
 * Create and initialize the JAX-RPC service for the specified port.
 * <p>Prepares a JAX-RPC stub if possible (if an RMI interface is available);
 * falls back to JAX-RPC dynamic calls else. Using dynamic calls can be enforced
 * through overriding {@link #alwaysUseJaxRpcCall} to return {@code true}.
 * <p>{@link #postProcessJaxRpcService} and {@link #postProcessPortStub}
 * hooks are available for customization in subclasses. When using dynamic calls,
 * each can be post-processed via {@link #postProcessJaxRpcCall}.
 * @throws RemoteLookupFailureException if service initialization or port stub creation failed
 */
public void prepare() throws RemoteLookupFailureException {
    if (getPortName() == null) {
        throw new IllegalArgumentException("Property 'portName' is required");
    }

    synchronized (this.preparationMonitor) {
        this.serviceToUse = null;

        // Cache the QName for the port.
        this.portQName = getQName(getPortName());

        try {
            Service service = getJaxRpcService();
            if (service == null) {
                service = createJaxRpcService();
            }
            else {
                postProcessJaxRpcService(service);
            }

            Class portInterface = getPortInterface();
            if (portInterface != null && !alwaysUseJaxRpcCall()) {
                // JAX-RPC-compliant port interface -> using JAX-RPC stub for port.

                if (logger.isDebugEnabled()) {
                    logger.debug("Creating JAX-RPC proxy for JAX-RPC port [" + this.portQName +
                            "], using port interface [" + portInterface.getName() + "]");
                }
                Remote remoteObj = service.getPort(this.portQName, portInterface);

                if (logger.isDebugEnabled()) {
                    Class serviceInterface = getServiceInterface();
                    if (serviceInterface != null) {
                        boolean isImpl = serviceInterface.isInstance(remoteObj);
                        logger.debug("Using service interface [" + serviceInterface.getName() + "] for JAX-RPC port [" +
                                this.portQName + "] - " + (!isImpl ? "not" : "") + " directly implemented");
                    }
                }

                if (!(remoteObj instanceof Stub)) {
                    throw new RemoteLookupFailureException("Port stub of class [" + remoteObj.getClass().getName() +
                            "] is not a valid JAX-RPC stub: it does not implement interface [javax.xml.rpc.Stub]");
                }
                Stub stub = (Stub) remoteObj;

                // Apply properties to JAX-RPC stub.
                preparePortStub(stub);

                // Allow for custom post-processing in subclasses.
                postProcessPortStub(stub);

                this.portStub = remoteObj;
            }

            else {
                // No JAX-RPC-compliant port interface -> using JAX-RPC dynamic calls.
                if (logger.isDebugEnabled()) {
                    logger.debug("Using JAX-RPC dynamic calls for JAX-RPC port [" + this.portQName + "]");
                }
            }

            this.serviceToUse = service;
        }
        catch (ServiceException ex) {
            throw new RemoteLookupFailureException(
                    "Failed to initialize service for JAX-RPC port [" + this.portQName + "]", ex);
        }
    }
}
项目:class-guard    文件:JaxRpcPortClientInterceptor.java   
/**
 * Post-process the given JAX-RPC port stub. Called by {@link #prepare}.
 * <p>The default implementation is empty.
 * <p>Just applied when actually creating a JAX-RPC port stub, in case of a
 * compliant port interface. Else, JAX-RPC dynamic calls will be used.
 * @param stub the current JAX-RPC port stub
 * (can be cast to an implementation-specific class if necessary)
 * @see #setPortInterface
 * @see #postProcessJaxRpcCall
 */
protected void postProcessPortStub(Stub stub) {
}