gpt4 book ai didi

org.codehaus.xfire.client.XFireProxyFactory类的使用及代码示例

转载 作者:知者 更新时间:2024-03-24 08:59:05 37 4
gpt4 key购买 nike

本文整理了Java中org.codehaus.xfire.client.XFireProxyFactory类的一些代码示例,展示了XFireProxyFactory类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。XFireProxyFactory类的具体详情如下:
包路径:org.codehaus.xfire.client.XFireProxyFactory
类名称:XFireProxyFactory

XFireProxyFactory介绍

[英]Factory for creating XFire SOAP client stubs. The returned stub will call the remote object for all methods.

Service serviceModel = new ObjectServiceFactory().create(Echo.class); 
String url = "http://localhost:8080/services/Echo"); 
Echo echo = (Echo) factory.create(serviceModel, url);

After creation, the stub can be like a regular Java class. Because it makes remote calls, it can throw more exceptions than a Java class. In particular, it may throw protocol exceptions, and XFireFaults
[中]用于创建XFire SOAP客户端存根的工厂。返回的存根将为所有方法调用远程对象

Service serviceModel = new ObjectServiceFactory().create(Echo.class); 
String url = "http://localhost:8080/services/Echo"); 
Echo echo = (Echo) factory.create(serviceModel, url);

创建后,存根可以像普通Java类一样。因为它可以进行远程调用,所以它可以抛出比Java类更多的异常。特别是,它可能会抛出协议异常,XFireFaults

代码示例

代码示例来源:origin: org.nuiton.topia/topia-soa

