使用Axis2的底层API开发Web Service Server端

AXIS2实战指南:SOAP服务部署、调试与性能调优 Web服务是企业系统集成的基础能力,而SOAP协议因其强契约性、跨语言兼容性和WS-*标准支持,在金融、电力、政务等强规范场景中仍不可替代。AXIS2作为成熟稳定的Java SOAP引擎,核心价值在于将POJO精准映射为WSDL可描述的服务,并在WebLogic、WebSphere等传统中间件中可靠运行。其模块化架构(AxisEngine/Phase/Handler)支撑消息全生命周期管控,但classloader隔离、OMElement内存模型、线程安全Stub等特性也带来典型工程挑战。本文聚焦AXIS2 阅读详情

1.使用Axis2的底层API开发Web Service Server端

  1.1创建一个WebService(取名为MyService)

  在MyService中有两个operations,如下所示。

  public void ping(OMElement element){}//IN-ONLY模式。仅仅接收OMElement,并对其处理。

  public OMElement echo(OMElement element){}//IN_OUT模式。接收OMElemen,并返回OMElement。

  1.2如何写Web Service

  1)创建实现服务的类。

  2)创建services.xml来解析这个Web Service。

  3)将其打包成一个*.aar文档(Axis Archive)。

  4)部署Web Service。

  1.2.1 创建实现服务的类

  此类中提供的方法必须与Web Service(在services.xml中声明)中的operations对应。除非你提供了数据绑定,否则所有的方法只能接收一个参数,其类型为OMElement。

双击代码全选
1
2
3
4
public class MyService{
  public void ping(OMElement element){...}
  public OMElement echo(OMElement element){...}
}

  MyService.java

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package userguide.example1;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import javax.xml.stream.XMLStreamException;
public class MyService {
   public OMElement echo(OMElement element) throws XMLStreamException {
     //Praparing the OMElement so that it can be attached to another OM Tree.
     //First the OMElement should be completely build in case it is not fully built and still
     //some of the xml is in the stream.
    element.build();
     //Secondly the OMElement should be detached from the current OMTree so that it can
     // be attached some other OM Tree. Once detached the OmTree will remove its
    // connections to this OMElement.
    element.detach();
     return element;
  }
   public void ping(OMElement element) throws XMLStreamException {
     //Do some processing
  }
   public void pingF(OMElement element) throws AxisFault{
     throw new AxisFault( "Fault being thrown" );
  }
}

  1.2.2 创建services.xml

  Axis2使用services.xml来充当一个Web Servicea的配置文件。每一个使用Axis2部署的Web Service都必须拥有一个services.xml。

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<services>
 <description>
  This is a sample Web Service with two operations,echo and ping.
 </description>
 <parameter name=”ServiceClass” locked=” false ”>
 userguide.example1.MyService
 </parameter>
 <operation name=”echo”>
  <messageReceiver class =”org.apache.axis2.receivers.RawXMLINOutMessageReceiver”/>
  <actionMapping>urn:echo</actionMapping>
 </operation>
 <operation name=”ping”>
  <messageReceiver class =”org.apache.receivers.RawXMLINOnlyMessageReceiver”/>
  <actionMapping>urn:ping</actionMapping>
 </operation>
</service>

  注:The actionMapping is required only if you want to enable WS-Addressing.

  可以创建一个services.xml,其中包含一组服务。这样在运行期,你可以在这些服务间共享信息。

双击代码全选
1
2
3
4
5
6
7
8
9
10
<serviceGroup>
 <service name=”Service1”>
  <!--details for Services1-->
 </service>
<service name=”Service2”>
  <!--details for Services2-->
 </service>
 <module ref=”ModuleName”/>
 <parameter name=”serviceGroupParam1” locked=” false ”>value1</parameter>
