Consume the web service

  • Once the application server starts, lets run a test-case to consume the webservice mvn --define skip.tests=false -Dtest=WebServiceTest test
  • PS D:\works\hello-web-service> mvn --define skip.tests=false -Dtest=WebServiceTest test   
    [INFO] Scanning for projects...
    [INFO] ------------------------------------------------------------------------
    [INFO] Building HelloWebService Maven Webapp
    [INFO] task-segment: [test]
    [INFO] ------------------------------------------------------------------------
    [INFO] [resources:resources {execution: default-resources}]
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build
    is platform dependent!
    [INFO] Copying 1 resource
    [INFO] [compiler:compile {execution: default-compile}]
    [INFO] Nothing to compile - all classes are up to date
    [INFO] [resources:testResources {execution: default-testResources}]
    [WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build
    is platform dependent!
    [INFO] Copying 1 resource
    [INFO] [compiler:testCompile {execution: default-testCompile}]
    [INFO] Nothing to compile - all classes are up to date
    [INFO] [surefire:test {execution: default-test}]
    [INFO] Surefire report directory: D:\works\hello-web-service\target\surefire-reports

    -------------------------------------------------------
    T E S T S
    -------------------------------------------------------
    Running com.yosanai.tutorial.ws.hellowebservice.WebServiceTest
    Sep 23, 2010 10:47:00 PM org.springframework.test.context.TestContextManager retrieveTestE
    xecutionListeners
    INFO: @TestExecutionListeners is not present for class [class com.yosanai.tutorial.ws.hell
    owebservice.WebServiceTest]: using defaults.
    Sep 23, 2010 10:47:00 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loa
    dBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [application-context.xml]
    Sep 23, 2010 10:47:01 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loa
    dBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [META-INF/cxf/cxf.xml]
    Sep 23, 2010 10:47:01 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loa
    dBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [META-INF/cxf/cxf-extension-so
    ap.xml]
    Sep 23, 2010 10:47:01 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loa
    dBeanDefinitions
    INFO: Loading XML bean definitions from class path resource [META-INF/cxf/cxf-servlet.xml]

    Sep 23, 2010 10:47:01 PM org.springframework.context.support.AbstractApplicationContext pr
    epareRefresh
    INFO: Refreshing org.springframework.context.support.GenericApplicationContext@13b8f864: d
    isplay name [org.springframework.context.support.GenericApplicationContext@13b8f864]; star
    tup date [Thu Sep 23 22:47:01 PDT 2010]; root of context hierarchy
    Sep 23, 2010 10:47:01 PM org.springframework.context.support.AbstractApplicationContext ob
    tainFreshBeanFactory
    INFO: Bean factory for application context [org.springframework.context.support.GenericApp
    licationContext@13b8f864]: org.springframework.beans.factory.support.DefaultListableBeanFa
    ctory@761eec35
    Sep 23, 2010 10:47:01 PM org.springframework.beans.factory.support.DefaultListableBeanFact
    ory preInstantiateSingletons
    INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultLis
    tableBeanFactory@761eec35: defining beans [cxf,org.apache.cxf.bus.spring.BusApplicationLis
    tener,org.apache.cxf.bus.spring.BusWiringBeanFactoryPostProcessor,org.apache.cxf.bus.sprin
    g.Jsr250BeanPostProcessor,org.apache.cxf.bus.spring.BusExtensionPostProcessor,org.apache.c
    xf.resource.ResourceManager,org.apache.cxf.configuration.Configurer,org.apache.cxf.binding
    .BindingFactoryManager,org.apache.cxf.transport.DestinationFactoryManager,org.apache.cxf.t
    ransport.ConduitInitiatorManager,org.apache.cxf.wsdl.WSDLManager,org.apache.cxf.phase.Phas
    eManager,org.apache.cxf.workqueue.WorkQueueManager,org.apache.cxf.buslifecycle.BusLifeCycl
    eManager,org.apache.cxf.endpoint.ServerRegistry,org.apache.cxf.endpoint.ServerLifeCycleMan
    ager,org.apache.cxf.endpoint.ClientLifeCycleManager,org.apache.cxf.transports.http.QueryHa
    ndlerRegistry,org.apache.cxf.endpoint.EndpointResolverRegistry,org.apache.cxf.headers.Head
    erManager,org.apache.cxf.catalog.OASISCatalogManager,org.apache.cxf.endpoint.ServiceContra
    ctResolverRegistry,org.apache.cxf.binding.soap.SoapBindingFactory,org.apache.cxf.binding.s
    oap.SoapTransportFactory,org.apache.cxf.binding.soap.customEditorConfigurer,org.apache.cxf
    .transport.servlet.ServletTransportFactory,hello,fileMgmt,helloWorld,fileManagement,helloC
    lient,helloClientFactory,fileClient,fileClientFactory,org.springframework.context.annotati
    on.internalCommonAnnotationProcessor,org.springframework.context.annotation.internalAutowi
    redAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationPr
    ocessor]; root of factory hierarchy
    Sep 23, 2010 10:47:01 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean build
    ServiceFromClass
    INFO: Creating Service {http://hellowebservice.ws.tutorial.yosanai.com/}HelloWorldImplServ
    ice from class com.yosanai.tutorial.ws.hellowebservice.HelloWorld
    Sep 23, 2010 10:47:02 PM org.apache.cxf.endpoint.ServerImpl initDestination
    INFO: Setting the server's publish address to be /HelloWorld
    Sep 23, 2010 10:47:02 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean build
    ServiceFromClass
    INFO: Creating Service {http://hellowebservice.ws.tutorial.yosanai.com/}FileManagementImpl
    Service from class com.yosanai.tutorial.ws.hellowebservice.FileManagement
    Sep 23, 2010 10:47:02 PM org.apache.cxf.endpoint.ServerImpl initDestination
    INFO: Setting the server's publish address to be /FileManagement
    Sep 23, 2010 10:47:02 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean build
    ServiceFromClass
    INFO: Creating Service {http://hellowebservice.ws.tutorial.yosanai.com/}HelloWorldService
    from class com.yosanai.tutorial.ws.hellowebservice.HelloWorld
    Sep 23, 2010 10:47:02 PM org.apache.cxf.service.factory.ReflectionServiceFactoryBean build
    ServiceFromClass
    INFO: Creating Service {http://hellowebservice.ws.tutorial.yosanai.com/}FileManagementServ
    ice from class com.yosanai.tutorial.ws.hellowebservice.FileManagement
    Hello HelloWorldTest
    Read 34542 bytes of data from the uploaded file icons.jpg
    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 1.549 sec

    Results :

    Tests run: 2, Failures: 0, Errors: 0, Skipped: 0

    Sep 23, 2010 10:47:02 PM org.springframework.context.support.AbstractApplicationContext do
    Close
    INFO: Closing org.springframework.context.support.GenericApplicationContext@13b8f864: disp
    lay name [org.springframework.context.support.GenericApplicationContext@13b8f864]; startup
    date [Thu Sep 23 22:47:01 PDT 2010]; root of context hierarchy
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESSFUL
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 4 seconds
    [INFO] Finished at: Thu Sep 23 22:47:02 PDT 2010
    [INFO] Final Memory: 28M/102M
    [INFO] ------------------------------------------------------------------------
  • The lines marked in red show the response from the web service call. The testcase makes two web service calls
    1. calls a web service with a sample text input and prints the response
    2. calls a web service with a sample binary file as input and prints the response

Who's online

There are currently 0 users and 2 guests online.

Who's new

  • Saravana Peruma...