私はmonowcfを初めて使用しますが、コードに関していくつかの問題が発生しました。最近、私はruby-savonを使用して、monoのwcfホストからデータを取得しています。
これは私のルビーコードです:
client = Savon::Client.new do
wsdl.document="http://localhost:9000/MonoWcf/MonoSevice/wsdl"
end
puts client.wsdl.soap_actions
response = client.request :get_data
そしてこれはこれを置きます:
ruby -KU -- '/home/charlot/Documents/Aptana Studio 3 Workspace/rubyfun/soap/savon.rb'
W, [2012-12-21T02:45:41.845966 #10527] WARN -- : HTTPI executes HTTP GET using the httpclient adapter
get_data
get_data_using_data_contract
D, [2012-12-21T02:45:41.856091 #10527] DEBUG -- : SOAP request: http://localhost:9000/MonoWcf/MonoSevice/soap
D, [2012-12-21T02:45:41.856294 #10527] DEBUG -- : SOAPAction: "http://localhost:9000/IMonoService/GetData", Content-Type: text/xml;charset=UTF-8, Content-Length: 293
D, [2012-12-21T02:45:41.856329 #10527] DEBUG -- : <?xml version="1.0" encoding="UTF-8"?>
<env:Envelope xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:wsdl="http://tempuri.org/" xmlns:env="http://schemas.xmlsoap.org/soap/envelope/">
<env:Body><GetData>
</GetData>
</env:Body>
</env:Envelope>
W, [2012-12-21T02:45:41.856403 #10527] WARN -- : HTTPI executes HTTP POST using the httpclient adapter
D, [2012-12-21T02:45:41.873963 #10527] DEBUG -- : SOAP response (status 415):
D, [2012-12-21T02:45:41.874057 #10527] DEBUG -- :
/usr/local/lib/ruby/gems/1.9.1/gems/savon-1.2.0/lib/savon/soap/response.rb:108:in `raise_errors': Savon::HTTP::Error
from /usr/local/lib/ruby/gems/1.9.1/gems/savon-1.2.0/lib/savon/soap/response.rb:18:in `initialize'
from /usr/local/lib/ruby/gems/1.9.1/gems/savon-1.2.0/lib/savon/soap/request.rb:35:in `new'
from /usr/local/lib/ruby/gems/1.9.1/gems/savon-1.2.0/lib/savon/soap/request.rb:35:in `response'
from /usr/local/lib/ruby/gems/1.9.1/gems/savon-1.2.0/lib/savon/client.rb:86:in `request'
from /home/charlot/Documents/Aptana Studio 3 Workspace/rubyfun/soap/savon.rb:15:in `dosoap'
from /home/charlot/Documents/Aptana Studio 3 Workspace/rubyfun/soap/savon.rb:23:in `<main>'
****
これはmono-wcfwsdlです:
** `
<import location="http://localhost:9000/MonoWcf/MonoSevice/wsdl?wsdl=wsdl0" namespace="http://localhost:9000"/>
<types/>
<binding name="BasicHttpBinding_IMonoService" type="i0:IMonoService">
<soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="GetData">
<soap:operation soapAction="http://localhost:9000/IMonoService/GetData" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
<operation name="GetDataUsingDataContract">
<soap:operation soapAction="http://localhost:9000/IMonoService/GetDataUsingDataContract" style="document"/>
<input>
<soap:body use="literal"/>
</input>
<output>
<soap:body use="literal"/>
</output>
</operation>
</binding>
<service name="service">
<port name="BasicHttpBinding_IMonoService" binding="tns:BasicHttpBinding_IMonoService">
<soap:address location="http://localhost:9000/MonoWcf/MonoSevice/soap"/>
</port>
</service>
`**しかし、windows(7)でwcfをホストすると、実際にデータが取得されます。
私のOSは:ubuntu 12モノラルバージョン:
Mono JIT compiler version 2.10.8.1 (Debian 2.10.8.1-1ubuntu2.2)
Copyright (C) 2002-2011 Novell, Inc, Xamarin, Inc and Contributors. www.mono-project.com
TLS: __thread
SIGSEGV: altstack
Notifications: epoll
Architecture: x86
Disabled: none
Misc: softdebug
LLVM: supported, not enabled.
GC: Included Boehm (with typed GC and Parallel Mark)
本当にありがとう!