本文整理汇总了Java中javax.xml.rpc.ServiceFactory.createService方法的典型用法代码示例。如果您正苦于以下问题:Java ServiceFactory.createService方法的具体用法?Java ServiceFactory.createService怎么用?Java ServiceFactory.createService使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.xml.rpc.ServiceFactory
的用法示例。
在下文中一共展示了ServiceFactory.createService方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: main
import javax.xml.rpc.ServiceFactory; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
String UrlString = "http://localhost:8080/axis/services/HelloPort?wsdl";
String nameSpaceUri = "http://hello.jaxrpc.samples/";
String serviceName = "HelloWorld";
String portName = "HelloPort";
URL helloWsdlUrl = new URL(UrlString);
ServiceFactory serviceFactory = ServiceFactory.newInstance();
Service helloService = serviceFactory.createService(helloWsdlUrl,
new QName(nameSpaceUri, serviceName));
java.util.List list = helloService.getHandlerRegistry().getHandlerChain(new QName(nameSpaceUri, portName));
list.add(new javax.xml.rpc.handler.HandlerInfo(ClientHandler.class,null,null));
Hello myProxy = (Hello) helloService.getPort(
new QName(nameSpaceUri, portName),
samples.jaxrpc.hello.Hello.class);
System.out.println(myProxy.sayHello("Buzz"));
}
示例2: main
import javax.xml.rpc.ServiceFactory; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
Options opts = new Options(args);
String uri = "http://faults.samples";
String serviceName = "EmployeeInfoService";
ServiceFactory serviceFactory = ServiceFactory.newInstance();
Service service = serviceFactory.createService(new QName(uri, serviceName));
TypeMappingRegistry registry = service.getTypeMappingRegistry();
TypeMapping map = registry.getDefaultTypeMapping();
QName employeeQName = new QName("http://faults.samples", "Employee");
map.register(Employee.class, employeeQName, new BeanSerializerFactory(Employee.class, employeeQName), new BeanDeserializerFactory(Employee.class, employeeQName));
QName faultQName = new QName("http://faults.samples", "NoSuchEmployeeFault");
map.register(NoSuchEmployeeFault.class, faultQName, new BeanSerializerFactory(NoSuchEmployeeFault.class, faultQName), new BeanDeserializerFactory(NoSuchEmployeeFault.class, faultQName));
Call call = service.createCall();
call.setTargetEndpointAddress(new URL(opts.getURL()).toString());
call.setProperty(Call.SESSION_MAINTAIN_PROPERTY, Boolean.TRUE);
call.setProperty(Call.SOAPACTION_USE_PROPERTY, Boolean.TRUE);
call.setProperty(Call.SOAPACTION_URI_PROPERTY, "http://faults.samples");
call.setOperationName( new QName(uri, "getEmployee") );
String[] args2 = opts.getRemainingArgs();
System.out.println("Trying :" + args2[0]);
Employee emp = (Employee) call.invoke(new Object[]{ args2[0] });
System.out.println("Got :" + emp.getEmployeeID());
}
示例3: main
import javax.xml.rpc.ServiceFactory; //导入方法依赖的package包/类
public static void main(String[] args) throws Exception {
URL urlWsdl = new URL("http://localhost:8080/axis/services/Address?wsdl");
String nameSpaceUri = "http://address.jaxrpc.samples";
String serviceName = "AddressServiceService";
String portName = "Address";
ServiceFactory serviceFactory = ServiceFactory.newInstance();
Service service = serviceFactory.createService(urlWsdl, new
QName(nameSpaceUri, serviceName));
AddressService myProxy = (AddressService) service.getPort(new
QName(nameSpaceUri, portName), AddressService.class);
AddressBean addressBean = new AddressBean();
addressBean.setStreet("55, rue des Lilas");
System.out.println(myProxy.updateAddress(addressBean, 75005));
}
示例4: createService
import javax.xml.rpc.ServiceFactory; //导入方法依赖的package包/类
/**
* Actually create the JAX-RPC Service instance,
* based on this factory's settings.
* @param serviceFactory the JAX-RPC ServiceFactory to use
* @return the newly created JAX-RPC Service
* @throws ServiceException if thrown by JAX-RPC methods
* @see javax.xml.rpc.ServiceFactory#createService
* @see javax.xml.rpc.ServiceFactory#loadService
*/
protected Service createService(ServiceFactory serviceFactory) throws ServiceException {
if (getServiceName() == null && getJaxRpcServiceInterface() == null) {
throw new IllegalArgumentException("Either 'serviceName' or 'jaxRpcServiceInterface' is required");
}
if (getJaxRpcServiceInterface() != null) {
// Create service via generated JAX-RPC service interface.
// Only supported on JAX-RPC 1.1
if (getWsdlDocumentUrl() != null || getJaxRpcServiceProperties() != null) {
return serviceFactory.loadService(
getWsdlDocumentUrl(), getJaxRpcServiceInterface(), getJaxRpcServiceProperties());
}
return serviceFactory.loadService(getJaxRpcServiceInterface());
}
// Create service via specified JAX-RPC service name.
QName serviceQName = getQName(getServiceName());
if (getJaxRpcServiceProperties() != null) {
// Only supported on JAX-RPC 1.1
return serviceFactory.loadService(getWsdlDocumentUrl(), serviceQName, getJaxRpcServiceProperties());
}
if (getWsdlDocumentUrl() != null) {
return serviceFactory.createService(getWsdlDocumentUrl(), serviceQName);
}
return serviceFactory.createService(serviceQName);
}