1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@9170 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
(no author) 2005-09-15 14:47:07 +00:00
parent b8bc87839d
commit caf6ad3a76
29 changed files with 2953 additions and 0 deletions

View file

@ -0,0 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<wsdl:definitions xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:s="http://www.w3.org/2001/XMLSchema"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:tns="http://localhost/WebService/"
xmlns:tm="http://microsoft.com/wsdl/mime/textMatching/"
xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/"
targetNamespace="http://localhost/WebService/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
<wsdl:types>
<s:schema elementFormDefault="qualified"
targetNamespace="http://localhost/WebService/">
<s:element name="HelloWorld">
<s:complexType />
</s:element>
<s:element name="HelloWorldResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="HelloWorldResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SayHello">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1" name="name"
type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
<s:element name="SayHelloResponse">
<s:complexType>
<s:sequence>
<s:element minOccurs="0" maxOccurs="1"
name="SayHelloResult" type="s:string" />
</s:sequence>
</s:complexType>
</s:element>
</s:schema>
</wsdl:types>
<wsdl:message name="HelloWorldSoapIn">
<wsdl:part name="parameters" element="tns:HelloWorld" />
</wsdl:message>
<wsdl:message name="HelloWorldSoapOut">
<wsdl:part name="parameters" element="tns:HelloWorldResponse" />
</wsdl:message>
<wsdl:message name="SayHelloSoapIn">
<wsdl:part name="parameters" element="tns:SayHello" />
</wsdl:message>
<wsdl:message name="SayHelloSoapOut">
<wsdl:part name="parameters" element="tns:SayHelloResponse" />
</wsdl:message>
<wsdl:portType name="Service1Soap">
<wsdl:operation name="HelloWorld">
<wsdl:input message="tns:HelloWorldSoapIn" />
<wsdl:output message="tns:HelloWorldSoapOut" />
</wsdl:operation>
<wsdl:operation name="SayHello">
<wsdl:input message="tns:SayHelloSoapIn" />
<wsdl:output message="tns:SayHelloSoapOut" />
</wsdl:operation>
</wsdl:portType>
<wsdl:binding name="Service1Soap" type="tns:Service1Soap">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"
style="document" />
<wsdl:operation name="HelloWorld">
<soap:operation
soapAction="http://localhost/WebService/HelloWorld" style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
<wsdl:operation name="SayHello">
<soap:operation soapAction="http://localhost/WebService/SayHello"
style="document" />
<wsdl:input>
<soap:body use="literal" />
</wsdl:input>
<wsdl:output>
<soap:body use="literal" />
</wsdl:output>
</wsdl:operation>
</wsdl:binding>
<wsdl:service name="Service1">
<documentation xmlns="http://schemas.xmlsoap.org/wsdl/" />
<wsdl:port name="Service1Soap" binding="tns:Service1Soap">
<soap:address
location="http://localhost/WebService/Service1.asmx" />
</wsdl:port>
</wsdl:service>
</wsdl:definitions>

View file

@ -0,0 +1,111 @@
require 'test/unit'
require 'soap/rpc/standaloneServer'
require 'soap/rpc/driver'
module SOAP; module ASPDotNet
class TestASPDotNet < Test::Unit::TestCase
class Server < ::SOAP::RPC::StandaloneServer
Namespace = "http://localhost/WebService/"
def on_init
add_document_method(
self,
Namespace + 'SayHello',
'sayHello',
XSD::QName.new(Namespace, 'SayHello'),
XSD::QName.new(Namespace, 'SayHelloResponse')
)
end
def sayHello(arg)
name = arg['name']
"Hello #{name}"
end
end
Port = 17171
Endpoint = "http://localhost:#{Port}/"
def setup
setup_server
@client = nil
end
def teardown
teardown_server
@client.reset_stream if @client
end
def setup_server
@server = Server.new('Test', Server::Namespace, '0.0.0.0', Port)
@server.level = Logger::Severity::ERROR
@server_thread = start_server_thread(@server)
end
def teardown_server
@server.shutdown
@server_thread.kill
@server_thread.join
end
def start_server_thread(server)
t = Thread.new {
Thread.current.abort_on_exception = true
server.start
}
t
end
def test_document_method
@client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
@client.wiredump_dev = STDOUT if $DEBUG
@client.add_document_method('sayHello', Server::Namespace + 'SayHello',
XSD::QName.new(Server::Namespace, 'SayHello'),
XSD::QName.new(Server::Namespace, 'SayHelloResponse'))
assert_equal("Hello Mike", @client.sayHello(:name => "Mike"))
end
def test_aspdotnethandler
@client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
@client.wiredump_dev = STDOUT if $DEBUG
@client.add_method_with_soapaction('sayHello', Server::Namespace + 'SayHello', 'name')
@client.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
assert_equal("Hello Mike", @client.sayHello("Mike"))
end
if defined?(HTTPAccess2)
# qualified!
REQUEST_ASPDOTNETHANDLER =
%q[<?xml version="1.0" encoding="utf-8" ?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<env:Body>
<n1:sayHello xmlns:n1="http://localhost/WebService/">
<n1:name>Mike</n1:name>
</n1:sayHello>
</env:Body>
</env:Envelope>]
def test_aspdotnethandler_envelope
@client = SOAP::RPC::Driver.new(Endpoint, Server::Namespace)
@client.wiredump_dev = str = ''
@client.add_method_with_soapaction('sayHello', Server::Namespace + 'SayHello', 'name')
@client.default_encodingstyle = SOAP::EncodingStyle::ASPDotNetHandler::Namespace
assert_equal("Hello Mike", @client.sayHello("Mike"))
assert_equal(REQUEST_ASPDOTNETHANDLER, parse_requestxml(str))
end
def parse_requestxml(str)
str.split(/\r?\n\r?\n/)[3]
end
end
end
end; end