I am attempting to test the web services added during chapter 20 of the Agile book. The code as written in the book yields 2 errors: test_find_product_by_id(BackendControllerApiTest): XMLParserError: syntax error Anyone hit this yet and get it to work? Thanks. Ken _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 8/24/05, Ken Barker <ken.barker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am attempting to test the web services added during chapter 20 of the > Agile book. The code as written in the book yields 2 errors: > > > test_find_product_by_id(BackendControllerApiTest): > XMLParserError: syntax error > Anyone hit this yet and get it to work?Hi Ken, I can''t reproduce that (I''m running the test here locally). Could you provide the full stack trace printed out? Thanks Leon
On 8/24/05, leon breedt <bitserf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I can''t reproduce that (I''m running the test here locally). Could you > provide the full stack trace printed out? >Leon, thanks for taking a look. I have diffed my source files against the source pulled down from the pragprog site and everything is the same. Rails is 0.13.1 from the gem. I do you SQL Server for the database and would hope that that would not be a problem. Running on Win 2000 Pro. Ken W:\depot_final>ruby test/functional/backend_api_test.rb Loaded suite test/functional/backend_api_test Started EE Finished in 5.137 seconds. 1) Error: test_find_all_products(BackendControllerApiTest): XMLParserError: syntax error c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:31:in `parse'' c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:31:in `do_parse'' c:/ruby/lib/ruby/1.8/soap/parser.rb:90:in `parse'' c:/ruby/lib/ruby/1.8/soap/processor.rb:39:in `unmarshal'' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.8.1/lib/action_web_service/protocol/soap_protocol.rb:75:in `decode_response'' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.8.1/lib/action_web_service/test_invoke.rb:58:in `decode_rpc_response'' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.8.1/lib/action_web_service/test_invoke.rb:11:in `invoke'' test/functional/backend_api_test.rb:16:in `test_find_all_products'' 2) Error: test_find_product_by_id(BackendControllerApiTest): XMLParserError: syntax error c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:31:in `parse'' c:/ruby/lib/ruby/1.8/xsd/xmlparser/xmlparser.rb:31:in `do_parse'' c:/ruby/lib/ruby/1.8/soap/parser.rb:90:in `parse'' c:/ruby/lib/ruby/1.8/soap/processor.rb:39:in `unmarshal'' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.8.1/lib/action_web_service/protocol/soap_protocol.rb:75:in `decode_response'' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.8.1/lib/action_web_service/test_invoke.rb:58:in `decode_rpc_response'' c:/ruby/lib/ruby/gems/1.8/gems/actionwebservice-0.8.1/lib/action_web_service/test_invoke.rb:11:in `invoke'' test/functional/backend_api_test.rb:21:in `test_find_product_by_id'' 2 tests, 0 assertions, 0 failures, 2 errors _______________________________________________ Rails mailing list Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails
On 8/25/05, Ken Barker <ken.barker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Leon, thanks for taking a look. I have diffed my source files against the > source pulled down from the pragprog site and everything is the same. Rails > is 0.13.1 from the gem. I do you SQL Server for the database and would hope > that that would not be a problem. Running on Win 2000 Pro.Do you mind supplying me with the output of running "ruby -v" from the Command Prompt? It needs to be at least: 1.8.2 (2004-12-25) That is, the final release version of Ruby 1.8.2. If your version is the same, it would be really instructive if you could add this line to the very start of the "decode_rpc_response" method in actionwebservice-0.8.1/lib/action_web_service/test_invoke.rb: $stderr.puts "RESPONSE: ''#{@response.body}''" And let me know what the response was. Regards Leon
On 8/24/05, leon breedt <bitserf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Do you mind supplying me with the output of running "ruby -v" from the > Command Prompt?ruby 1.8.2 (2004-12-25) [i386-mswin32]> If your version is the same, it would be really instructive if you > could add this line to the very start of the "decode_rpc_response" > method in actionwebservice-0.8.1/lib/action_web_service/test_invoke.rb: > > $stderr.puts "RESPONSE: ''#{@response.body}''" > > And let me know what the response was.RESPONSE: ''Internal protocol error: not well-formed (invalid token)
On 8/25/05, Ken Barker <ken.barker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> RESPONSE: ''Internal protocol error: not well-formed (invalid token)Hmm, this is really interesting, looks like the request is somehow becoming invalid. Could you add: $stderr.puts "REQUEST: ''#{@request.env[''RAW_POST_DATA'']}''" To the very end of the "prepare_request" method in the same file? Thanks! Leon
On 8/24/05, leon breedt <bitserf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Could you add: > > $stderr.puts "REQUEST: ''#{@request.env[''RAW_POST_DATA'']}''" > > To the very end of the "prepare_request" method in the same file?<?xml version="1.0" encoding="us-ascii" ?> <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:FindProductById xmlns:n1="#<BackendController:0x3797e38>" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <param0 xsi:type="xsd:int">2</param0> </n1:FindProductById> </env:Body> </env:Envelope> and <?xml version="1.0" encoding="us-ascii" ?> <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:FindAllProducts xmlns:n1="#<BackendController:0x37b59d0>" env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> </n1:FindAllProducts> </env:Body> </env:Envelope>
On 8/25/05, Ken Barker <ken.barker-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> <?xml version="1.0" encoding="us-ascii" ?> > <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:FindProductById xmlns:n1="#<BackendController:0x3797e38>" > env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> > <param0 xsi:type="xsd:int">2</param0> > </n1:FindProductById> > </env:Body> > </env:Envelope>Aha! You''ve discovered a bug in the test helpers. That namespace declaration for n1 is invalid XML and wrong anyway (you are not allowed to have < in an attribute value). What happens when you change the second line of the "protocol" method to call "SoapProtocol.create" instead of "SoapProtocol.new" ? I suspect that should fix it. Thanks! Leon
On 8/24/05, leon breedt <bitserf-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> What happens when you change the second line of the "protocol" method > to call "SoapProtocol.create" instead of "SoapProtocol.new" ? > > I suspect that should fix it.And it does!!! Thanks Leon. F Finished in 3.836 seconds. 1) Failure: test_find_product_by_id(BackendControllerApiTe est.rb:22]: <"Product 2"> expected but was <"How to automate your project">. 2 tests, 2 assertions, 1 failures, 0 errors
Reasonably Related Threads
- Error with Web Service tests after upgrading to Rails 1.1.2
- Strange error when testing layered web service
- Arrays of objects as parameters to webservices
- Trouble connecting to a Rails SOAP web service with a simple Ruby client
- soap4r 1.5.5 seems to break actionWebService tests