如何删除WebService注册表

时间:2019-05-13 18:47:53

标签: java web-services

我在注册WebService时遇到问题。我仍然不完全了解如何正确注册它,但是我现在遇到的问题是如何删除所有失败的尝试。

该作业说,在注册自己后,它最多会删除先前的作业或覆盖它们。

我已经尝试研究一些方法,但是没有一个方法可以成功删除失败的注册表。

        public void registerService(String orgName, String serviceName, String wsdlURL){

        BusinessLifeCycleManager manager;

        try {
        manager = registryService.getBusinessLifeCycleManager();

        //Organization

        InternationalString os = manager.createInternationalString(orgName);
        Organization organization = manager.createOrganization(os);

        //Service
        InternationalString ss = manager.createInternationalString(serviceName);
        Service service = manager.createService(ss);
        //organization.addService(service);

        //removing the previous one
        organization.removeService(service);

        //ServiceBinding
        ServiceBinding serviceBinding = manager.createServiceBinding();
        serviceBinding.setAccessURI(wsdlURL);
        //service.addServiceBinding(serviceBinding);

        //removing the previous one
        service.removeServiceBinding(serviceBinding);

        //must only be one
        Collection<Organization> organizations = new ArrayList<>(1);
        organizations.add(organization);

        //accepts a Collection
        BulkResponse bulkResponse = manager.saveOrganizations(organizations);

    } catch (JAXRException e) {
        e.printStackTrace();
    }

我希望它能注册新服务并删除旧服务,但是老实说我只是不完全了解它是如何工作的。我已经在本教程的帮助下编写了此代码:https://docs.oracle.com/javaee/1.4/tutorial/doc/JAXR2.html

0 个答案:

没有答案