这个是服务接口....
public Document addCustomer(Document dom)throws Exception{
String customerNo;
String custName;
String custType;
String custPhone;
String custAddr;
java.util.Map returnMessage = new HashMap();
Element XMLInfo = dom.getDocumentElement();
NodeList customerinfos = XMLInfo.getElementsByTagName("customerinfo");
Element customerinfo = (Element)customerinfos.item(0);
NodeList CustomerID = customerinfo.getElementsByTagName("customerID");
NodeList customerName = customerinfo.getElementsByTagName("customername");
NodeList customerType = customerinfo.getElementsByTagName("customertype");
NodeList phone = customerinfo.getElementsByTagName("phone");
NodeList address = customerinfo.getElementsByTagName("address");
customerNo = null;
custName = null;
custType = null;
custPhone = null;
custAddr = null;
if (CustomerID.item(0).getFirstChild() != null)
customerNo = CustomerID.item(0).getFirstChild().getNodeValue();
if (customerName.item(0).getFirstChild() != null)
custName = customerName.item(0).getFirstChild().getNodeValue();
if (customerType.item(0).getFirstChild() != null)
custType = customerType.item(0).getFirstChild().getNodeValue();
if (phone.item(0).getFirstChild() != null)
custPhone = phone.item(0).getFirstChild().getNodeValue();
if (address.item(0).getFirstChild() != null)
custAddr = address.item(0).getFirstChild().getNodeValue();
由于之前做webservice 都是用cxf 实现的..现在的项目用的是axis 这个玩意...
情急之下到这来向各位大侠求助了..这个我该怎么调用它???
以下是我的实现..但是总是不成功:
public static void main(String[] args) throws Exception {
Options option = new Options();
EndpointReference endPoint = new EndpointReference("http://localhost:8077/test/services/testService");
option.setTo(endPoint);
ServiceClient sender = new ServiceClient();
sender.setOptions(option);
OMFactory factory = OMAbstractFactory.getOMFactory();
OMNamespace nameSpace = factory.createOMNamespace("http://webservice/org", "");
OMElement root = factory.createOMElement("XMLinfo", nameSpace);
OMElement cusinfo = factory.createOMElement("customerinfo", nameSpace);
OMElement element1 = factory.createOMElement("customerID", nameSpace);
element1.setText("01");
OMElement element2 = factory.createOMElement("customername", nameSpace);
element2.setText("大任");
OMElement element3 = factory.createOMElement("customertype", nameSpace);
element3.setText("1");
OMElement element4 = factory.createOMElement("phone", nameSpace);
element4.setText("12345");
OMElement element5 = factory.createOMElement("address", nameSpace);
element5.setText("地府");
cusinfo.addChild(element1);
cusinfo.addChild(element2);
cusinfo.addChild(element3);
cusinfo.addChild(element4);
cusinfo.addChild(element5);
root.addChild(cusinfo);
System.out.println("--------------------------------------2 "+cusinfo);
Document document = (Document)sender.sendReceive(root);
}
错误提示如下:
Exception in thread "main" org.apache.axis2.AxisFault: org.xml.sax.SAXException: SimpleDeserializer encountered a child element, which is NOT expected, in something it was trying to deserialize.
at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512)
at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370)
at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416)
at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228)
at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548)
at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528)
at test.testClient.main(testClient.java:56)
望各位大侠指点...
分享到:
相关推荐
院前急救与院内抢救有效衔接工作制度.doc
可以杀毒360急救箱360急救箱城西FDSAFDSA
安克急救管理系统介绍
抢救中急救用药或急救器械供应不足的应急预案Microsoft文档.pdf
综合管理办法于建立优质120急救中心院前急救医疗服务体系中对抢救成功率和急救差错事故的影响.pdf
开不了机?还中毒?使用系统急救。 先使用U盘制作PE启动盘,然后再开启本软件急救,效果杠杠滴
日常急救手册ACCESS数据库:包括了常见急救、急救须知、户外意外急救、以及内科、外科、五官科、妇产科等的资料
[现场急救指南]由急救专家编制,汇集了国内外有关损伤及急症现场救护的知识和技法,综合,全面,简洁,实用,图文并茂,可以帮助用户在遭遇紧急情况时开 展及时有效的伤病救护.即便是完全缺乏急救常识的用户,按照本指南...
急救卡
断网急救箱,修复host拦截,修复不能上网,dns解析错误,急救箱。
如果您打不开网页,或是打不开聊天软件,建议您使用360断网急救箱,帮您全面诊断网络。 您是否经常遇到有些网页打不开,聊天软件登录不上,邮件收取不到等无法上网的情况? 快来试试360断网急救箱吧!有了360断网...
心脏骤停的急救及护理,心脏骤停的急救及护理PPT,心脏骤停的急救及护理课件
360急救盘
微信小程序 医疗保健 医疗急救小程序 (源代码+截图)微信小程序 医疗保健 医疗急救小程序 (源代码+截图)微信小程序 医疗保健 医疗急救小程序 (源代码+截图)微信小程序 医疗保健 医疗急救小程序 (源代码+截图)...
交通灯运行状态: 状态1:南北绿灯,东西...设急救车通过路口时间为10秒,急救车通过后,交通恢复正常,本实验用单次脉冲申请中断,表示有急救车通过。含有Keil工程文件和Proteus仿真工程文件以及程序汇编语言源代码。
急诊抢救抢救图,可用,无需任何插件.
努比亚官方售后工厂急救工具 安装版软件 售后工厂专用 可以备份资料 可以刷写救砖 可以恢复参数等等 努比亚机型专用软件
360断网急救箱独立版下载