java soap 头_如何将java头添加到java中的soaprequest
如果要將HTTP標(biāo)頭添加到SOAP請(qǐng)求或響應(yīng)中,則無(wú)關(guān)緊要。您應(yīng)該使用MessageContext的方式。
假設(shè)msgContext是您的Axis2請(qǐng)求/響應(yīng)消息上下文對(duì)象(org.apache.axis2.context.MessageContext),下面的代碼將執(zhí)行操作并使用它,您可以添加HTTP標(biāo)頭。
`//Instantiate an Options object from org.apache.axis2.client.Options
Options options = new Options();
//Instantiate an ArrayList of type NamedValue from org.apache.axis2.context.NamedValue
List namedValuePairs = new ArrayList();
//Add as much as headers you want using below code
namedValuePairs.add(new NamedValue("sample", "value"));
//Finally add namedValuePairs to options, and add options to msgContext
options.setProperty(org.apache.axis2.transport.http.HTTPConstants.HTTP_HEADERS, namedValuePairs);
msgContext.setOptions(options);`
與50位技術(shù)專(zhuān)家面對(duì)面20年技術(shù)見(jiàn)證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的java soap 头_如何将java头添加到java中的soaprequest的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 缤越汽车怎么样 详解缤越汽车的性能和口碑
- 下一篇: 电动车行驶证去哪里查?