0
votes

Im following this guide to consuming a soap service:

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

This is my soap 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>

As you can see the element soapAction is empty. This causes the following error:

The endpoint reference (EPR) for the Operation not found is http://www.thomas-bayer.com/axis2/services/BLZService and the WSA Action =

Here is my 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;
    }
}

In soapUI works perfectly: enter image description here

What could be the problem??

Thanks!!

1

1 Answers

0
votes

Solved!!

The problem was that the generated clases didnt contain the @XmlRootElement annotation.