Как установить соединение с WSDL в приложении SpringBoot? - PullRequest
0 голосов
/ 04 февраля 2019

Я новичок в WSDL.У меня есть WSDL, и мне нужно установить соединение с конечной точкой с помощью приложения springBoot и проверить его работоспособность.

В моем Java-классе SoapClientConfig мне нужно установить contextPath и Uri по умолчанию.Учитывая данный WSDL, я не уверен, каким будет мой contextPath и Uri по умолчанию.В WSDL я вижу следующий тег для определения местоположения адреса. Я не уверен, как использовать этот адрес в моем приложении Springboot для подключения к API, предоставляемому тем же WSDL

       <wsdl:service name="PayServices">
             <wsdl:port name="BasicHttpBinding_PayServices" 
             binding="tns:BasicHttpBinding_PayServices">
            <soap:address 
         location="https://test.testfw.ws/ts/gpcs/grsv/routerservice.svc"/>
           </wsdl:port>
     </wsdl:service>

Один из APIрезультат операции

<wsdl:operation name="PaymentOutcome">
            <soap:operation 

       soapAction="http://hide.net/services/atms/PayServices/PaymentOutcome" style="document"/>
        <wsdl:input>
        <soap:body use="literal"/>
        <soap:header message="tns:PayServices_RouterAddressing" part="ADDRESSING" use="literal"/>
        <soap:header message="tns:PayServices_RouterSecurity" part="SECURITY" use="literal"/>
        <soap:header message="tns:PayServices_Security" part="Security" use="literal"/>
     </wsdl:input>
     <wsdl:output>
        <soap:body use="literal"/>
     </wsdl:output>
     <wsdl:fault name="SecurityFault">
        <soap:fault name="SecurityFault" use="literal"/>
     </wsdl:fault>
     <wsdl:fault name="RouterFault">
        <soap:fault name="RouterFault" use="literal"/>
     </wsdl:fault>
  </wsdl:operation>     

Java-код для подключения клиента SOap:

      @Configuration
      public class SoapClientConfig {
    @Bean
    public Jaxb2Marshaller marshaller() {
        Jaxb2Marshaller marshaller = new Jaxb2Marshaller();
        // this package must match the package in the <generatePackage> specified in
        // pom.xml
        marshaller.setContextPath("");
        return marshaller;
    }

    @Bean
    public PaymentOutcomeClient paymentOutcomeClient(Jaxb2Marshaller marshaller) {
        PaymentOutcomeClient client = new PaymentOutcomeClient();
        client.setDefaultUri("http://localhost:8080");
        client.setMarshaller(marshaller);
        client.setUnmarshaller(marshaller);
        return client;
    }

}

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...