调用如图,先通过CredentialSoapHeader,然后调用soapBody,进行数据验证的
----ps: 西安西点软件有限责任公司 这TM SB,还得老子调用好久,还调子蛮高的...
奉上代码:
List<String> provinces = new ArrayList<String>();
String str = "";
SOAPConnectionFactory s;
//构建head
Element[] header = new Element[1];
header[0] = new Element().createElement(targetNameSpace, "CredentialSoapHeader ");
Element userName = new Element().createElement(targetNameSpace,
"strAccount");
userName.addChild(Node.TEXT, "asdfas");
header[0].addChild(Node.ELEMENT, userName);
Element pass = new Element().createElement(targetNameSpace, "strKey");
pass.addChild(Node.TEXT, "asdfasdfa");
header[0].addChild(Node.ELEMENT, pass);
//构建body
SoapObject soapObject = new SoapObject(targetNameSpace,
getSupportProvince);
soapObject.addProperty("PayInfo", ""+payinfo);//
// 调用的方法参数与参数值(根据具体需要可选可不选)
// soapObject.addProperty("strKey",
// "asas");// 调用的方法参数与参数值(根据具体需要可选可不选)
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(
SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.headerOut = header;
envelope.bodyOut=soapObject;
HttpTransportSE httpTranstation = new HttpTransportSE(WSDL);
httpTranstation.call(targetNameSpace + getSupportProvince, envelope);
Object ss = envelope.getResponse();
System.out.println("WebServiceHelper.getProvince()" + ss);
_logger.info(ss);