java soap 头_如何将java头添加到java中的soaprequest
如果要將HTTP標頭添加到SOAP請求或響應中,則無關緊要。您應該使用MessageContext的方式。
假設msgContext是您的Axis2請求/響應消息上下文對象(org.apache.axis2.context.MessageContext),下面的代碼將執行操作并使用它,您可以添加HTTP標頭。
`//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位技術專家面對面20年技術見證,附贈技術全景圖總結
以上是生活随笔為你收集整理的java soap 头_如何将java头添加到java中的soaprequest的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 缤越汽车怎么样 详解缤越汽车的性能和口碑
- 下一篇: 电动车行驶证去哪里查?