使用Apache Camel(使用DSL)公开HTTP-SOAP服务

时间:2017-08-08 15:39:35

标签: java soap wsdl apache-camel cxf

我正在尝试使用以下WSDL使用apache camel(我不使用spring,我正在使用DSL)公开HTTP-SOAP Web服务:

<?xml version="1.0" encoding="ISO-8859-1"?>
<wsdl:definitions xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
    xmlns:tns="http://javainuse.com" xmlns:xs="http://www.w3.org/2001/XMLSchema"
    xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
    targetNamespace="http://javainuse.com">

    <wsdl:types>
        <xs:schema targetNamespace="http://javainuse.com">
            <xs:element name="inputSOATest">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element type="xs:string" name="test" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="outputSOATest">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element type="xs:string" name="result" />
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>
    </wsdl:types>


<!--Define input and output parameters -->
    <wsdl:message name="inputSOATest">
        <wsdl:part name="in" element="tns:inputSOATest" />
    </wsdl:message>
    <wsdl:message name="outputSOATest">
        <wsdl:part name="out" element="tns:outputSOATest" />
    </wsdl:message>

<!--Define port definition -->
    <wsdl:portType name="SOATestEndpoint">
        <wsdl:operation name="SOATest">
            <wsdl:input message="tns:inputSOATest" />
            <wsdl:output message="tns:outputSOATest" />
        </wsdl:operation>
    </wsdl:portType>

<!--Bind Soap operation and service -->
    <wsdl:binding name="SOATestBinding" type="tns:SOATestEndpoint">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" />
        <wsdl:operation name="SOATest">
            <soap:operation soapAction="http://javainuse.com"
                style="document" />
            <wsdl:input>
                <soap:body parts="in" use="literal" />
            </wsdl:input>
            <wsdl:output>
                <soap:body parts="out" use="literal" />
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>

<!--Define service -->
    <wsdl:service name="SOATestEndpointService">
        <wsdl:port name="SOATestEndpoint" binding="tns:SOATestBinding">
            <soap:address location="http://localhost:8181/cxf/javainuse/learn" />
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

请您指导我如何公开接受soap xml的服务并将肥皂回复发送给客户。

请帮我一些示例代码。

0 个答案:

没有答案