AXIS1.4部署

  还是那个项目 由于中间件用的VC,而且用的是AXIS1.3
所以之前用AXIS2实现的服务被它解析出来总是有问题,明明传的是数组过去,结果生成的代理类却不是数组,问题出在了标签的不一致上 AXIS2已经不支持用array类型了…………

所以我得改,把之前的服务改用axis1的来实现

  之前看过,感觉挺麻烦,就没认真看了,就找了个部署方便的AXIS2来做,现在得硬着头皮上了…………

不过话说回来,认真看过后感觉也就那么回事,没啥难的,这人啊 真得有压力才有动力……

还是说说axis1实现webservice的过程吧
本来要上apache下1.3的版本的 结果链接都出错了,就下了个1.4的用用……

把源文件都下下来了,把里面那个带例子的文件夹中的lib文件下要用的jar包都放到自己工程中,然后将web.xml中配上

<servlet>
    <servlet-name>AxisServlet</servlet-name>
    <servlet-class>
        org.apache.axis.transport.http.AxisServlet
    </servlet-class>
  </servlet>

  <servlet>
    <servlet-name>AdminServlet</servlet-name>
    <servlet-class>
        org.apache.axis.transport.http.AdminServlet
    </servlet-class>
    <load-on-startup>100</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>SOAPMonitorService</servlet-name>
    <servlet-class>
        org.apache.axis.monitor.SOAPMonitorService
    </servlet-class>
    <init-param>
      <param-name>SOAPMonitorPort</param-name>
      <param-value>5001</param-value>
    </init-param>
    <load-on-startup>100</load-on-startup>
  </servlet>

<servlet-mapping>
    <servlet-name>AxisServlet</servlet-name>
    <url-pattern>/servlet/AxisServlet</url-pattern>
  </servlet-mapping>

  <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>

  <servlet-mapping>
    <servlet-name>SOAPMonitorService</servlet-name>
    <url-pattern>/SOAPMonitor</url-pattern>
  </servlet-mapping>



接着将要提供服务的bean复制到webroot目录下,改名为.jws即可以
在地址栏输入http://localhost:8080/XX/XX.jws
就能看到相应的wsdl

这是其中一种部署方式。

那天和那中间件合的时候又出了点问题,这样部署后的wsdl文件中比较乱,有很多ip啊什么的多余信息,于是在那人的要求下换成了wsdd部署,如下

server-config.wsdd:
<?xml version="1.0" encoding="UTF-8"?>
<deployment name="defaultClientConfig"
            xmlns="http://xml.apache.org/axis/wsdd/"
            xmlns:java="http://xml.apache.org/axis/wsdd/providers/java"
            xmlns:handler="http://xml.apache.org/axis/wsdd/providers/handler">

 <globalConfiguration>
   <parameter name="disablePrettyXML" value="true"/>
   <parameter name="dotNetSoapEncFix" value="true"/>
   <parameter name="enableNamespacePrefixOptimization" value="false"/>
   <requestFlow>
     <handler type="java:org.apache.axis.handlers.JWSHandler">
        <parameter name="scope" value="session"/>
     </handler>
     <handler type="java:org.apache.axis.handlers.JWSHandler">
        <parameter name="scope" value="request"/>
        <parameter name="extension" value=".jwr"/>
     </handler>
     <!-- uncomment this if you want the SOAP monitor -->
     <!--
     <handler type="java:org.apache.axis.handlers.SOAPMonitorHandler"/>
     -->
   </requestFlow>
   <!-- uncomment this if you want the SOAP monitor -->
   <!--
   <responseFlow>
     <handler type="java:org.apache.axis.handlers.SOAPMonitorHandler"/>
   </responseFlow>
   -->
 </globalConfiguration>

 <handler type="java:org.apache.axis.handlers.http.URLMapper" name="URLMapper"/>
 <handler type="java:org.apache.axis.transport.local.LocalResponder" name="LocalResponder"/>
 <handler type="java:org.apache.axis.handlers.SimpleAuthenticationHandler" name="Authenticate"/>

 
<service name="FileSearch" provider="java:RPC">
  <parameter name="scope" value="Request"/>
  <parameter name="className" value="hpdfs.FileSearchServiceImpl"/>
  <parameter name="allowedMethods" value="*"/>
  <namespace>http://FileSearch</namespace>
  <beanMapping qname="myNS:Fileinfo" xmlns:myNS="http://FileSearch/Beans" languageSpecificType="java:bit.hpdfs.POJO.Fileinfo"/>
  <beanMapping qname="myNS:RelatedPic" xmlns:myNS="http://FileSearch/Beans" languageSpecificType="java:bit.hpdfs.POJO.Relatedpic"/>
  <beanMapping qname="myNS:FileDetailsInfo" xmlns:myNS="http://FileSearch/Beans" languageSpecificType="java:hpdfs.FileDetailsInfo"/> 
 <beanMapping qname="myNS:FileBasicInfo" xmlns:myNS="http://FileSearch/Beans" languageSpecificType="java:hpdfs.FileBasicInfo"/> 
 <beanMapping qname="myNS:FileDirInfo" xmlns:myNS="http://FileSearch/Beans" languageSpecificType="java:hpdfs.FileDirInfo"/> 
</service>

 <transport name="http">
  <parameter name="qs:list" 
               value="org.apache.axis.transport.http.QSListHandler"/>
  <parameter name="qs:method" 
               value="org.apache.axis.transport.http.QSMethodHandler"/>
  <parameter name="qs:wsdl" 
               value="org.apache.axis.transport.http.QSWSDLHandler"/>
  <requestFlow>
   <handler type="URLMapper"/>
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
  </requestFlow>
 </transport>

 <transport name="local">
  <responseFlow>
   <handler type="LocalResponder"/>
  </responseFlow>
 </transport>

</deployment>


将这个文件放到WEB-INF目录下即可,注意<service></service> 部分,就是服务部署描述,按字面意思就能明白。然后在地址栏输入http://localhost:8080/XX/services
就能看到相应的服务列表 点击链接就能查看相应服务的wsdl

和AXIS2挺像,不过在AXIS2中我通过在地址栏上输入服务和相应的方法名就能调用相应服务的方法,不过在AXIS1中似乎不行,还是我没写对……有时间在看看~

你可能感兴趣的:(apache,中间件,webservice,SOAP,vc++)