InputStream не представляет действительное сообщение SOAP 1.2 даже после установки версии мыла SaajSoapMessageFactory - PullRequest
0 голосов
/ 12 октября 2018

Я получаю сообщение об ошибке ниже:

org.springframework.ws.soap.SoapMessageCreationException: Не удалось создать сообщение из InputStream: InputStream не представляет действительное сообщение SOAP 1.2;Вложенное исключение - javax.xml.soap.SOAPException: InputStream не представляет действительное сообщение SOAP 1.2

Я попытался установить messageFactory и soap version to 1.2, но все еще получаю тот же error.

Ниже мой wsdl:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions targetNamespace="http://i3l.com/finnair/process/bpm/wsdl/BPMCheckDBConnectivityPWS" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:tns="http://i3l.com/finnair/process/bpm/wsdl/BPMCheckDBConnectivityPWS" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:types1="http://i3l.com/finnair/process/bpm/xsd/BPMCheckDBConnectivityPXS" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/">
<plnk:partnerLinkType xmlns:plnk="http://docs.oasis-open.org/wsbpel/2.0/plnktype" name="BPMCheckDBConnectivity">
   <plnk:role name="Process" portType="tns:BPMCheckDBConnectivityPWSPT"/>
</plnk:partnerLinkType>
  <wsdl:types>
    <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
        <xs:import namespace="http://i3l.com/finnair/process/bpm/xsd/BPMCheckDBConnectivityPXS" schemaLocation="BPMCheckDBConnectivityPXS.xsd"/>
    </xs:schema>
  </wsdl:types>
  <wsdl:message name="startCheckDBConnectivityResponse">
    <wsdl:part name="startCheckDBConnectivityResponse" element="types1:checkDBConnetivityResp">
    </wsdl:part>
  </wsdl:message>
  <wsdl:message name="startCheckDBConnectivityRequest">
    <wsdl:part name="startCheckDBConnectivityRequest" element="types1:checkDBConnetivityReq">
    </wsdl:part>
  </wsdl:message>
  <wsdl:portType name="BPMCheckDBConnectivityPWSPT">
    <wsdl:operation name="startCheckDBConnectivity">
      <wsdl:input message="tns:startCheckDBConnectivityRequest">
    </wsdl:input>
      <wsdl:output message="tns:startCheckDBConnectivityResponse">
    </wsdl:output>
    </wsdl:operation>
  </wsdl:portType>
  <wsdl:binding name="BPMCheckDBConnectivityPWSPTSOAP12Binding" type="tns:BPMCheckDBConnectivityPWSPT">
    <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="startCheckDBConnectivity">
    <soap12:operation soapAction="" style="document"/>
      <wsdl:input>
    <soap12:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
    <soap12:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:binding name="BPMCheckDBConnectivityPWSPTBinding" type="tns:BPMCheckDBConnectivityPWSPT">
    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="startCheckDBConnectivity">
    <soap:operation soapAction="" style="document"/>
      <wsdl:input>
    <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
    <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>
  <wsdl:service name="BPMCheckDBConnectivityPWSPT">
    <wsdl:port name="BPMCheckDBConnectivityPWSPTPort" binding="tns:BPMCheckDBConnectivityPWSPTBinding">
    <soap:address location="http://bpmext.finnair.fi:9090/active-bpel/services/soap12/BPMCheckDBConnectivityPWSPT"/>
    </wsdl:port>
    <wsdl:port name="BPMCheckDBConnectivityPWSPTSOAP12Port" binding="tns:BPMCheckDBConnectivityPWSPTSOAP12Binding">
    <soap12:address location="http://bpmext.finnair.fi:9090/active-bpel/services/soap12/BPMCheckDBConnectivityPWSPT"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

Это мой ws-клиент Spring:

public CheckDBConnetivityRespType startCheckDBConnectivity(CheckDBConnetivityReqType checkDBConnetivityReqType) {
        CheckDBConnetivityRespType response = (CheckDBConnetivityRespType) getWebServiceTemplate()
                .marshalSendAndReceive(targetUri, checkDBConnetivityReqType);
        return response;
    }

Это мой ApplicationClientConfig класс:

@Configuration
public class ClientAppConfig {


    @Bean
    public Jaxb2Marshaller marshaller() {
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        marshaller.setContextPath("com.i3l.finnair.process.bpm.xsd.bpmcheckdbconnectivitypxs");
        return marshaller;
    }

    @Bean
    public SaajSoapMessageFactory messageFactory() {
        SaajSoapMessageFactory messageFactory = new SaajSoapMessageFactory();
        messageFactory.setSoapVersion(SoapVersion.SOAP_12);
        return messageFactory;
    }

    @Bean
    public BPMCheckDBConnectivityClient bpmCheckDBConnectivityClient(Jaxb2Marshaller marshaller) {
        BPMCheckDBConnectivityClient client = new BPMCheckDBConnectivityClient();       
        //client.setDefaultUri("");
        client.setMessageFactory(messageFactory());
        marshaller.setMtomEnabled(true);
        client.setMarshaller(marshaller);
        client.setUnmarshaller(marshaller);
        client.setMessageSender(httpComponentsMessageSender());
        return client;
    }

    @Bean
      public HttpComponentsMessageSender httpComponentsMessageSender() {
        HttpComponentsMessageSender httpComponentsMessageSender = new HttpComponentsMessageSender();
        // set the basic authorization credentials
        httpComponentsMessageSender.setCredentials(usernamePasswordCredentials());

        return httpComponentsMessageSender;
      }

      @Bean
      public UsernamePasswordCredentials usernamePasswordCredentials() {
        // pass the user name and password to be used
        return new UsernamePasswordCredentials(username, password);
      }
}
...