Java 使用ApacheCamel和SpringBoot调用SOAP web服务

Java 使用ApacheCamel和SpringBoot调用SOAP web服务,java,spring-boot,apache-camel,Java,Spring Boot,Apache Camel,我是新来的阿帕奇骆驼。目前,我正在尝试实现一个用例,在这个用例中,我需要使用SpringBoot和ApacheCamel来使用远程SOAP Web服务 问题- 可以从Spring Boot和Apache Camel集成中调用吗 在此过程中应使用哪些必需的依赖项 阿维纳什你可以。 首先,您需要获取web服务的xsd,并在resources/ws文件夹中创建.xsd文件 <xsd:schema targetNamespace="http://xx.com/xx" xmlns

我是新来的阿帕奇骆驼。目前,我正在尝试实现一个用例,在这个用例中,我需要使用SpringBoot和ApacheCamel来使用远程SOAP Web服务

问题-

  • 可以从Spring Boot和Apache Camel集成中调用吗
  • 在此过程中应使用哪些必需的依赖项
  • 阿维纳什

    你可以。 首先,您需要获取web服务的xsd,并在resources/ws文件夹中创建.xsd文件

    <xsd:schema targetNamespace="http://xx.com/xx" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://xx.com/xx">
    <xsd:element name="MT_INPUT_REQUEST" type="DT_INPUT_REQUEST"/>
    <xsd:complexType name="DT_INPUT_REQUEST">
        <xsd:annotation>
            <xsd:documentation xml:lang="EN">Key Account Order Header</xsd:documentation>
        </xsd:annotation>
        <xsd:sequence>
            <xsd:element name="x" type="xsd:string" minOccurs="0"/>
            <xsd:element name="y" type="xsd:string" minOccurs="0"/>
            <xsd:element name="ds" type="xsd:string" minOccurs="0"/>
            <xsd:element name="da" type="xsd:string" minOccurs="0"/>
            <xsd:element name="da" type="xsd:string" minOccurs="0"/>
            <xsd:element name="ddas" type="xsd:string" minOccurs="0"/>
            <xsd:element name="das" type="xsd:string" minOccurs="0"/>
            <xsd:element name="dsa" type="xsd:string" minOccurs="0"/>
            <xsd:element name="dasd" minOccurs="0" maxOccurs="unbounded">
                <xsd:complexType>
                    <xsd:sequence>
                        <xsd:element name="da" type="xsd:string" minOccurs="0"/>
                        <xsd:element name="dsa" type="xsd:string" minOccurs="0"/>
                        <xsd:element name="das" type="xsd:string" minOccurs="0"/>
                        <xsd:element name="da" type="xsd:string" minOccurs="0"/>
                        <xsd:element name="da" type="xsd:string" minOccurs="0"/>
                        <xsd:element name="das" type="xsd:string" minOccurs="0"/>
                    </xsd:sequence>
                </xsd:complexType>
            </xsd:element>
        </xsd:sequence>
    </xsd:complexType></xsd:schema>
    
    在此之后,您必须创建一个引用的XSD类,并在最终调用后放入正文

    .marshal(jaxbDataformat)
    to("spring-ws:http://soapservice/bar")
    
    public JaxbDataFormat marshaller() throws JAXBException {
        JaxbDataFormat jaxbDataFormat = new JaxbDataFormat(JAXBContext.newInstance("xx.com"));
        jaxbDataFormat.setEncoding("ISO-8859-9");
        jaxbDataFormat.setFilterNonXmlChars(true);
        return jaxbDataFormat;
    }
    
    .marshal(jaxbDataformat)
    to("spring-ws:http://soapservice/bar")