axis使用方法

axis使用方法

1,axis本身可以servlet的形式集成到任何支持servlet的Web容器(web.xml)

<servlet>
  <display-name>Apache-Axis Servlet</display-name>
  <servlet-name>AxisServlet</servlet-name>
  <servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
  </servlet>

2,当然需要让Web容器找到org.apache.axis.transport.http.AxisServlet

将axis所需库和资源配置到classpath里面
或者将axis的lib目录拷贝到WEB-INFO下

3,然后让axis接管WebService的url(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>

4,剩下的只需要告诉axis每个WebService对应着哪个Java类即可(server-config.wsdd(与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>

发表评论

邮箱地址不会被公开。 必填项已用*标注

昵称 *