消耗肥皂服务的问题。找不到该操作的端点参考(EPR)

时间:2018-10-05 08:39:01

标签: java spring-boot soap

我正在遵循使用肥皂服务的指南:

https://spring.io/guides/gs/consuming-web-service/

这是我的肥皂wsdl

<?xml version="1.0" standalone="no"?><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:tns="http://thomas-bayer.com/blz/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:soap12="http://schemas.xmlsoap.org/wsdl/soap12/" targetNamespace="http://thomas-bayer.com/blz/">
    <wsdl:documentation>BLZService</wsdl:documentation>
    <wsdl:types>
        <xsd:schema attributeFormDefault="unqualified" elementFormDefault="qualified" targetNamespace="http://thomas-bayer.com/blz/">
            <xsd:element name="getBank" type="tns:getBankType"></xsd:element>
            <xsd:element name="getBankResponse" type="tns:getBankResponseType"></xsd:element>
            <xsd:complexType name="getBankType">
                <xsd:sequence>
                    <xsd:element name="blz" type="xsd:string"></xsd:element>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name="getBankResponseType">
                <xsd:sequence>
                    <xsd:element name="details" type="tns:detailsType"></xsd:element>
                </xsd:sequence>
            </xsd:complexType>
            <xsd:complexType name="detailsType">
                <xsd:sequence>
                    <xsd:element minOccurs="0" name="bezeichnung" type="xsd:string"></xsd:element>
                    <xsd:element minOccurs="0" name="bic" type="xsd:string"></xsd:element>
                    <xsd:element minOccurs="0" name="ort" type="xsd:string"></xsd:element>
                    <xsd:element minOccurs="0" name="plz" type="xsd:string"></xsd:element>
                </xsd:sequence>
            </xsd:complexType>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="getBank">
        <wsdl:part name="parameters" element="tns:getBank"></wsdl:part>
    </wsdl:message>
    <wsdl:message name="getBankResponse">
        <wsdl:part name="parameters" element="tns:getBankResponse"></wsdl:part>
    </wsdl:message>
    <wsdl:portType name="BLZServicePortType">
        <wsdl:operation name="getBank">
            <wsdl:input message="tns:getBank"></wsdl:input>
            <wsdl:output message="tns:getBankResponse" wsaw:Action="http://thomas-bayer.com/blz/BLZService/getBankResponse"></wsdl:output>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="BLZServiceSOAP11Binding" type="tns:BLZServicePortType">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap:binding>
        <wsdl:operation name="getBank">
            <soap:operation style="document" soapAction=""></soap:operation>
            <wsdl:input>
                <soap:body use="literal"></soap:body>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"></soap:body>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="BLZServiceSOAP12Binding" type="tns:BLZServicePortType">
        <soap12:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"></soap12:binding>
        <wsdl:operation name="getBank">
            <soap12:operation style="document" soapAction=""></soap12:operation>
            <wsdl:input>
                <soap12:body use="literal"></soap12:body>
            </wsdl:input>
            <wsdl:output>
                <soap12:body use="literal"></soap12:body>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:binding name="BLZServiceHttpBinding" type="tns:BLZServicePortType">
        <http:binding verb="POST"></http:binding>
        <wsdl:operation name="getBank">
            <http:operation location="BLZService/getBank"></http:operation>
            <wsdl:input>
                <mime:content part="getBank" type="text/xml"></mime:content>
            </wsdl:input>
            <wsdl:output>
                <mime:content part="getBank" type="text/xml"></mime:content>
            </wsdl:output>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="BLZService">
        <wsdl:port name="BLZServiceSOAP11port_http" binding="tns:BLZServiceSOAP11Binding">
            <soap:address location="http://www.thomas-bayer.com/axis2/services/BLZService"></soap:address>
        </wsdl:port>
        <wsdl:port name="BLZServiceSOAP12port_http" binding="tns:BLZServiceSOAP12Binding">
            <soap12:address location="http://www.thomas-bayer.com/axis2/services/BLZService"></soap12:address>
        </wsdl:port>
        <wsdl:port name="BLZServiceHttpport" binding="tns:BLZServiceHttpBinding">
            <http:address location="http://www.thomas-bayer.com/axis2/services/BLZService"></http:address>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

如您所见,soapAction元素为空。这将导致以下错误:

未找到的操作的端点引用(EPR)为http://www.thomas-bayer.com/axis2/services/BLZService,并且WSA操作=

这是我的SoapClient:

public class TestClient extends WebServiceGatewaySupport {

    /**
     * Makes the call, Generic Exception is understood as no authorized.
     *
     * @param endpoint
     * @param request
     * @return WebServiceIOException if connection fails.
     */
    public GetBankResponseType executeSoapClientGetUserProfile(String endpoint, GetBankType request){

        WebServiceTemplate webServiceTemplate = getWebServiceTemplate();
        try {
            return (GetBankResponseType) webServiceTemplate.marshalSendAndReceive(endpoint, request);
        } catch (Exception e) {
            logger.debug(e.getMessage());
        }
        return null;
    }
}

在soapUI中完美运行: enter image description here

可能是什么问题?

谢谢!

1 个答案:

答案 0 :(得分:0)

解决了!

问题在于生成的clase不包含@XmlRootElement批注。