public Object invoke(Object obj, Method method, Object[] args)
    throws Throwable {
  Object result = null;
  // Create a service model for the client
  ObjectServiceFactory serviceFactory = new ObjectServiceFactory();
  Service serviceModel = serviceFactory.create(clazz);
  // Create a client proxy
  XFireProxyFactory proxyFactory = new XFireProxyFactory();
  Object xfproxy = proxyFactory.create(serviceModel, serviceLocation
      + "/" + clazz.getSimpleName());
  result = MethodUtils.invokeMethod(xfproxy, method.getName(), args);
  return result;
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

/**
 * Creates a new proxy with the specified URL. The returned object is a proxy with the interface specified by the
 * given service interface.
 * <pre>
 * String url = "http://localhost:8080/services/Echo");
 * Echo echo = (Echo) factory.create(transport, myService, url);
 * </pre>
 * @param transport        The transport to use.
 * @param url              the URL where the client object is located.
 * @param serviceInterface the service to create a client for.
 *
 * @return a proxy to the object with the specified interface.
 */
public Object create(Service service, Transport transport, String url)
    throws MalformedURLException
{
  return create(new Client(transport, service, url));
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

protected XFireProxyFactory getXFireProxyFactory()
{
  return new XFireProxyFactory(getXFire());
}

代码示例来源:origin: org.codehaus.xfire/xfire-jaxws

private Object createPort(Endpoint endpoint)
{
  try
  {
    return factory.create(endpoint);
  }
  catch (MalformedURLException e)
  {
    throw new WebServiceException("Invalid url: " + endpoint.getUrl(), e);
  }
}

代码示例来源:origin: org.codehaus.xfire/xfire-spring

/**
 * Initialize the XFire proxy for this interceptor.
 */
public void prepare()
    throws MalformedURLException
{
  if (getXfire() == null)
  {
    throw new IllegalArgumentException("xFire is required");
  }
  if (getServiceUrl() == null)
  {
    throw new IllegalArgumentException("serviceUrl is required");
  }
  if (this.proxyFactory == null)
  {
    this.proxyFactory = new XFireProxyFactory(getXfire());
  }
  this.xFireProxy = createXFireProxy(this.proxyFactory);
}

代码示例来源:origin: org.codehaus.enunciate/enunciate-full

/**
 * Load an XFire client proxy that implements the specified interface.
 *
 * @param iface The interface.
 * @param uuid The UUID of the interface.
 * @param endpoint The endpoint URL of the SOAP port.
 * @return The proxy.
 */
protected final Object loadProxy(Class iface, String uuid, String endpoint) {
 XFire xFire = XFireFactory.newInstance().getXFire();
 TransportManager transportManager = xFire.getTransportManager();
 Service service;
 try {
  ExplicitJAXWSAnnotationServiceFactory factory = new ExplicitJAXWSAnnotationServiceFactory(uuid, transportManager);
  service = factory.create(iface);
 }
 catch (RuntimeException e) {
  throw e;
 }
 catch (Exception e) {
  throw new IllegalStateException(e);
 }
 SoapHttpTransport soapTransport = new SoapHttpTransport();
 if (!soapTransport.isUriSupported(endpoint)) {
  throw new IllegalArgumentException("Endpoint " + endpoint + " is not a supported SOAP endpoint.");
 }
 soapTransport.addOutHandler(new EnunciatedClientSoapSerializerHandler());
 Client client = new Client(soapTransport, service, endpoint);
 return new XFireProxyFactory(xFire).create(client);
}

代码示例来源:origin: org.codehaus.xfire/xfire-spring

/**
 * Create the XFire proxy that is wrapped by this interceptor.
 *
 * @param proxyFactory the proxy factory to use
 * @return the Burlap proxy
 * @throws MalformedURLException if thrown by the proxy factory
 * @see XFireProxyFactory#create
 */
protected Object createXFireProxy(XFireProxyFactory proxyFactory)
    throws MalformedURLException
{
  return proxyFactory.create(getService().getXFireService(), getServiceUrl());
}

代码示例来源:origin: org.codehaus.xfire/xfire-spring

if (serviceUrl != null) 
  return new XFireProxyFactory().create(serviceModel, serviceUrl);
    throw new IllegalStateException("Could not find endpoint with name " + _endpointName + " on service.");
  return new XFireProxyFactory().create(ep);

代码示例来源:origin: org.codehaus.xfire/xfire-core

return create(client);

代码示例来源:origin: org.codehaus.enunciate/enunciate-xfire-client-tools

/**
 * Load an XFire client proxy that implements the specified interface.
 *
 * @param iface The interface.
 * @param uuid The UUID of the interface.
 * @param endpoint The endpoint URL of the SOAP port.
 * @return The proxy.
 */
protected final Object loadProxy(Class iface, String uuid, String endpoint) {
 XFire xFire = XFireFactory.newInstance().getXFire();
 TransportManager transportManager = xFire.getTransportManager();
 Service service;
 try {
  ExplicitJAXWSAnnotationServiceFactory factory = new ExplicitJAXWSAnnotationServiceFactory(uuid, transportManager);
  service = factory.create(iface);
 }
 catch (RuntimeException e) {
  throw e;
 }
 catch (Exception e) {
  throw new IllegalStateException(e);
 }
 SoapHttpTransport soapTransport = new SoapHttpTransport();
 if (!soapTransport.isUriSupported(endpoint)) {
  throw new IllegalArgumentException("Endpoint " + endpoint + " is not a supported SOAP endpoint.");
 }
 soapTransport.addOutHandler(new EnunciatedClientSoapSerializerHandler());
 Client client = new Client(soapTransport, service, endpoint);
 return new XFireProxyFactory(xFire).create(client);
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

public Object create(Binding binding, String address)
    throws MalformedURLException
  {
    Transport t = xfire.getTransportManager().getTransport(binding.getBindingId());
    
    if (t == null)
    {
      throw new XFireRuntimeException("Could not find transport for binding " + 
                      binding.getBindingId());
    }
    
    Client client = new Client(t, binding, address);
    return create(client);
  }
}

代码示例来源:origin: org.apache.servicemix/servicemix-jsr181

public Object getProxy() throws Exception {
  if (proxy == null) {
    Map props = new HashMap();
    props.put(AnnotationServiceFactory.ALLOW_INTERFACE, Boolean.TRUE);
    ServiceFactory factory = ServiceFactoryHelper.findServiceFactory(xfire, serviceClass, null, null);
    Service service = factory.create(serviceClass, props);
    JBIClient client;
    if (factory instanceof JAXWSServiceFactory) {
      client = new JAXWSJBIClient(xfire, service);
    } else {
      client = new JBIClient(xfire, service);
    }
    if (interfaceName != null) {
      client.getService().setProperty(JbiChannel.JBI_INTERFACE_NAME, interfaceName);
    }
    if (serviceName != null) {
      client.getService().setProperty(JbiChannel.JBI_SERVICE_NAME, serviceName);
    }
    if (endpoint != null) {
      client.getService().setProperty(JbiChannel.JBI_ENDPOINT, endpoint);
    }
    client.getService().setProperty(JbiChannel.JBI_SECURITY_PROPAGATATION, 
        Boolean.valueOf(propagateSecurityContext));
    XFireProxyFactory xpf = new XFireProxyFactory(xfire);
    proxy = xpf.create(client);
  }
  return proxy;
}

代码示例来源:origin: org.codehaus.xfire/xfire-core

public Object create(Endpoint endpoint)
  throws MalformedURLException
{
  Binding binding = endpoint.getBinding();
  Transport t = xfire.getTransportManager().getTransport(binding.getBindingId());
  
  if (t == null)
  {
    throw new XFireRuntimeException("Could not find transport for binding " + 
                    binding.getBindingId());
  }
  
  return create(new Client(t, endpoint));
}

37 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com