简体   繁体   中英

JAX-WS adding addressing for iBM websphere, IBM web services client

I am running code on websphere and using soap 2.12-2.2?. And the RAD tools to generate the IBM JAX-WS web-services client code. I can connect out to the server in question but the web services requires addressing to be on. If I use a http-client code and soap ui, I can get this request to work and I see the particular SOAP action addressing header. But I can't find a way to add this for the jax-ws code. I mention websphere ibm because I wonder if it is a bug internal to that code. Under the covers, the library is org.apache.axis2 for jax-ws. Here is all the code I tried.

Expected request:

<soap:Envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:ser="http://schemas.schedulenow.com/paramedclients/services" xmlns:data="http://schemas.schedulenow.com/paramedclients/data" xmlns:arr="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
   <soap:Header xmlns:wsa="http://www.w3.org/2005/08/addressing">
  <wsa:Action soap:mustUnderstand="1">http://sion</wsa:Action><wsa:To soap:mustUnderstand="1">...</wsa:To></soap:Header>
   <soap:Body>
      <ser:Initialize>

This contains a valid request when I take the raw string and hit the server. When I use jax-ws ibm cod.e the 'wsa:Action' is missing.

The WSDL has this:

But for some reason, the client just won't add that required header. I tried the following.

            SSLSocketFactory sslFactory = GenerateSocketAndTrustManager.createSSLFactory();

            _desc.getDispatch().getRequestContext().put("com.ibm.ws.wsaddressingAndDependentsDisabled", false); 
            _desc.getDispatch().getRequestContext().put("com.ibm.ws.wsaddressingAndDependentsDisabled", false); 
            _desc.getDispatch().getRequestContext().put("com.ibm.ws.wsaddressing.disabled", false); 
            _desc.getDispatch().getRequestContext().put("com.ibm.ws.wsaddressing.wsdl.UsingAddressing", true);



@Addressing(enabled=true, required=true)
@WebServiceClient(name = "ScheduleService", targetNamespace = "http://tempuri.org/", wsdlLocation = "WEB-INF/wsdl/ScheduleService_1.wsdl")



            AddressingFeature feat = new AddressingFeature(true, false);            
            _service.getWSHttpBindingScheduleService(feat);

As stated here , the way to go would be to add the AddressingFeature where you create your Port (example taken from Oracle docs):

HelloWorld port = service.getHelloWorldPort(
    new AddressingFeature(true, true));

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM