From: <bov...@us...> - 2008-10-15 19:52:25
|
Revision: 1469 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1469&view=rev Author: boverhof Date: 2008-10-15 19:52:19 +0000 (Wed, 15 Oct 2008) Log Message: ----------- M wsdl2py/config.txt A wsdl2py/test_NoMessagePart.py A wsdl2py/wsdl/NoMessagePart.wsdl AM wsdl2py/servers/NoMessagePartServer.py unittest for [ 1803439 ] ZSI.generate.Wsdl2PythonError: must specify part for doc/lit Modified Paths: -------------- trunk/zsi/test/wsdl2py/config.txt Added Paths: ----------- trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py trunk/zsi/test/wsdl2py/test_NoMessagePart.py trunk/zsi/test/wsdl2py/wsdl/NoMessagePart.wsdl Modified: trunk/zsi/test/wsdl2py/config.txt =================================================================== --- trunk/zsi/test/wsdl2py/config.txt 2008-05-24 01:55:33 UTC (rev 1468) +++ trunk/zsi/test/wsdl2py/config.txt 2008-10-15 19:52:19 UTC (rev 1469) @@ -38,8 +38,8 @@ test_DateService = servers/DateService.py test_FinancialService = servers/FinancialService.py test_EchoWSAddr200403 = servers/EchoWSAddr200403Server.py +test_NoMessagePart = servers/NoMessagePartServer.py - ########################################################################## # URL SECTIONS: All SOAP-1.1 # document -- document style True/False @@ -119,7 +119,7 @@ document = True literal = True broke = False -tests = test_MapPoint test_Echo test_AWSECommerceService test_FinancialService test_BasicComm test_Manufacturer test_Racing test_Attributes test_Choice test_DerivedTypes test_EchoWSAddr200403 test_SubstitutionGroup test_VIM test_Unqualified +tests = test_MapPoint test_Echo test_AWSECommerceService test_FinancialService test_BasicComm test_Manufacturer test_Racing test_Attributes test_Choice test_DerivedTypes test_EchoWSAddr200403 test_SubstitutionGroup test_VIM test_Unqualified test_NoMessagePart [doc_literal_broke] document = True @@ -184,3 +184,5 @@ test_NVOAdmin = wsdl/nvo-admin.wsdl test_Clearspace = http://eval.jivesoftware.com/clearspace/rpc/soap/BlogService?wsdl test_VIM = wsdl/vim.wsdl + +test_NoMessagePart = wsdl/NoMessagePart.wsdl Added: trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py =================================================================== --- trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py (rev 0) +++ trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py 2008-10-15 19:52:19 UTC (rev 1469) @@ -0,0 +1,45 @@ +#!/usr/bin/env python +############################################################################ +# Joshua R. Boverhof, LBNL +# See LBNLCopyright for copyright notice! +########################################################################### +import sys +from ZSI import ServiceContainer, Fault +from ZSI.ServiceContainer import AsServer, ServiceSOAPBinding +from NoMessagePartServer_server import NoMessagePartServer + +class Service(NoMessagePartServer): + def soap_Hello(self, ps, **kw): + request,response = NoMessagePartServer.soap_Hello(self, ps, **kw) + + if request is not None: + raise RuntimeException, "REQUEST SHOULD BE NONE" + response.Result = "XXX" + return request,response + + +def twisted_main(port): + from twisted.internet import reactor + from twisted.application import service, internet + from twisted.web.resource import Resource + from twisted.web.server import Site + + root = Resource() + root.putChild('test', Service()) + reactor.listenTCP(port, Site(root)) + +def main(): + port = int(sys.argv[1]) + if issubclass(NoMessagePartServer, ServiceSOAPBinding): + AsServer(port, (Service('test'),)) + return + + #from ZSI.twisted.WSresource import WSResource + #if issubclass(NoMessagePartServer, WSResource): + from twisted.internet import reactor + reactor.callWhenRunning(twisted_main, port) + reactor.run() + + +if __name__ == "__main__" : + main() Property changes on: trunk/zsi/test/wsdl2py/servers/NoMessagePartServer.py ___________________________________________________________________ Added: svn:executable + * Added: trunk/zsi/test/wsdl2py/test_NoMessagePart.py =================================================================== --- trunk/zsi/test/wsdl2py/test_NoMessagePart.py (rev 0) +++ trunk/zsi/test/wsdl2py/test_NoMessagePart.py 2008-10-15 19:52:19 UTC (rev 1469) @@ -0,0 +1,105 @@ +#!/usr/bin/env python +############################################################################ +# Joshua R. Boverhof, LBNL +# See LBNLCopyright for copyright notice! +########################################################################### +import os, sys, unittest +from ServiceTest import main, ServiceTestCase, ServiceTestSuite +from ZSI import FaultException, SoapWriter, ParsedSoap +""" +Unittest + +[ 1803439 ] ZSI.generate.Wsdl2PythonError: must specify part for doc/lit + +Date: 2008-10-15 18:42 +Sender: boverhof +Here is the offending entity: + + <wsdl:message name="HelloRequest"/> + +From +http://www.ws-i.org/Profiles/BasicProfile-1.0-2004-04-16.html#WSDLMSGS + + Use of wsdl:message elements with zero parts is permitted in +Document styles to permit operations that can send or receive messages with +empty soap:Bodys. + +Basically what needs to be done here is an empty <soap:Body> is sent... + +Now only ONE operation should be able to specify an message w/o a part ( +for doc/lit ), because the wire representation of each operation MUST be +unique. + +WSDL: wsdl/NoMessagePart.wsdl +""" + +# General targets +def dispatch(): + """Run all dispatch tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(NoMessagePartTestCase, 'test_dispatch')) + return suite + +def local(): + """Run all local tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(NoMessagePartTestCase, 'test_local')) + return suite + +def net(): + """Run all network tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(NoMessagePartTestCase, 'test_net')) + return suite + +def all(): + """Run all tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(NoMessagePartTestCase, 'test_')) + return suite + + +class NoMessagePartTestCase(ServiceTestCase): + name = "test_NoMessagePart" + client_file_name = "NoMessagePartServer_client.py" + types_file_name = "NoMessagePartServer_types.py" + server_file_name = "NoMessagePartServer_server.py" + + def __init__(self, methodName): + ServiceTestCase.__init__(self, methodName) + self.wsdl2py_args.append('-b') + + def test_local_NoMessagePart(self): + ## msg = self.client_module.HelloRequest() + msg = None + rsp = self.client_module.HelloResponse() + + # Core functionality required + s = SoapWriter() + xml = str(s) + + print xml + + # Core functionality required + ps = ParsedSoap(xml) + + self.failUnless(ps.body.childNodes == 0, "Empty Body expected: " + ps.body.childNodes) + self.failUnless(ps.body_root == None, "Body root should be None: " + ps.body_root) + + pyobj = ps.Parse(None) + + self.failUnless(pyobj == None, "pyobj should be None: " + pyobj) + + + def test_dispatch_NoMessagePart(self): + loc = self.client_module.NoMessagePartServerLocator() + port = loc.getHelloServerSOAP11port_http(**self.getPortKWArgs()) + + ## NOTE: Should take no argument + rsp = port.Hello() + self.failUnless(rsp.Return == "XXX", "TODO") + + +if __name__ == "__main__" : + main() + Added: trunk/zsi/test/wsdl2py/wsdl/NoMessagePart.wsdl =================================================================== --- trunk/zsi/test/wsdl2py/wsdl/NoMessagePart.wsdl (rev 0) +++ trunk/zsi/test/wsdl2py/wsdl/NoMessagePart.wsdl 2008-10-15 19:52:19 UTC (rev 1469) @@ -0,0 +1,123 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:ns1="http://org.apache.axis2/xsd" xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:ns0="http://helloserv.utbm.fr" xmlns:xs="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://helloserv.utbm.fr"> + <wsdl:documentation>HelloServer</wsdl:documentation> + <wsdl:types> + <xs:schema xmlns:ns="http://helloserv.utbm.fr" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://helloserv.utbm.fr"> + <xs:element name="HelloResponse"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="HelloYou"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="name" nillable="true" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + <xs:element name="HelloYouResponse"> + <xs:complexType> + <xs:sequence> + <xs:element minOccurs="0" name="return" nillable="true" type="xs:string"/> + </xs:sequence> + </xs:complexType> + </xs:element> + </xs:schema> + </wsdl:types> + <wsdl:message name="HelloRequest"/> + <wsdl:message name="HelloResponse"> + <wsdl:part name="parameters" element="ns0:HelloResponse"/> + </wsdl:message> + <wsdl:message name="HelloYouRequest"> + <wsdl:part name="parameters" element="ns0:HelloYou"/> + </wsdl:message> + <wsdl:message name="HelloYouResponse"> + <wsdl:part name="parameters" element="ns0:HelloYouResponse"/> + </wsdl:message> + <wsdl:portType name="HelloServerPortType"> + <wsdl:operation name="Hello"> + <wsdl:input message="ns0:HelloRequest" wsaw:Action="urn:Hello"/> + <wsdl:output message="ns0:HelloResponse" wsaw:Action="urn:HelloResponse"/> + </wsdl:operation> + <wsdl:operation name="HelloYou"> + <wsdl:input message="ns0:HelloYouRequest" wsaw:Action="urn:HelloYou"/> + <wsdl:output message="ns0:HelloYouResponse" wsaw:Action="urn:HelloYouResponse"/> + </wsdl:operation> + </wsdl:portType> + <wsdl:binding name="HelloServerSOAP11Binding" type="ns0:HelloServerPortType"> + <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> + <wsdl:operation name="Hello"> + <soap:operation soapAction="urn:Hello" style="document"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="HelloYou"> + <soap:operation soapAction="urn:HelloYou" style="document"/> + <wsdl:input> + <soap:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:binding name="HelloServerSOAP12Binding" type="ns0:HelloServerPortType"> + <soap12:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/> + <wsdl:operation name="Hello"> + <soap12:operation soapAction="urn:Hello" style="document"/> + <wsdl:input> + <soap12:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap12:body use="literal"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="HelloYou"> + <soap12:operation soapAction="urn:HelloYou" style="document"/> + <wsdl:input> + <soap12:body use="literal"/> + </wsdl:input> + <wsdl:output> + <soap12:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:binding name="HelloServerHttpBinding" type="ns0:HelloServerPortType"> + <http:binding verb="POST"/> + <wsdl:operation name="Hello"> + <http:operation location="HelloServer/Hello"/> + <wsdl:input> + <mime:content type="text/xml" part="Hello"/> + </wsdl:input> + <wsdl:output> + <mime:content type="text/xml" part="Hello"/> + </wsdl:output> + </wsdl:operation> + <wsdl:operation name="HelloYou"> + <http:operation location="HelloServer/HelloYou"/> + <wsdl:input> + <mime:content type="text/xml" part="HelloYou"/> + </wsdl:input> + <wsdl:output> + <mime:content type="text/xml" part="HelloYou"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="NoMessagePartServer"> + <wsdl:port name="HelloServerSOAP11port_http" binding="ns0:HelloServerSOAP11Binding"> + <soap:address location="http://localhost:8080/axis2/services/HelloServer"/> + </wsdl:port> + <wsdl:port name="HelloServerSOAP12port_http" binding="ns0:HelloServerSOAP12Binding"> + <soap12:address location="http://localhost:8080/axis2/services/HelloServer"/> + </wsdl:port> + <wsdl:port name="HelloServerHttpport" binding="ns0:HelloServerHttpBinding"> + <http:address location="http://localhost:8080/axis2/services/HelloServer"/> + </wsdl:port> + </wsdl:service> +</wsdl:definitions> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |