java 访问 .net webservice

Crystal323 2013-08-23 09:42:45
现在项目要调用别人写的webservice
对方给到的标准是这样的:

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<postsalescreate xmlns="http://tempurl.org">
<astr_request>
<header>
<licensekey></licensekey>
<username>A00181</username>
<password>A00181</password>
<lang></lang>
<pagerecords>100</pagerecords>
<pageno>1</pageno>
<updatecount>0</updatecount>
<messagetype>SALESDATA</messagetype>
<messageid>332</messageid>
<version>V332M</version>
</header>
<salestotal>
<localstorecode>A00181</localstorecode>
<reservedocno></reservedocno>
<txdate_yyyymmdd>20130228</txdate_yyyymmdd>
<txtime_hhmmss>173900</txtime_hhmmss>
<mallid>2037</mallid>
<storecode>A00181</storecode>
<tillid>01</tillid>
<salestype>SA</salestype>
<txdocno>S201000300</txdocno>
<orgtxdate_yyyymmdd></orgtxdate_yyyymmdd>
<orgstorecode></orgstorecode>
<orgtillid></orgtillid>
<txorgdocno></txorgdocno>
<mallitemcode></mallitemcode>
<cashier>A00181</cashier>
<vipcode></vipcode>
<salesman></salesman>
<demographiccode></demographiccode>
<demographicdata></demographicdata>
<netqty>1.00</netqty>
<originalamount>0.00</originalamount>
<sellingamount>20.00</sellingamount>
<couponnumber></couponnumber>
<coupongroup></coupongroup>
<coupontype></coupontype>
<couponqty>0</couponqty>
<totaldiscount>
</totaldiscount>
<ttltaxamount1>0</ttltaxamount1>
<ttltaxamount2>0</ttltaxamount2>
<netamount>20.00</netamount>
<paidamount>20.00</paidamount>
<changeamount>0.00</changeamount>
<priceincludetax></priceincludetax>
<shoptaxgroup></shoptaxgroup>
<extendparam></extendparam>
<invoicetitle></invoicetitle>
<invoicecontent></invoicecontent>
<issueby>A00181</issueby>
<issuedate_yyyymmdd>20130228</issuedate_yyyymmdd>
<issuetime_hhmmss>173904</issuetime_hhmmss>
<ecorderno></ecorderno>
<buyerremark></buyerremark>
<orderremark></orderremark>
<status>10</status>
<ttpossalesdocno></ttpossalesdocno>
</salestotal>
<salesitems>
<salesitem>
<iscounteritemcode>1</iscounteritemcode>
<lineno>1</lineno>
<storecode>A00181</storecode>
<mallitemcode>A00181</mallitemcode>
<counteritemcode>A00181</counteritemcode>
<itemcode>A00181</itemcode>
<plucode>A00181</plucode>
<colorcode></colorcode>
<sizecode></sizecode>
<itemlotnum>*</itemlotnum>
<serialnum></serialnum>
<isdeposit>0</isdeposit>
<iswholesale>0</iswholesale>
<invttype>1</invttype>
<qty>1.00</qty>
<exstk2sales>1.00</exstk2sales>
<originalprice>0.00</originalprice>
<sellingprice>0.00</sellingprice>
<pricemode></pricemode>
<priceapprove></priceapprove>
<couponnumber></couponnumber>
<coupongroup></coupongroup>
<coupontype></coupontype>
<itemdiscount>
</itemdiscount>
<vipdiscountpercent>0</vipdiscountpercent>
<vipdiscountless>0</vipdiscountless>
<promotion>
</promotion>
<totaldiscountless1>0</totaldiscountless1>
<totaldiscountless2>0</totaldiscountless2>
<totaldiscountless>0</totaldiscountless>
<tax>
</tax>
<netamount>20.00</netamount>
<bonusearn>0</bonusearn>
<salesitemremark></salesitemremark>
<refundreasoncode></refundreasoncode>
<extendparam></extendparam>
</salesitem>
</salesitems>
<salestenders>
<salestender>
<lineno>1</lineno>
<tendercode>CH</tendercode>
<tendertype>0</tendertype>
<tendercategory>0</tendercategory>
<payamount>20.00</payamount>
<baseamount>20.00</baseamount>
<excessamount>0</excessamount>
<extendparam>-BS2037A00181,-DTSA,-CT99,</extendparam>
<remark></remark>
</salestender>
</salestenders>
</astr_request>
</postsalescreate>
</soap12:Body>
</soap12:Envelope>




我不知道怎么操作,因为纯粹的调用webservice里面的函数我还是会的,唯独这个方法我硬是没看明白如何调用。
求各位帮忙给点意见,最好能有代码贴上。O(∩_∩)O谢谢!!!

是不是发送这样的xml文件给对方呀。
...全文
63 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
forgetsam 2013-08-23
  • 打赏
  • 举报
回复
这叫标准?这是一个示例的soapxml而已。你照着这个格式拼接出来给它发回去就是了。 他应该发给你的是wsdl+这个,或者只发wsdl,你直接问他懂不懂webservice就完事了。
tony4geek 2013-08-23
  • 打赏
  • 举报
回复
	Service service = new Service();
				Call call = (Call)service.createCall();
				
				call.setTargetEndpointAddress(new java.net.URL(url));
				call.setOperationName(new QName(nameSpace,method));
				call.setUseSOAPAction(true);
				call.setSOAPActionURI(nameSpace + method); 
   call.invoke(new Object[]{xxxx})
invoke 方法返回你上面的xml 然后你解析xml就好了

50,533

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