需求:项目中用到了java写的WebService接口,因为C#和java写的WebService有些区别,有些地方还是需要修改下。
java的格式:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:int="http://Interface.WebService/">
<soapenv:Header/>
<soapenv:Body>
<int:handle>
<!--Optional:-->
<int:message>{
"msgName":"SendHTMCmd","eqpCode":"DS-195","cmd":"Load_Start"}</int:message>
</int:handle>
</soapenv:Body>
</soapenv:Envelope>
App.config里配置接口url
<add key="EapWebServiceUrl" value="http://192.168.30.169:9876/BaseWebServicePublish?wsdl"/>
下面的这个类是我从网上找的又稍加修改了下,根据java的post的body改了getRequestDataALL里面的字符串拼接,这个地方需要根据个人需求进行修改。这个类也适用于.net的WebService接口调用。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System;
using System.Collections;
using System.IO;
using System.Net;
using System.Text;
using System.</