axis2生成客户端代码的四种方式.docVIP

  • 7
  • 0
  • 约9.87千字
  • 约 13页
  • 2018-01-01 发布于河南
  • 举报
axis2生成客户端代码的四种方式

axis2生成客户端代码的四种方式 使用AXIOM创建客户端 欲用AXIOM创建客户端,请执行以下步骤。 为了完整性,下面的目录结构将“用AXIOM创建服务”一节中的目录一并列出。 - quickstartaxiom - README.txt - build.xml - resources - META-INF - services.xml - StockQuoteService.wsdl - src - samples - quickstart - service - axiom - StockQuoteService.java - clients - AXIOMClient.java 上述引用的AXIOMClient.java类定义如代码9所示。 Code Listing 9: The AXIOMClient class using AXIOM package samples.quickstart.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; import org.apache.axis2.Constants; import org.apache.axis2.addressing.EndpointReference; import org.apache.axis2.client.Options; import org.apache.axis2.client.ServiceClient; public class AXIOMClient { private static EndpointReference targetEPR = new EndpointReference(http://localhost:8080/axis2/services/StockQuoteService); public static OMElement getPricePayload(String symbol) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace(http://axiom.service.quickstart.samples/xsd, tns); OMElement method = fac.createOMElement(getPrice, omNs); OMElement value = fac.createOMElement(symbol, omNs); value.addChild(fac.createOMText(value, symbol)); method.addChild(value); return method; } public static OMElement updatePayload(String symbol, double price) { OMFactory fac = OMAbstractFactory.getOMFactory(); OMNamespace omNs = fac.createOMNamespace(http://axiom.service.quickstart.samples/xsd, tns); OMElement method = fac.createOMElement(update, omNs); OMElement value1 = fac.createOMElement(symbol, omNs); value1.addChild(fac.createOMText(value1, symbol)); method.addChild(value1); OMElement value2 = fac.createOMElement(price, omNs); value2

文档评论(0)

1亿VIP精品文档

相关文档