Axis2 和 Spring 配置相关的内容


----------------------------------------------------------------------------
【web.xml】
----------------------------------------------------------------------------
 
 
    org.springframework.web.context.ContextLoaderListener
 

 
    contextConfigLocation
    classpath:spring-config.xml
 

 
 
    AxisServlet
    org.apache.axis2.transport.http.AxisServlet
    1
 

 
    AxisAdminServlet
    org.apache.axis2.transport.http.AxisAdminServlet
 

 
    AxisServlet
    /servlet/AxisServlet
 

 
    AxisServlet
    *.jws
 

 
    AxisServlet
    /services/*
 

 
    AxisAdminServlet
    /axis2-admin/*
 
----------------------------------------------------------------------------
【spring-config.xml】
----------------------------------------------------------------------------
 
 
----------------------------------------------------------------------------
【WEB-INF\modules】中的文件列表:
----------------------------------------------------------------------------
  1. addressing-1.6.2.mar
  2. mex-1.6.2.mar
  3. modules.list
  4. mtompolicy-1.6.2.mar
  5. ping-1.6.2.mar
  6. scripting-1.6.2.mar
  7. soapmonitor-1.6.2.mar
----------------------------------------------------------------------------
【WEB-INF\services】中的文件列表:
----------------------------------------------------------------------------
  1. <工程名称>\META-INF\services.xml
  2. services.list
  3. version.aar
----------------------------------------------------------------------------
【WEB-INF\services\<工程名称>\META-INF\services.xml】
----------------------------------------------------------------------------
 
    scope="application">
    org.apache.axis2.extensions.spring.receivers.SpringAppContextAwareObjectSupplier
   
    helloService
   
     
        class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver" />
     
        class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" />
   
 
----------------------------------------------------------------------------
【HelloService.java】的内容:
----------------------------------------------------------------------------
package cn.lou.study.axis2;

public class HelloService {

    public String sayHello(String name) {
        System.out.println("Hello " + name + "!");
        return "Hello " + name + "!";
    }

}
----------------------------------------------------------------------------
【HelloServiceClient.java】的内容:
----------------------------------------------------------------------------
package cn.lou.study.axis2;

import javax.xml.namespace.QName;

import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.rpc.client.RPCServiceClient;

public class HelloServiceClient {
    @SuppressWarnings("unchecked")
    public static void main(String[] args1) throws Exception {
        String str = "{}";
        RPCServiceClient serviceClient = new RPCServiceClient();
        Options options = serviceClient.getOptions();
        options.setAction("sayHello");
        EndpointReference targetEPR = new EndpointReference("http://localhost:8080/JavaStudy/services/service");
        options.setTo(targetEPR);
        Object[] opAddEntryArgs = new Object[] { "Lou" };
        Class[] classes = new Class[] { String.class };
        serviceClient.setTargetEPR(targetEPR);
        QName opAddEntry = new QName("http://axis2.study.lou.cn", "sayHello");
        str = serviceClient.invokeBlocking(opAddEntry, opAddEntryArgs, classes)[0].toString();
        serviceClient.cleanupTransport();
        System.out.println(str);
    }
}
----------------------------------------------------------------------------

你可能感兴趣的:(Java)