/** * Dragon - SOA Governance Platform. * Copyright (c) 2009 EBM Websourcing, http://www.ebmwebsourcing.com/ * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public * License as published by the Free Software Foundation; either * version 2.1 of the License, or (at your option) any later version. * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with this library; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * ------------------------------------------------------------------------- * DragonWSSampleClient.java * ------------------------------------------------------------------------- */ package org.ow2.dragon.service; import java.net.MalformedURLException; import java.net.URL; import javax.xml.namespace.QName; import javax.xml.ws.Service; import org.ow2.dragon.api.to.organization.OrganizationUnitTO; import org.ow2.dragon.service.organization.OrganizationManagerService; import org.ow2.dragon.service.organization.PersonManagerService; import org.ow2.dragon.service.organization.PostManagerService; /** * @author ofabre * */ public class DragonWSSampleClient { public static PersonManagerService personManager; public static OrganizationManagerService organizationManager; public static PostManagerService postManager; static { try { URL orgWsdlURL = new URL( "http://localhost:8080/dragon-ui/ws/OrganizationManagerService?wsdl"); URL personWsdlURL = new URL( "http://localhost:8080/dragon-ui/ws/PersonManagerService?wsdl"); URL postWsdlURL = new URL("http://localhost:8080/dragon-ui/ws/PostManagerService?wsdl"); QName ORG_SERVICE_NAME = new QName("http://organization.service.dragon.ow2.org/", "OrganizationManagerServiceImplService"); QName PERSON_SERVICE_NAME = new QName("http://organization.service.dragon.ow2.org/", "PersonManagerServiceImplService"); QName POST_SERVICE_NAME = new QName("http://organization.service.dragon.ow2.org/", "PostManagerServiceImplService"); Service orgService = Service.create(orgWsdlURL, ORG_SERVICE_NAME); Service personService = Service.create(personWsdlURL, PERSON_SERVICE_NAME); Service postService = Service.create(postWsdlURL, POST_SERVICE_NAME); organizationManager = orgService.getPort(OrganizationManagerService.class); personManager = personService.getPort(PersonManagerService.class); postManager = postService.getPort(PostManagerService.class); } catch (MalformedURLException e) { e.printStackTrace(); } } /** * @param args */ public static void main(String[] args) { // Create Org OrganizationUnitTO organizationUnitTO = new OrganizationUnitTO(); organizationUnitTO.setName("Org1"); organizationUnitTO.setCity("OrgCity1"); try { System.out.println(organizationManager.createOrganization(organizationUnitTO)); } catch (DragonFault e) { e.printStackTrace(); } } }