From: Dave S. <sem...@nc...> - 2006-04-27 21:34:51
|
Hello, I am writing a service that has multiple operations defined in the wsdl porttype section. Both operations take an integer as input and produce a string as output. The first operation retrieves the first name associated with the given integer id and the second operation retrieves the last name associated with the id. I am using document style soap with http. I am also using ZSI python to do this stuff. I define a single input type and single output type. The input and output messages of the two operations are based on the two types and in fact share them. The wsdl file I use looks like this: <?xml version="1.0" encoding="UTF-8"?> <definitions name="Names" targetNamespace="http://www.ncsa.uiuc.edu/Names.wsdl" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://www.ncsa.uiuc.edu/Names.wsdl" xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <types> <xsd:schema elementFormDefault="qualified" targetNamespace="http://www.ncsa.uiuc.edu/Names.wsdl"> <xsd:element name="MyStringType"> <xsd:complexType> <xsd:sequence> <xsd:element name="Mystring" type="xsd:string"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="MyIntType"> <xsd:complexType> <xsd:sequence> <xsd:element name="MyInt" type="xsd:int"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema> </types> <message name="FirstRequest"> <part name="parameter" element="tns:MyIntType"/> </message> <message name="FirstResponse"> <part name="parameter" element="tns:MyStringType"/> </message> <message name="LastRequest"> <part name="parameter" element="tns:MyIntType"/> </message> <message name="LastResponse"> <part name="parameter" element="tns:MyStringType"/> </message> <portType name="Names_PortType"> <operation name="GetFirstName"> <input message="tns:FirstRequest"/> <output message="tns:FirstResponse"/> </operation> <operation name="GetLastName"> <input message="tns:LastRequest"/> <output message="tns:LastResponse"/> </operation> </portType> <binding name="Names_Binding" type="Names_PortType"> <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> <operation name="GetFirstName"> <soap:operation soapAction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> <operation name="GetLastName"> <soap:operation soapAction=""/> <input> <soap:body use="literal"/> </input> <output> <soap:body use="literal"/> </output> </operation> </binding> <service name="NamesService"> <documentation>WSDL file to describe Names services</documentation> <port binding="tns:Names_Binding" name="Names_Port" > <soap:address location="http://trecc-dev.ncsa.uiuc.edu:9900/Names"/> </port> </service> </definitions> I use wsdl2py and wsdl2dispatch to generate the appropriate python files. The problem is that the server only seems to know about one of the operations. It seems that the input type, MyIntType in this case, and the target name space are used to determine which method the server invokes. Since those items are the same for both operations only one is seen. And now to my question: Is this the way the wsdl is supposed to work? I can fix the problem above by creating another type for one of the method inputs and calling it something else. But then there would be two identical types that differ by name only. That doesnt seem logical. It seems odd that the operation names that appear in the porttype tag are not used to specify the methods. What is the logic behind that? Finally, is there a good reference for writing wsdl documents? I have been to the w3c site and read the docs there. The other material on the web just gives examples for one method ( hello world :)). I am looking for something with more elaborate examples. I am very interested in understanding this. Thanks Dave Semeraro |