It is often found that this type of problem is mainly caused by the return of the data conversion problem, in general do not refer directly to the way the WSDL (if called. NET development WebService can), with HttpWebRequest Way to obtain the returned data, and then parse, this way than the reference WSDL success rate, as to how to pass parameters, you can use
SOAPUI tool for analysis, you can see how to pass the parameters
You can also use the Httpanalyzerfull tool to grab a packet and see what content is being submitted and returned.
Whether the. NET call to Java or Java calls. NET, general use of the above two tools can solve the problem
public string Getgsreturn (string url, StringBuilder param)//Submit to WebService and return results
{
String responsestring = String. Empty;
Try
{
byte[] bs = Encoding.UTF8.GetBytes (param. ToString ());
HttpWebRequest myrequest = (HttpWebRequest) webrequest.create (URL);
Myrequest.method = "POST";
MYREQUEST.HEADERS.ADD ("SOAPAction", "\" \ "");
MYREQUEST.HEADERS.ADD ("accept-encoding", "gzip,deflate");
Myrequest.contenttype = "Text/xml; Charset=utf-8 ";
Myrequest.keepalive = true;
Myrequest.contentlength = BS. Length;
Myrequest.useragent = "apache-httpclient/4.1.1 (Java 1.5)";
Stream Reqstream = Myrequest.getrequeststream ();
Reqstream.write (BS, 0, BS. Length);
HttpWebResponse Myresponse;
Try
{myresponse = (HttpWebResponse) myrequest.getresponse ();}
catch (WebException ex)
{myresponse = (HttpWebResponse) ex. Response; }
if (myrequest! = null)
{
StreamReader sr = new StreamReader (Myresponse.getresponsestream (), Encoding.UTF8);
responsestring = Sr. ReadToEnd ();//Data returned
}
}
catch (Exception ex)
{
Responsestring = ex. Message;
}
return responsestring;
}
A parameter use case, depending on your actual needs
StringBuilder param = new StringBuilder ();
Param. Appendline ("<?xml version= ' 1.0 ' encoding= ' utf-8 '?>");
Param. Appendline ("<soapenv:envelope xmlns:xsi= ' http://www.w3.org/2001/XMLSchema-instance ' xmlns:xsd= '/http Www.w3.org/2001/XMLSchema ' xmlns:soapenv= ' http://schemas.xmlsoap.org/soap/envelope/' xmlns:web= '/http Webservice.protal.ems.com ' > ");
Param. Appendline ("<soapenv:Header/>");
Param. Appendline ("<soapenv:Body>");
Param. Appendline ("<web:sendsms soapenv:encodingstyle= ' http://schemas.xmlsoap.org/soap/encoding/' >");
Param. Appendline ("<enterpriseid xsi:type= ' xsd:string ' >15644</enterpriseID>");
Param. Appendline ("<loginname xsi:type= ' xsd:string ' >admin</loginName>");
Param. Appendline ("<password xsi:type= ' xsd:string ' >511c6269b5eb69538c71ab372529fb1d</password>"); 741123
Param. Appendline ("<smsid xsi:type= ' xsd:string ' ></smsId>");
Param. Appendline ("<subport xsi:type= ' xsd:string ' ></subPort>");
Param. Appendline ("<content xsi:type= ' xsd:string ' >" + smstxt + "</content>");
Param. Appendline ("<mobiles xsi:type= ' xsd:string ' >" + tels + "</mobiles>");
Param. Appendline ("<sendtime xsi:type= ' xsd:string ' ></sendTime>");
Param. Appendline ("</web:sendSMS>");
Param. Appendline ("</soapenv:Body>");
Param. Appendline ("</soapenv:Envelope>");
String rtnstr = Getgsreturn (Smsurl, param);//Transfer parameter and return result
. NET calls to Java or Java to call. NET return Data conversion issues