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. |
From: <lcl...@us...> - 2009-03-31 22:10:21
|
Revision: 1484 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1484&view=rev Author: lclement Date: 2009-03-31 22:10:10 +0000 (Tue, 31 Mar 2009) Log Message: ----------- Some preliminary unit test for the Attachment implementation. Modified Paths: -------------- trunk/zsi/test/wsdl2py/config.txt Added Paths: ----------- trunk/zsi/test/wsdl2py/test_Attachment.py trunk/zsi/test/wsdl2py/wsdl/test_Attachment.wsdl Modified: trunk/zsi/test/wsdl2py/config.txt =================================================================== --- trunk/zsi/test/wsdl2py/config.txt 2009-03-31 18:27:55 UTC (rev 1483) +++ trunk/zsi/test/wsdl2py/config.txt 2009-03-31 22:10:10 UTC (rev 1484) @@ -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 test_NoMessagePart +tests = test_Attachment 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 @@ -186,3 +186,6 @@ test_VIM = wsdl/vim.wsdl test_NoMessagePart = wsdl/NoMessagePart.wsdl + +test_Attachment = wsdl/test_Attachment.wsdl + Added: trunk/zsi/test/wsdl2py/test_Attachment.py =================================================================== --- trunk/zsi/test/wsdl2py/test_Attachment.py (rev 0) +++ trunk/zsi/test/wsdl2py/test_Attachment.py 2009-03-31 22:10:10 UTC (rev 1484) @@ -0,0 +1,70 @@ +#!/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, ParsedSoap, SoapWriter + +""" +Unittest + +WSDL: +""" + +# General targets +def dispatch(): + """Run all dispatch tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(TestCase, 'test_dispatch')) + return suite + +def local(): + """Run all local tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(TestCase, 'test_local')) + return suite + +def net(): + """Run all network tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(TestCase, 'test_net')) + return suite + +def all(): + """Run all tests""" + suite = ServiceTestSuite() + suite.addTest(unittest.makeSuite(TestCase, 'test_')) + return suite + + +class TestCase(ServiceTestCase): + name = "test_Attachment" + client_file_name = "TestService_client.py" + types_file_name = "TestService_types.py" + server_file_name = "TestService_server.py" + + def __init__(self, methodName): + ServiceTestCase.__init__(self, methodName) + self.wsdl2py_args.append('-b') + + def test_local_generateMessageAttachment(self): + """doc/lit, generating a message using MIME attachment, + we don't have the server side implementation so we can + really do a full test yet + """ + from TestService_server import uploadFileRequest + #stubs were properly generated + request = uploadFileRequest() + request._name = "TestService_client.py" + request._attachment = open("stubs/TestService_client.py", 'r') + sw = SoapWriter({}, header=True, outputclass=None, encodingStyle=None) + sw.serialize(request) + print "the request message is: " + str(sw) + #there is not server side, so for the moment we just create the message and print it on screen + #TODO add server side implmementation + + +if __name__ == "__main__" : + main() Added: trunk/zsi/test/wsdl2py/wsdl/test_Attachment.wsdl =================================================================== --- trunk/zsi/test/wsdl2py/wsdl/test_Attachment.wsdl (rev 0) +++ trunk/zsi/test/wsdl2py/wsdl/test_Attachment.wsdl 2009-03-31 22:10:10 UTC (rev 1484) @@ -0,0 +1,60 @@ +<?xml version="1.0" encoding="UTF-8"?> +<wsdl:definitions targetNamespace="http://nbcr.sdsc.edu/opal" + xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://nbcr.sdsc.edu/opal" + xmlns:intf="http://nbcr.sdsc.edu/opal" xmlns:tns1="http://nbcr.sdsc.edu/opal/types" + xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" + xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" + xmlns:xsd="http://www.w3.org/2001/XMLSchema"> + + <wsdl:types> + <schema targetNamespace="http://nbcr.sdsc.edu/opal/types" xmlns="http://www.w3.org/2001/XMLSchema"> + <import namespace="http://xml.apache.org/xml-soap"/> + + + <complexType name="InputFileType"> + <sequence> + <element name="name" type="xsd:string"/> + <element maxOccurs="1" minOccurs="0" name="attachment" type="apachesoap:DataHandler"/> + </sequence> + </complexType> + + + <element name="uploadFileInput" type="tns1:InputFileType"/> + <element name="uploadFileOutput" type="xsd:string"/> + + </schema> + </wsdl:types> + <wsdl:message name="uploadFileRequest"> + <wsdl:part element="tns1:uploadFileInput" name="uploadFileInput"/> + </wsdl:message> + + <wsdl:message name="uploadFileResponse"> + <wsdl:part element="tns1:uploadFileOutput" name="uploadFileOutput"/> + </wsdl:message> + + <wsdl:portType name="TestServicePortType"> + <wsdl:operation name="uploadFile" parameterOrder="uploadFileInput"> + <wsdl:input message="impl:uploadFileRequest" name="uploadFileRequest"/> + <wsdl:output message="impl:uploadFileResponse" name="uploadFileResponse"/> + </wsdl:operation> + </wsdl:portType> + + <wsdl:binding name="TestServicePortSoapBinding" type="impl:TestServicePortType"> + <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/> + <wsdl:operation name="uploadFile"> + <wsdlsoap:operation soapAction="http://nbcr.sdsc.edu/opal/uploadFile"/> + <wsdl:input name="uploadFileRequest"> + <wsdlsoap:body use="literal"/> + </wsdl:input> + <wsdl:output name="uploadFileResponse"> + <wsdlsoap:body use="literal"/> + </wsdl:output> + </wsdl:operation> + </wsdl:binding> + <wsdl:service name="TestService"> + <wsdl:port binding="impl:TestServicePortSoapBinding" name="TestServicePort"> + <wsdlsoap:address location="http://localhost:8080/opal2/services/CAT"/> + </wsdl:port> + </wsdl:service> + +</wsdl:definitions> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <lcl...@us...> - 2009-04-02 01:08:12
|
Revision: 1485 http://pywebsvcs.svn.sourceforge.net/pywebsvcs/?rev=1485&view=rev Author: lclement Date: 2009-04-02 01:08:10 +0000 (Thu, 02 Apr 2009) Log Message: ----------- Fixed a couple of tests Modified Paths: -------------- trunk/zsi/test/wsdl2py/config.txt trunk/zsi/test/wsdl2py/test_AWSECommerceService.py trunk/zsi/test/wsdl2py/test_ThreatService.py Modified: trunk/zsi/test/wsdl2py/config.txt =================================================================== --- trunk/zsi/test/wsdl2py/config.txt 2009-03-31 22:10:10 UTC (rev 1484) +++ trunk/zsi/test/wsdl2py/config.txt 2009-04-02 01:08:10 UTC (rev 1485) @@ -75,7 +75,9 @@ document = False literal = False broke = False -tests = test_XMethodsQuery test_ThreatService +tests = test_ThreatService +#XMethods web site is broken wsdl can not be retreived +#tests = test_XMethodsQuery test_ThreatService [rpc_encoded_broke] document = False Modified: trunk/zsi/test/wsdl2py/test_AWSECommerceService.py =================================================================== --- trunk/zsi/test/wsdl2py/test_AWSECommerceService.py 2009-03-31 22:10:10 UTC (rev 1484) +++ trunk/zsi/test/wsdl2py/test_AWSECommerceService.py 2009-04-02 01:08:10 UTC (rev 1485) @@ -42,8 +42,10 @@ return suite -TargetNamespace = 'http://webservices.amazon.com/AWSECommerceService/2007-10-29' +#TargetNamespace = 'http://webservices.amazon.com/AWSECommerceService/2007-10-29' +TargetNamespace = 'http://webservices.amazon.com/AWSECommerceService/2009-02-01' + class AmazonTestCase(ServiceTestCase): """Test case for Amazon ECommerce Web service """ @@ -117,12 +119,12 @@ response.OperationRequest.Arguments for i in response.OperationRequest.Arguments.Argument: - i.get_attribute_Name() - i.get_attribute_Value() - - for i in response.OperationRequest.HTTPHeaders.Header or []: - i.get_attribute_Name() - i.get_attribute_Value() + i.get_attribute_Name() + i.get_attribute_Value() + if response.OperationRequest.HTTPHeaders: + for i in response.OperationRequest.HTTPHeaders.Header or []: + i.get_attribute_Name() + i.get_attribute_Value() response.OperationRequest.RequestId response.OperationRequest.RequestProcessingTime Modified: trunk/zsi/test/wsdl2py/test_ThreatService.py =================================================================== --- trunk/zsi/test/wsdl2py/test_ThreatService.py 2009-03-31 22:10:10 UTC (rev 1484) +++ trunk/zsi/test/wsdl2py/test_ThreatService.py 2009-04-02 01:08:10 UTC (rev 1485) @@ -59,8 +59,8 @@ msg = self.client_module.threatLevelRequest() rsp = port.threatLevel(msg) for item in rsp.ThreatLevelReturn.Item: - item.Key - item.Value + item['key'] + item['value'] This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |