- 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
您可能关注的文档
最近下载
- 2024全国初中数学联赛初二卷 .pdf VIP
- 全国初中数学联合竞赛真题及答案(初二组)2015-年.pdf VIP
- AIAG-VDA-SPC手册-Yellow-Volume2026年2月第一版 中文.pdf VIP
- 美甲美睫投资回报2026年培训课件.pptx VIP
- 中国王氏家谱字辈大全.doc VIP
- 《Michael_Porter_Creating_Shared_Value》.pdf VIP
- 直播带货虚假宣传法律规制研究.pdf
- 新大洲本田MS01说明书用户手册.pdf
- 餐饮仓库进销存表格,感觉很实用的Excel表格,分享给大家.xls VIP
- (一模)新疆2026年高三普通高考二月适应性检测文科综合试卷.docx
原创力文档

文档评论(0)