Axis: Past memo

Source: Internet
Author: User
1. Use

 

1.1 axis itself can be integrated into any servlet-supported Web Container (Web. XML) in the form of servlets)

<Servlet>

<Display-Name>Apache-axis Servlet</Display-Name>

<Servlet-Name>Axisservlet</Servlet-Name>

<Servlet-class>Org. Apache. axis. Transport. http. axisservlet</Servlet-class>

</Servlet>

1.2 of course, the Web Container needs to find org. Apache. axis. Transport. http. axisservlet

Configure the library and resources required by axis to classpath, or copy the lib directory of axis to Web-info.

1.3 then let axis take over the URL of WebService (Web. XML)

<Servlet-mapping>

<Servlet-Name>Axisservlet</Servlet-Name>

<URL-pattern>*. JWS</Url-pattern>

</Servlet-mapping>

<Servlet-mapping>

<Servlet-Name>Axisservlet</Servlet-Name>

<URL-pattern>/Services /*</Url-pattern>

</Servlet-mapping>

1.4 The rest only needs to tell axis which Java class each WebService corresponds to (server-config.wsdd (same directory as Web. XML ))

<Service name = "organizationwebservice" type = "" provider = "Java: RPC" style = "RPC" use = "encoded">

<Parameter name = "Scope" value = "request"/>

<Parameter name = "classname" value = "nucleus. Organization. WebService. organizationwebservice"/>

<Parameter name = "allowedmethods" value = "isvalid, personofid, personsofrole, querycategories, querypersons"/>

<Namespace> http://webservice.organization.nucleus </namespace>

<Typemapping encodingstyle = "http://schemas.xmlsoap.org/soap/encoding/" QNAME = "NS1: categoryinfo"

Languagespecifictype = "Java: nucleus. Organization. WebService. categoryinfo"

Serializer = "org. Apache. axis. encoding. Ser. beanserializerfactory"

Deserializer = "org. Apache. axis. encoding. Ser. beandeserializerfactory"

Name = "categoryinfo" xmlns: NS1 = "http://webservice.organization.nucleus"/>

</Service>

 

2. Configure and extend 2.1 handlers2.1.1 query string handlers

By default, Axis provides for three axis servlet query string handlers (? List,? Method, And? WSDL).

2.1.2 some default handlers
Jaxrpchandler

Wrapper around und JAX-RPC compliant handlers that exposes an axis handler interface to the engine.

 
Httpsender

A handler which sends the request message to a remote server via HTTP, and collects the Response Message.

 
Localsender

A handler which sends the request message to a "local" axisserver, which will process it and return a response message. this is extremely useful for testing, and is by default mapped to the "local:" transport. so, for instance, you can test the adminclient by doing something like this:

% java org.apache.axis.client.AdminClient -llocal:// list
2.1.3 service, targeted chain, and provider

A service is a special kind of targeted chain in which the specified handler is known as a "provider ".

2.2 configuration2.2.1 engine configuration

The engineconfiguration interface is the means of processing the handler factories and Global Options of an engine instance. an instance of a concrete implementation of engineconfiguration must be passed to the engine when it is created and the engine must be notified if the engineconfiguration contents are modified. the engine keeps a reference to the engineconfiguration and then uses it to obtain handler factories and Global Options.

The engineconfiguration interface belongs to the Message flow subsystem which means that the Message flow subsystem does not depend on the Administration subsystem.

The engineconfiguration is provided by an implementation of the interfaceorg.apache.axis.EngineConfigurationFactory, Which currently provides methods that return client and server configurations.

Our focus will be how to define the implementation classEngineConfigurationFactory.

  • Justification/rationale
    While the default behaviour is sufficient for general use of axis, integrating axis into an existing application server may require an alternate deployment model. A customized implementation of the engineconfigurationfactory wocould map from the hosts deployment model to axis's internal deployment model.

  • Machism
    The relevant sequence of instructions used to obtain configuration information and initialize axis is as follows:

      EngineConfigurationFactory factory = EngineConfigurationFactoryFinder(someContext);
      EngineCongfiguration config = factory.getClientEngineConfig();
      AxisClient = new AxisClient(config);

    The details may vary (server versus client, whether other factories are involved, etc). Regardless, the point is that integration code is responsible for calling EngineConfigurationFactoryFinder(someContext)And ensuring that the results are handed to axis.someContextIs key to how the factory finder locates the appropariate Implementation of engineconfigurationfactory to be used, if any.

    Engineconfigurationfactoryfinder works as follows:

    • Obtain a list of classes that implementorg.apache.axis.EngineConfigurationFactory, In the following order:

      • The value of the system property axis.EngineConfigFactory.

      • The value of the system property org.apache.axis.EngineConfigurationFactory.

      • Locate all resources named META-INF/services/org.apache.axis.EngineConfigurationFactory. Each line of such a resource identifies the name of a class implementing the interface ('# 'comments, through end-of-line ).

      • org.apache.axis.configuration.EngineConfigurationFactoryServlet

      • org.apache.axis.configuration.EngineConfigurationFactoryDefault

       

    • Classes implementing engineconfigurationfactory are required to provide the Method

        public static EngineConfigurationFactory newFactory(Object)

      This method is called, passing someContextAs the parameter.

    • ThenewFactoryMethod is required to checksomeContextParameter to determine if it is meaningfull to the class (at a minimum, verify that it is of an expected type, or class) and may, in addition, examine the overall runtime environment. if the environment can provide information required by an engineconfigurationfactory, thennewFactory()May return in instance of that factory. Otherwise,newFactory()Must return null.

    • Engineconfigurationfactoryfinder returns the first non-null factory it obtains.

  • Default behavior
    The default behaviour is provided by the last two elements of the list of implementing classes, as described above:

    • org.apache.axis.configuration.EngineConfigurationFactoryServlet
      newFactory(obj)Is called. Ifobj instanceof javax.servlet.ServletContextIs true, then an instance of this class is returned.

      The default servlet factory is expected to function as a server (as a client it will incorrectly attempt to load the WSDD Fileclient-config.wsddFrom the current working directory !).

      The default servlet factory will open the web application resource/WEB-INF/server-config.wsdd(The name of this file may be changed using the system property axis.ServerConfigFile):

      • If it exists as an accessible file (I. e. not in a jar/war file), then it opens it as a file. this allows changes to be saved, if changes are allowed & made using the Admin Tools.

      • If it does not exist as a file, then an attempt is made to access it as a resource stream (getresourceasstream), which works for JAR/war file contents.

      • If the resource is simply not available, an attempt is made to create it as a file.

      • If all abve attempts fail, a final attempt is made to access org.apache.axis.server.server-config.wsddAs a data stream.

       

    • org.apache.axis.configuration.EngineConfigurationFactoryDefault
      newFactory(obj)Is called. IfobjIs null then an instance of this class is returned. A non-nullobjIs presumed to require a non-default factory.

      The default factory will load the WSDD filesclient-config.wsddOrserver-config.wsdd, As appropriate, from the current working directory. The names of these files may be changed using the System Properties axis.ClientConfigFileAndaxis.ServerConfigFile, Respectively.

Example, in some start up method (): properties. Put ("Axis. engineconfigfactory"," Com. Our. ws. customfactory ");

Public classCustomfactoryImplementsEngineconfigurationfactory {

PublicEngineconfiguration getclientengineconfig ();

PublicEngineconfiguration getserverengineconfig ();

Public staticEngineconfigurationfactory newfactory (Object PARAM );
}

2.2.2 WSDD

The server is configured (by default) by values in the server-config.wsdd file, though a dedicated axis user can write their own configuration handler, And so store configuration data in an LDAP server, database, remote web service, etc. consult the source on details as to how to do that. you can also add options to the Web. XML file and have them picked up automatically. we don't encourage that as it is nice to keep configuration stuff in one place.

The internal data model used by axis is based on an axis specific data model: Web services deployment descriptor (WSDD). Axis initially obtains the WSDD information for a service from an instance org.apache.axis.EngineConfiguration.

WSDD configuration: Configuration Based on WSDD, but not server-config.wsddFile, It can be dynamic/further configured by admin. Deploy ()

2.2.3 wsdl2java

This tool takes a description of a Web Service written in WSDL and emits Java artefacts used to access the Web service.

There are three layers inside the tool:

  • Framework: symboltable, emitter, writerfactory

  • Wsdl2java plugin to the framework: wsdl2java (the main), javawriterfactory, and all the WSDL-relative writers: javaporttypewriter, javabindingwriter, etc.

  • The actual wsdl2java emitters, one for each file generated: javainterfacewriter, javastubwriter, etc.

  • So:Public classWsdl2javaExtendsOrg. Apache. axis. WSDL. wsdl2java {
    PublicWsdl2java (){
    Super();
    Getparser (). setfactory (New Customizedjavageneratorfactory(Getparser ()));
    }

-T, -- typemappingversion:

Indicate 1.1 or 1.2. The default is 1.1 (soap 1.1 JAX-RPC compliant. 1.2 indicates soap 1.1 encoded.) http://issues.apache.org/jira/browse/AXIS-2467

-W, -- nowrapped

This turns off the special treatment of what is called "wrapped" document/literal style operations. By default, wsdl2java will recognize the following conditions:

  • If an input message has is a single part.

  • The part is an element.

  • The element has the same name as the operation

  • The element's complex type has no attributes

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.