我尝试客户端到Java 7中的Web服务。
警告:表示消息寻址属性的必需标头不存在,问题标头:{http://www.w3.org/2005/08/addressing}操作
com.sun.xml.internal.ws.addressing.model.MissingAddressingHeaderException:缺少WS-Addressing标头:“ {http://www.w3.org/2005/08/addressing} Action”
我该如何解决这个错误?
非常感谢。
-网络服务安全性看起来像SOAPUI中的以下部分-
<wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
<wsse:UsernameToken wsu:Id="UsernameToken-1">
<wsse:Username>gelistirici</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">gelistirme12</wsse:Password>
<wsse:Nonce EncodingType="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-soap-message-security-1.0#Base64Binary">NT357!!_</wsse:Nonce>
<wsu:Created>2016-05-07T11:57:03.821Z</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
</soapenv:Header>
-Web服务界面-
@WebMethod(action = "getRequestDetail")
@WebResult(name = "requestDetail", targetNamespace = "")
@RequestWrapper(localName = "getRequestDetail", targetNamespace = "http://xmlns.oracle.com/scheduler", className = "tr.com.service.soap.client.oracle.ess.beans.GetRequestDetail")
@ResponseWrapper(localName = "getRequestDetailResponse", targetNamespace = "http://xmlns.oracle.com/scheduler", className = "tr.com.service.soap.client.oracle.ess.beans.GetRequestDetailResponse")
public RequestDetail getRequestDetail(
@WebParam(name = "requestId", targetNamespace = "http://xmlns.oracle.com/scheduler")
long requestId)
throws NotFoundException_Exception, RuntimeServiceException_Exception;
-Web服务客户端的Java代码-
ESSWebService_Service service = new ESSWebService_Service();
ESSWebService port = service.getSchedulerServiceImplPort();
BindingProvider provider = BindingProvider.class.cast(port);
provider.getRequestContext().put("UsernameToken", "UsernameToken-1");
provider.getRequestContext().put("Username", "gelistirici");
provider.getRequestContext().put("Password", "gelistirme12");
provider.getRequestContext().put("Nonce", "NT357!!_");
provider.getRequestContext().put("Created", "2016-05-07T11:57:03.821Z");
RequestDetail requestDetail = port.getRequestDetail(37);
最佳答案
我对此有点感动
我收到的第一个错误是-缺少WS-Addressing标头-
我找到解决此链接的方法:http://informatictips.blogspot.com.tr/2013/09/using-message-handler-to-alter-soap.html
我收到了第二个错误--已经存在时无法添加标头-
我找到解决此链接的方法:SEVERE: SAAJ0120: Can't add a header when one is already present
现在,我收到了第三个错误--- java.lang.ExceptionInInitializerError--
我找不到此错误的解决方案