[英]How can I send header message in Java by using org.apache.axis.client.Stub and java.rmi.Remote?
I have a wsdl and this wsdl has a request message like this, in SOAPUI: 我有一个wsdl,这个wsdl在SOAPUI中有这样的请求消息:
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:service="www.xxxxx.xx">
<soapenv:Header>
<service:SessionInfo>
<service:UserPassword>?</service:UserPassword>
</service:SessionInfo></soapenv:Header>
<soapenv:Body>
<service:Method1>
<!--Optional:-->
<service:Arguments>
<service:Parameter1>?</service:Parameter1>
<service:Parameter2>?</service:Parameter2>
<!--Optional:-->
<service:Parameter3>?</service:Parameter3>
<!--Optional:-->
<service:Parameter4>?</service:Parameter4>
</service:Arguments>
</service:Method1></soapenv:Body></soapenv:Envelope>
I am having problem while sending header message of this wsdl in Java. 在Java中发送此wsdl的标头消息时遇到问题。 I sent the request message in C# and SOAPUI successfully. 我在C#和SOAPUI中成功发送了请求消息。 After importing wsdl in Java I could not access the header part of this request although I was able to access in SOAPUI and C#. 在Java中导入wsdl之后,尽管我能够在SOAPUI和C#中访问,但我无法访问此请求的标头部分。 I can only access body part of this wsdl in Java but I cannot access soapenv:Header part in Java. 我只能在Java中访问此wsdl的主体部分,但不能在Java中访问soapenv:Header部分。 Is there a solution for this problem by using org.apache.axis.client.Stub and java.rmi.Remote? 通过使用org.apache.axis.client.Stub和java.rmi.Remote是否可以解决此问题? How can I add header? 如何添加标题? Thanks. 谢谢。
you can add custom headers
as below: 您可以添加custom headers
,如下所示:
MessageContext responseMessageContext =
MessageContext.getCurrentMessageContext().getOperationContext().getMessageContext(
WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
List headers = new ArrayList();
headers.add(new Header(HTTPConstants.HEADER_CONTENT_ENCODING, "identity"));
responseMessageContext.setProperty(HTTPConstants.HTTP_HEADERS, headers);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.