Service-side Code Generation Error

May 17, 2010 at 9:43 PM

I'm having this error when trying to generate the service-side code.

Cannot import wsdl:binding
Detail: The WSDL binding named HelloBinding is not valid because no match for operation sayHello was found in the corresponding portType definition.
XPath to Error Source: //wsdl:definitions[@

targetNamespace='http://hello']/wsdl:binding[@name='HelloBinding']
---------------------------------------------------------------------------------
Cannot import wsdl:port
Detail: There was an error importing a wsdl:binding that the wsdl:port is dependent on.
XPath to wsdl:binding: //wsdl:definitions[@targetNamespace='http://hello']/wsdl:binding[@name='HelloBinding']
XPath to Error Source: //wsdl:definitions[@targetNamespace='http://hello']/wsdl:service[@name='HelloService']/wsdl:port[@name='HelloPort']
---------------------------------------------------------------------------------
I'm using this wsdl:
<?xml version="1.0" encoding="UTF-8"?>

<definitions name="Hello"
             targetNamespace="http://hello"
             xmlns:tns="http://hello"
             xmlns="http://schemas.xmlsoap.org/wsdl/"
             xmlns:xsd="http://www.w3.org/2001/XMLSchema"
             xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/">

    <types>
        <xsd:schema elementFormDefault="qualified"
                    targetNamespace="http://hello">

            <xsd:complexType name="SayHelloType">
                <xsd:sequence>
                    <xsd:element name="name" type="xsd:string" />
                </xsd:sequence>
            </xsd:complexType>
            <xsd:element name="sayHello" type="tns:SayHelloType" />

            <xsd:complexType name="SayHelloResponseType">
                <xsd:sequence>
                    <xsd:element name="return" type="xsd:string" />
                </xsd:sequence>
            </xsd:complexType>
            <xsd:element name="sayHelloResponse" type="tns:SayHelloResponseType" />

        </xsd:schema>
    </types>


    
    <message name="sayHello">
        <part name="parameters" element="tns:sayHello" />
    </message>
    <message name="sayHelloResponse">
        <part name="result" element="tns:sayHelloResponse" />
    </message>


    
    <portType name="HelloPortType">
        <operation name="sayHello">
            <input message="tns:sayHello" name="sayHello"/>
            <output message="tns:sayHelloResponse" name="sayHelloResponse"/>
        </operation>
    </portType>


   
    <binding name="HelloBinding" type="tns:HelloPortType">
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" />
        <operation name="sayHello">
            <soap:operation soapAction="" />
            <input>
                <soap:body use="literal" />
            </input>
            <output>
                <soap:body use="literal" />
            </output>
        </operation>
    </binding>


    
    <service name="HelloService">
        <port name="HelloPort" binding="tns:HelloBinding">
            <soap:address location="http://localhost:8080/ExemploHelloWS/endpoint" />
        </port>
    </service>


</definitions>


Any help? Thanks!
Developer
May 18, 2010 at 2:19 PM
Edited May 18, 2010 at 2:45 PM
Hi there, The portType and binding are not being mapped correctly. You can fix two different ways. 1. Remove the name attribute from your input and output element in the portType. <portType name="HelloPortType"> <operation name="sayHello"> <input message="tns:sayHello"/> <output message="tns:sayHelloResponse"/> </operation> </portType> 2. Specify the name attribute in the input and output elements in the binding. <binding name="HelloBinding" type="tns:HelloPortType"> <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document" /> <operation name="sayHello"> <soap:operation soapAction="" /> <input name="sayHello"> <soap:body use="literal" /> </input> <output name="sayHelloResponse"> <soap:body use="literal" /> </output> </operation> </binding> It is usually easiest to not provide the names so I would tend towards using the first option. Cheers, Alex.