本文介绍了黑莓kSoap2&肥皂头的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
尝试指定自定义soap标头。不确定如何填充SoapEnvelope.headerOut属性。
Trying to specify a custom soap header. Not sure how the SoapEnvelope.headerOut propery is to be populated.
我的代码到目前为止?
String soapAction = serviceNamespace + "/SearchCustomer";
SoapObject rpc = new SoapObject(serviceNamespace, "SearchCustomers");
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.bodyOut = rpc;
envelope.dotNet = true;
envelope.encodingStyle = SoapSerializationEnvelope.ENC;
rpc.addProperty("searchBy", searchBy);
rpc.addProperty("groupBy", Integer.toString(groupBy));
这是标题WSDL提取...
Here is the header WSDL extract...
<soap:Header>
<MISHeader xmlns="http://NCBI/WS/CRM">
<applicationName>string</applicationName>
<userName>string</userName>
</MISHeader>
</soap:Header>
推荐答案
headerOut是你需要构建的Element [] 。
headerOut is an Element[] that you need to build.
这样的东西
Element usernameElement = new Element().createElement(OASIS_SECURITY_XSD_URL, "Username");
usernameElement.addChild(Node.TEXT, username);
Element passwordElement = new Element().createElement(OASIS_SECURITY_XSD_URL, "Password");
passwordElement.addChild(Node.TEXT, password);
然后将其添加到数组中..
and then add it to an array..
这篇关于黑莓kSoap2&肥皂头的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!