</serviceGroup>

  注:name of the service is a compulsory attribute.

  1.2.3打包与部署

  这里不再详述,参见《基于Tomcat5.0和Axis2开发Web Service应用实例 》。

  2.使用Axis2底层APIs实现Web Service客户端

  2.1ClientUtil

  创建一个客户端通用的SOAP包装Util文件。封装"getEchoOMElement"和"getPingOMElement"分别对应"echo"和"ping"这两个operation。

  ClientUtil.java

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
package userguide.clients;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
public class ClientUtil {
   public static OMElement getEchoOMElement() {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace(
         "<a href=" %5C%22http: //example1.org/example1%5C%22">http://example1.org/example1</a>", "example1");
    OMElement method = fac.createOMElement( "echo" , omNs);
    OMElement value = fac.createOMElement( "Text" , omNs);
    value.addChild(fac.createOMText(value, "Axis2 Echo String " ));
    method.addChild(value);
     return method;
  }
   public static OMElement getPingOMElement() {
    OMFactory fac = OMAbstractFactory.getOMFactory();
    OMNamespace omNs = fac.createOMNamespace(
         "<a href=" %5C%22http: //example1.org/example1%5C%22">http://example1.org/example1</a>", "example1");
    OMElement method = fac.createOMElement( "ping" , omNs);
    OMElement value = fac.createOMElement( "Text" , omNs);
    value.addChild(fac.createOMText(value, "Axis2 Ping String " ));
    method.addChild(value);
     return method;
  }
}



2.2Axis2向用户提供了从blocking single channel调用到non-blocking dual channel调用的多种调用Web Service的模式。下面用最简单的blocking调用机制来实现”MyService”中的"echo" operation。

  EchoBlockingClient.java

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package userguide.clients;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
/**
* Sample for synchronous single channel blocking service invocation.
* Message Exchage Pattern IN-OUT
*/
public class EchoBlockingClient {
private static EndpointReference targetEPR =
new EndpointReference( "<a href=" %5C%22http: //localhost:8080/axis2/services/MyService%5C%22">http://localhost:8080/axis2/services/MyService</a>");
   public static void main(String[] args) {
try {
      OMElement payload = ClientUtil.getEchoOMElement();
      Options options = new Options();
      options.setTo(targetEPR); // this sets the location of MyService service
      ServiceClient serviceClient = new ServiceClient();
      serviceClient.setOptions(options);
      OMElement result = sender.sendReceive(payload);
      System.out.println(result);
} catch (AxisFault axisFault) {
     axisFault.printStackTrace();
}
}

  绿色部分显示了为了调用一个Web Service而需要对operation作的设置。剩下的部分是用来创建OMElement,用来发送和显示相应的OMElement。

  结果:

双击代码全选
1
2
3
4
5
6
<example1:echo xmlns:example1= "<a href=" %5C%22http: //example1.org/example1%5C%22">http://example1.org/example1</a>"
xmlns:tns= "<a href=" %5C%22http: //ws.apache.org/axis2%5C%22">http://ws.apache.org/axis2</a>">
<example1:Text>
Axis2 Echo String
</example1:Text>
</example1:echo>

  2.3 PingClient

  在”MyService”中,我们有一种IN-ONLY模式的名为"ping"的operation。应用它的客户端代码如下:

  PingClient.java

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
package userguide.clients;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
/**
* Sample for fire-and-forget service invocation
* Message Exchage Pattern IN-Only
*/
public class PingClient {
private static EndpointReference targetEPR =
new EndpointReference( "<a href=" %5C%22http: //localhost:8080/axis2/services/MyService%5C%22">http://localhost:8080/axis2/services/MyService</a>");
   public static void main(String[] args) {
try {
    OMElement payload = ClientUtil.getPingOMElement();
    Options options = new Options();
    options.setTo(targetEPR);
    ServiceClient serviceClient = new ServiceClient();
    serviceClient.setOptions(options);
    serviceClient.fireAndForget(payload);
     /**
     * We have to block this thread untill we send the request , the problem
     * is if we go out of the main thread , then request wont send ,so
     * you have to wait some time :)
     */
    Thread.sleep( 500 );
   }
catch (AxisFault axisFault) {
      axisFault.printStackTrace();
   }
}

  由于我们在访问一个IN-ONLY模式的operation,所以我们可以直接使用ServiceClient中的"fireAndForget()"方法来调用这个operation。而且那样做的话,不会阻塞发起端,因此,它会立刻将控制权返回给客户端。

  2.4 EchoNonBlockingClient

  在客户端EchoBlockingClient,一旦调用"serviceClient.sendReceive(payload);",客户端将会被阻塞直到operation完成。这种方式在有很多Web Service需要在一个单一的客户端应用程序中启动时很不可取。一种解决方法是使用Non-Blocking API来调用这些Web Services。Axis2提供给用户一种基于回叫机制的non-blocking API。

  EchoNonBlockingClient.java

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
package userguide.clients;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.client.async.AsyncResult;
import org.apache.axis2.client.async.Callback;
/**
* Sample for asynchronous single channel non-blocking service invocation.
* Message Exchage Pattern IN-OUT
*/
public class EchoNonBlockingClient {
private static EndpointReference targetEPR =
new EndpointReference( "<a href=" %5C%22http: //127.0.0.1:8080/axis2/services/MyService%5C%22">http://127.0.0.1:8080/axis2/services/MyService</a>");
   public static void main(String[] args) {
    ServiceClient sender = null ;
     try {
      OMElement payload = ClientUtil.getEchoOMElement();
      Options options = new Options();
      options.setTo(targetEPR);
       //Callback to handle the response
      Callback callback = new Callback() {
         public void onComplete(AsyncResult result) {
          System.out.println(result.getResponseEnvelope());
        }
         public void onError(Exception e) {
          e.printStackTrace();
        }
      };
       //Non-Blocking Invocation
      sender = new ServiceClient();
      sender.setOptions(options);
      sender.sendReceiveNonBlocking(payload, callback);
       //Wait till the callback receives the response.
       while (!callback.isComplete()) {
        Thread.sleep( 1000 );
      }
    } catch (AxisFault axisFault) {
      axisFault.printStackTrace();
    } catch (Exception ex) {
      ex.printStackTrace();
    } finally {
       try {
        sender.finalizeInvoke();
      } catch (AxisFault axisFault) { }
    }
  }
}

结果:
双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<?xml version= '1.0' encoding= 'utf-8' ?>
<soapenv:Envelope xmlns:soapenv= "<a href=" %5C%22http: //schemas.xmlsoap.org/soap/envelope/%5C%22">http://schemas.xmlsoap.org/soap/envelope/</a>">
<soapenv:Header />
<soapenv:Body>
<example1:echo xmlns:example1= "<a href=" %5C%22http: //example1.org/example1%5C%22">http://example1.org/example1</a>"
xmlns:tns= "<a href=" %5C%22http: //ws.apache.org/axis2%5C%22">http://ws.apache.org/axis2</a>">
<example1:Text>
Axis2 Echo String
</example1:Text>
</example1:echo>
</soapenv:Body>
</soapenv:Envelope>
  sender.sendReceiveNonBlocking(payload, callback);这个调用接受一个callback对象作为参数。Axis2客户端API提供了一个抽象类CallBack,其中提供了方法:
public abstract void onComplete(AsyncResult result);
public abstract void onError(Exception e);
public boolean isComplete() {}
  用户需要重写"onComplete " 和 "onError "方法。一旦客户端收到Web Service的response,onComplete方法将会被调用,这样将中止阻塞状态。

  2.5EchoNonBlockingDualClient

  当调用的Web Service需要很长一段时间来完成时,这种由Non-Blocking API提供的解决方式将有一定的局限性。这种局限性是由使用单一的传输连接来调用Web Service并接收response造成的。换句话说,客户端提供一种没有阻塞的调用机制,但request和response的传输使用单一的传输(双工方式)连接(如HTTP)。长时间运行的Web Service调用或Web Service调用使用单工传输方式(如SMTP)不能简单地利用一个没有阻塞的调用。

  一种尝试地解决方法是request和response各自使用单独的传输连接(单工或双工均可)。这种方式产生的问题是如何解决相关性(关联request和response)。WS-Addressing提供了一种很好的解决方法,在头中使用<wsa:MessageID> 和 <wsa:RelatesTo> 标签。Axis2对这种基于关联机制的寻址方式提供了支持。

  用户可以选择Blocking 或Non-Blocking APIs的Web Service,并使用两个传输连接。通过使用一个布尔标记,同一个API可以调用多个在两个传输连接上的Web Services(IN-OUT operations)。下例使用Non-Blocking API 以及两个传输连接来实现上文中提到的"echo" operation。

  EchoNonBlockingDualClient.java

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
package userguide.clients;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.client.async.AsyncResult;
import org.apache.axis2.client.async.Callback;
import javax.xml.namespace.QName;
/**
* Sample for asynchronous dual channel non-blocking service invocation.
* Message Exchage Pattern IN-OUT
* Ulitmate asynchronous service invocation sample.
*/
public class EchoNonBlockingDualClient {
private static EndpointReference targetEPR =
new EndpointReference( "<a href=" %5C%22http: //127.0.0.1:8080/axis2/services/MyService%5C%22">http://127.0.0.1:8080/axis2/services/MyService</a>");
   public static void main(String[] args) {
    ServiceClient sender = null ;
     try {
      OMElement payload = ClientUtil.getEchoOMElement();
      Options options = new Options();
      options.setTo(targetEPR);
      options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
      options.setUseSeparateListener( true );
      options.setAction( "urn:echo" );  // this is the action mapping we put within the service.xml
       //Callback to handle the response
      Callback callback = new Callback() {
         public void onComplete(AsyncResult result) {
          System.out.println(result.getResponseEnvelope());
        }
         public void onError(Exception e) {
          e.printStackTrace();
        }
      };
       //Non-Blocking Invocation
      ConfigurationContext sysContext = ConfigurationContextFactory
      .createConfigurationContextFromFileSystem(
       "D:DvpAxis2axis2WEB-INF" , null ); //见注解①
      sender = new ServiceClient(sysContext, null );
      sender.engageModule( new QName(Constants.MODULE_ADDRESSING));
      sender.setOptions(options);
      sender.sendReceiveNonBlocking(payload, callback);
       //Wait till the callback receives the response.
       while (!callback.isComplete()) {
        Thread.sleep( 1000 );
      }
       //Need to close the Client Side Listener.
    } catch (AxisFault axisFault) {
      axisFault.printStackTrace();
    } catch (Exception ex) {
      ex.printStackTrace();
    } finally {
       try {
        sender.finalizeInvoke();
      } catch (AxisFault axisFault) {
         //have to ignore this
      }
    }
  }
}



注解①

  RE: [Axis2] 0.95 WS-Addressing web SERVICE-SIDE: module not found

  I now have managed to get EchoNonBlockingDualClient working. I still can't get the original code to work, where ever I put addressing-0.95.mar, but the ConfigurationContext works.

  The code I ended up with was:

双击代码全选
1
2
3
4
ConfigurationContext sysContext = ConfigurationContextFactory
      .createConfigurationContextFromFileSystem(
       "C:axis2" , null );
 sender = new ServiceClient(sysContext, null );

  with no need, obviously, for the .engageModule method.

  I did discover though that the directory which the ConfigurationContext points to has to have two directories within it: "conf", which must contain the axis.xml configuration file, and the "modules" directory which contains addressing-0.95.mar.

  在方法"options.setUseSeparateListener(...)"中的布尔标记通知通知Axis2引擎使用两个不同的传输连接来分别处理request和response。Finally中的 "serviceClient.finalizeInvoke()"方法通知Axis2引擎停用客户端的用于接收response的listener。

  在我们运行客户端的例程之前,我们还有一件事情要做。如前面提到的,Axis2使用基于地址的关联机制,因此我们必须在服务器端和客户端“搭建”寻址模块。

  结果:

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?xml version= '1.0' encoding= 'utf-8' ?>
<soapenv:Envelope xmlns:soapenv= "<a href=" %5C%22http: //schemas.xmlsoap.org/soap/envelope/%5C%22">http://schemas.xmlsoap.org/soap/envelope/</a>" xmlns:wsa="<a href="%5C%22http://www.w3.org/2005/08/addressing%5C%22">http://www.w3.org/2005/08/addressing</a>">
<soapenv:Header>
<wsa:To>http: //59.14.131.187:6060/axis2/services/__ANONYMOUS_SERVICE__/__OPERATION_OUT_IN__
</wsa:To>
<wsa:ReplyTo>
<wsa:Address>
<a href= "%5C%22http://www.w3.org/2005/08/addressing/anonymous%5C%22" >http://www.w3.org/ 2005 / 08 /addressing/anonymous</a>
</wsa:Address>
</wsa:ReplyTo>
<wsa:From>
<wsa:Address>
<a href= "%5C%22http://127.0.0.1:8080/axis2/services/MyService%5C%22" >http:// 127.0 . 0.1 : 8080 /axis2/services/MyService</a>
</wsa:Address>
</wsa:From>
<wsa:FaultTo>
<wsa:Address>
<a href= "%5C%22http://127.0.0.1:8080/axis2/services/MyService%5C%22" >http:// 127.0 . 0.1 : 8080 /axis2/services/MyService</a>
</wsa:Address>
</wsa:FaultTo>
<wsa:MessageID>
urn:uuid:B087CBB98F1B51A24711742241136206
</wsa:MessageID>
<wsa:Action>urn:echo</wsa:Action>
<wsa:RelatesTo wsa:RelationshipType= "wsa:Reply" >
urn:uuid:CA4B9513377E6E9E1511742241130391
</wsa:RelatesTo>
</soapenv:Header>
<soapenv:Body>
<example1:echo xmlns:example1= "<a href=" %5C%22http: //example1.org/example1%5C%22">http://example1.org/example1</a>" xmlns:tns="<a href="%5C%22http://ws.apache.org/axis2%5C%22">http://ws.apache.org/axis2</a>">
<example1:Text>
Axis2 Echo String
</example1:Text>
</example1:echo>
</soapenv:Body>
</soapenv:Envelope>
[SimpleHTTPServer] Stop called

  2.6 实现服务器端的寻址

  根据Axis2的结构,寻址模块在"pre-dispatch"阶段已经给出它的句柄。因此,所谓的“搭建”仅仅是在”axis2.xml”(注意不是services.xml)增加一个模块的引用。现在将下面这行字加入到axis2.xml,该文件在"/webapps/axis2/WEB-INF/conf"目录下。

  <module ref="addressing"/>

  注: 一旦你改变了axis2.xml,你必须重启这个servlet容器,改变才能生效。

  2.7 实现客户端的寻址

  有两种方式。

  一种方法是在%Axis2_HOME%axis2-std-1.0-binmodules目录下得到addressing-<version>.mar。并且在你的classpath中对其可见。(此种方法目前,我还没有调试成功,具体见注解①。下面的第二种方法可用)

  另一种方法是创建一个ConfigurationContext,指定一个repository位置。Axis2支持repository的方式来保存服务和模块。

  你可以使用二进制distribution作为repository,只要它含有一个Axis2 repository认可的repository结构(其中应包含services和modules目录)。ConfigurationContext 中含有Axis2体系的运行时的上下文信息。

  如果你解压一个标准的二进制distribution到目录(譬如)$user_home/axis2/dist, 那么在 sender = new ServiceClient();之前加入(具体见EchoNonBlockingDualClient.java):

new ServiceClient();之前加入(具体见EchoNonBlockingDualClient.java):
双击代码全选
1
2
3
ConfigurationContext configContext =
ConfigurationContextFactory.createConfigurationContextFromFileSystem(< Axis2RepositoryLocation >, null );
  用 "sender = new ServiceClient(configContext, null);" 替换 "sender = new ServiceClient();"

  这样可以在客户端和服务器端都实现寻址。

  2.8 EchoBlockingDualClient

  这又是一个两路的传输的request/response客户端,但这次,我们使用一个Blocking API。实现机制和EchoNonBlockingDualClient差不多,唯一的不同是,这里不需要使用一个callback对象来处理response。

  EchoBlockingDualClient.java

双击代码全选
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package userguide.clients;
import org.apache.axiom.om.OMElement;
import org.apache.axis2.AxisFault;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import javax.xml.namespace.QName;
import javax.xml.stream.XMLOutputFactory;
import java.io.StringWriter;
/**
* Sample for synchronous dual channel blocking service invocation.
* Message Exchage Pattern IN-OUT
*/
public class EchoBlockingDualClient {
private static EndpointReference targetEPR =
new EndpointReference( "<a href=" %5C%22http: //127.0.0.1:8080/axis2/services/MyService%5C%22">http://127.0.0.1:8080/axis2/services/MyService</a>");
   public static void main(String[] args) {
    ServiceClient sender = null ;
     try {
      OMElement payload = ClientUtil.getEchoOMElement();
      Options options = new Options();
      options.setTo(targetEPR);
      options.setAction( "urn:echo" );
       //The boolean flag informs the axis2 engine to use two separate transport connection
       //to retrieve the response.
      options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
      options.setUseSeparateListener( true );
       //Blocking Invocation
      ConfigurationContext sysContext = ConfigurationContextFactory
      .createConfigurationContextFromFileSystem(
       "D:DvpAxis2axis2WEB-INF" , null );
      sender = new ServiceClient(sysContext, null );
      sender.engageModule( new QName(Constants.MODULE_ADDRESSING));
      sender.setOptions(options);
      OMElement result = sender.sendReceive(payload);
      StringWriter writer = new StringWriter();
      result.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(writer));
      writer.flush();
      System.out.println(writer.toString());
       //Need to close the Client Side Listener.
    } catch (AxisFault axisFault) {
      axisFault.printStackTrace();
    } catch (Exception ex) {
      ex.printStackTrace();
    } finally {
       try {
        sender.finalizeInvoke();
      } catch (AxisFault axisFault) {
         //
      }
    }
  }
}

  结果:

双击代码全选
1
2
3
4
5
6
<example1:echo xmlns:example1="http: //example1.org/example1
" xmlns:tns=" http: //ws.apache.org/axis2
">
<example1:Text>Axis2 Echo String </example1:Text>
</example1:echo>
[SimpleHTTPServer] Stop called

  本文出自 “子 孑” 博客,请务必保留此出处http://zhangjunhd.blog.51cto.com/113473/25592



axis帮助文档(API) Apache Axis 是 Apache Web Service 项目中的子项目之一,它是 Apache SOAP 项目的延续。Axis 的主要功能是作为一个 SOAP 的实现来让开发者通过它来构建自己的 Web Service(支持 Java 和 C++)。随着 Web Services 以及 SOA 的不断发展,越来越多的人投入到了相关技术的实现、开发和标准的制定的工作中。Apache Axis 凭借它强大的功能和稳定性倍受开发人员的青睐,成为了用于实现 Web Services 的主要途径,在这里提供axis的API 立即下载

相关推荐

axis1.4官方api文档

此文档通过官方api获取生成,可正常打开,绝对可用

java soap namespace_如何使用Apache Axis2和WSDL2Java向SOAP響應添加命名空間引用

I'm looking at the SOAP output from a web service I'm developing, and I noticed something curious:我正在查看我正在開發的Web服務的SOAP輸出,我發現了一些好奇的東西:123423453456Error1Error2I have two newKeys elements that are nil, ...

weixin_33278577的博客 250

Axis Api和其工具

Axis Api,bin,tools,实例.里面有详细的例子和Api

Axis设置SOAP协议版本

现在Axis、Axis2都是同时支持SOAP1.1和SOAP1.2的。即在服务器端发布一个WebService服务之后,客户端既可以通过SOAP1.1版本来访问服务器的服务,也可以通过SOAP1.2版本来访问服务器的服务。     如果客户端不指定SOAP版本,则无论是用Axis还是Axis2编写的客户端,默认使用的都是SOAP1.1版本,如果某个服务端仅支持SOAP1.2的,则在服务的交互

dos_186的博客 2986

Axis_API和axis2_API

Axis和Axis2的API!Axis和Axis2的查询文档!

使用axis2调用sap生成的webservice(带用户密码认证)

项目中接触到了用SAP系统生成的webservice接口,接口地址形如下: http://12.12.12.12:8000/sap/bc/srt/wsdl/srvc_55FDB689239112C0E10080000AF6031B/wsdl11/test/ws_policy/document?sap-client=400 这种形式的接口直接通过axis axis2调用地址的方式是无法调用成功的

coolcoffee168的专栏 2万+

第一弹:llama.cpp编译

1.编译llama.cpp命令行(电脑版本);2.交叉编译安卓命令行版本。

joedan0104的专栏 1万+

如何在Axis2中添加SOAP头(转)

修改方式已经很明确了,在MathStub类中创建私有方法,通过AXIOM(使用版本为:1.2.14)生成所需头对象,然后将该头对象添加至ServiceClient对象即可。原文链接:https://blog.youkuaiyun.com/a19881029/article/details/41643573///其它构造函数最终都是调用这个函数创建MathStub对象。

Wo_Ai_Java的专栏 242

OpenWRT端口转发与NAT环回冲突的排查与解决

本文详细解析了OpenWRT路由器中端口转发与NAT环回功能冲突导致的内网访问故障。通过生活化类比阐明两者工作原理,提供从基础诊断到内核参数调整、LuCI选项配置及手动编写iptables规则的多套解决方案,并给出进阶排查思路,帮助用户彻底解决内网无法通过公网地址访问服务的常见问题。

weixin_29243279的博客 513

Bugku中的source

进入环境后 我们首先查看源码可以得到一个flag 这肯定是个假的(已经提交过了确实是个假的) 题目提示要用Linux 这里使用的是kali 我们首先dirsearch一下这个网站 可以看到有.git文件泄露 也可以点开那个链接但是在里面没有找到flag 然后选择下载这个.git文件 然后进入这个文件夹 输入git reflog查看文件状态 可以看到有四个都有flag is here 一个一个查看git show 然后在40c6d51中发现了我们需要的fl

A272036149的博客 1013

使用 Axis2主要API开发WebService客户端

该部分将为高级用户介绍复杂但是更加强大的基于XML的WebService客户端,然而如果你是一个新手还是建议你使用axis的代码生成器进行客户端的开发. Web services能够用于为用户提供广泛的功能从单一的功能到像获取证券报价这样的实时操作以及耗时的商业服务.当我们利用这些服务的时候我们单一的客户 端操作方式将不会适合所有的复杂的服务操作 . 例如:我们使用单个传输通道(比如HTTP协议

competerH_programing的专栏 1944

Unity类银河恶魔城学习记录1-10 PlayerWallJump源代码 P37

Alex教程每一P的教程原代码加上我自己的理解初步理解写的注释,可供学习Alex教程的人参考

Homura_的博客 1381

使用Axis2的底层API开发Web Service

标签:Axis2web WebService 原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 、作者信息和本声明。否则将追究法律责任。http://zhangjunhd.blog.51cto.com/113473/25592 本文是在理解官方指南的基础上,用实例实现Axis2提供的4种调用机制,并给出测试结果。 author: ZJ 07-3-13 Blog

走在java的路途上 775

决策规划算法四:Piecewise Jerk Path Optimizer

一,问题分析 路径规划的本质目的:规划出一条安全(无碰撞),舒适(平滑),符合车辆运动学的轨迹。 如下图所示,决策算法开辟凸空间后,路径规划算法用数值优化的方法搜索出一条最优路径,即将问题转化为二次规划的问题,采用二次规划的求解器进行求解。 二次规划问题的求解顺序: 1,确定优化变量 2,确定目标函数 3,确定约束条件 4,将目标函数和约束条件变形为二次规划的标准形式 5,用二次规划求解器进行求解,获得优化变量的序列,使得目标函数取得最小值。 注:路径的最终表达式为:,..

肥嘟嘟的左卫门 8562

从零开始用飞牛fnas搭建集成DeepSeek-R1的远程AI工作台

从零开始用飞牛fnas搭建集成DeepSeek-R1的远程AI工作台

AI+全栈,AI+应用,实操落地,前沿技术 3811

基于WAS CE和Axis2开发Web Service应用

006 年 10 月 16 日本文将介绍如何使用WAS CE(WebSphere Application Server Community Edition)和Apache Axis2开发、部署及测试一个简单的Web Service应用-网上花店。 引言近 年来,随着Web Service技术迅速发展,基于Web Service开发的应用被使用的越来越广泛。Web Service良好的

zhx8652的专栏 1097

海思芯片OpenHarmony系统移植:Sensor传感器模块HDF驱动配置HCS文件详解

海思系列芯片的传感器模块通过HDF(Hardware Driver Foundation)驱动框架进行管理和配置。传感器HCS(HDF Configuration Source)配置文件定义了各类传感器的硬件参数、总线配置、寄存器序列等信息,为传感器驱动提供必要的初始化和运行参数。海思系列芯片适配OpenHarmony的传感器HDF配置HCS文件是传感器驱动开发的关键部分,通过合理配置可以实现各种传感器设备的驱动支持。

m0_67505153的博客 211

应用Apache Axis进行Web Service开发

转自(http://tscjsj.blog.51cto.com/412451/84813) 一、概述 SOAP原意为Simple Object Access Protocol(简单对象访问协议),是一个用于分布式环境的、轻量级的、基于XML进行信息交换的通信协议(SOAP is an XML based protocol used to exchange information th...

dianhou5755的博客 220

C# WinForm 基于DirectShow.dll编写的程序,可边预览边保存视频,音频和图片

基于微软的DirectShow.dll的二次开发1.自动识别连接的摄像头跟麦克风且可以对其进行选择(默认选中第一个)2.可录制wmv和avi两种格式的视频并且都带有音频,avi可以录制的分辨率和帧数进行选择,wmv默认进行了淸晰度优化如不喜欢可去除代码中有相关提示3.可在预览点开之后进行拍照,也可边录制视频边拍照4.添加了视频和音频的压缩功能(酌情使用)这次二次开发发现C#对DirectShow的相关信息太少,这次做完也不敢藏私共享出来,还望大家指正

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

myeclipse下用axis2开发web service

SayHello是很多人都写过的web service。实现的功能是通过web服务输出“人名,how are you?” 本文参考网上众多资料,有的也不知源作者是谁,就不一一列举了,在此感谢愿意share经验的同志们。   一、环境搭建问题 1、本文环境:myeclipse7.5+jdk1.5+Tomcat5.5+axis2-1.5.4+Axis2_Codegen_Wiza

hongtaq的专栏 661

精雕软件(JDpaint) 5.5 绿色版

精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版精雕软件(JDpaint) 5.5 绿色版

Axis-1.1 webService实现跨project传递参数入

1.       开发环境:windows server 2003,  j2sdk1.4.2_06,     tomcat-5.0.28 2.       首先下载axis-1.1.jar包,下载地址:http://ws.apache.org/axis/java/releases.html     我下载的是:http://archive.apache.org/dist/ws/axis/1_1

hu_shengyang的专栏 3070

lwip-2.0.3

lwip是瑞典计算机科学院(SICS)的Adam Dunkels 开发的一个小型开源的TCP/IP协议栈。实现的重点是在保持TCP协议主要功能的基础上减少对RAM 的占用。

解决The Apache Axis2 Web service runtime in Tomcat v7.0 Server does not support the service project 问题

转载自http://blog.163.com/xueling1231989@126/blog/static/102640807201501383952762/ 按照教程配置Axis2,出现如下图示 经过Google(服了天朝长城防火了)漫长搜索等待,终于小心的找到了解决方法如下: 就是只能使用Servlet3.0以下的规范 在新建Dynamic web

ystyaoshengting的专栏 6278

使用axis2构建webservice(项目中正好用到了)

https://www.cnblogs.com/xueershewang/p/7248589.html

烟台-山子的博客 382

JAVA开发Web Service几种框架介绍

郑重声明:此文为转载来的,出处已不知了,侵告删。    在讲Web Service开发服务时,需要介绍一个目前开发Web Service的几个框架,分别为Axis,axis2,Xfire,CXF以及JWS(也就是前面所述的JAX-WS,这是Java6发布所提供的对 Web Service服务的一种实现。)前面几项都为开源项目,而其中又以axis2与cxf所最为常用,Axis与XFir...

王云十三的博客 111

window下搭建web service

由于项目需要,我这个做底层和系统的都需要搭建应用服务器了,网上找来的资料,对于做应用的来说肯定是小菜一碟了,这里只是做个笔记,勿喷! 一、 下载axis2-1.6.2-bin和axis2-1.6.2-war,地址如下: 二进制包和 war 二进制包和 war http://axis.apache.org/axis2/java/core/download.cgi Ecli

xiaofengcanyue2013的专栏 1735
上一篇: 使用 Axis2主要API开发WebService客户端
下一篇: JS后退一页, JS返回上一页代码, JS返回下一页,JS返回第几页,JS页面跳转, JS引用JS
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值