Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deploying wash-out on Phusion Passenger server #15

Closed
arrk-shoba opened this issue Mar 20, 2012 · 10 comments
Closed

Deploying wash-out on Phusion Passenger server #15

arrk-shoba opened this issue Mar 20, 2012 · 10 comments

Comments

@arrk-shoba
Copy link

Hi

Thanks a lot for fixing #10, 11 and 12.

I had a query. When I start the rails server, I am able to access the wsdl along with the rest of the application. However, when I start the Phusion Passenger, I am unable to access the wsdl, although rest of my application is working. Is there any specific environment variable I need to set?

@inossidabile
Copy link
Owner

Not really. It should just work. I can't see any reason for that to not work with passenger. WashOut is a pure ruby and clean Rails code without monkey patching. I need more info :)

@inossidabile
Copy link
Owner

Do you have any progress? Give more info I'll try to help.

@arrk-shoba
Copy link
Author

Hi,
Sorry, was busy with the testing. I could test on Passenger (although there was some issue with the XML parsing...fixed that today.)
However I am still facing an issue.

NoMethodError
in UnionWsController#_action
undefined method struct?' for #<Array:0xd66d638> nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:86:inblock (2 levels) in _render_soap'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:in each' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:ineach_with_index'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:in block in _render_soap' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:89:incall'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:89:in block (3 levels) in _render_soap' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:89:inmap'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:89:in block (2 levels) in _render_soap' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:ineach'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:in each_with_index' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:inblock in _render_soap'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:87:in call' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:87:inblock (2 levels) in _render_soap'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:in each' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:ineach_with_index'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:in block in _render_soap' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:87:incall'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:87:in block (2 levels) in _render_soap' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:ineach'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:in each_with_index' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:85:inblock in _render_soap'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:100:in call' nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out/dispatcher.rb:100:in_render_soap'
nested_form/ruby/1.9.1/bundler/gems/wash_out-05936cf2a2ca/lib/wash_out.rb:20:in `block in <top (required)>'

There is some issue with the rendering...I find it weird as at times the same piece of code is running well.

@inossidabile
Copy link
Owner

It doesn't look like a problem of passenger. Can you give me the dump of request you sent to it?

@arrk-shoba
Copy link
Author

Yes, I agree. Now the problem is not with Passenger. However, I do not understand why the dispatcher throws the error at times. It is not the case that I face this error for every request. Some are successful, others fail although internally the record is saved, output generated and when it has to create the soap response, it fails.


SOAP Request:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:WashOut">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:upload_student soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
         <import_student_request xsi:type="urn:import_student_request">
            <students xsi:type="urn:students">
               <student xsi:type="urn:student">
                  <id xsi:type="xsd:string">U31001</id>
                  <forename xsi:type="xsd:string">Shoba</forename>
                  <surname xsi:type="xsd:string">Menon</surname>
                  <dob xsi:type="xsd:string">07-08-1990</dob>
                  <gender xsi:type="xsd:string">F</gender>
                  <institution_email xsi:type="xsd:string">shoba.menon@arrkgroup.com</institution_email>
                  <nationality xsi:type="xsd:string"/>
                  <domicile_country xsi:type="xsd:string">IND</domicile_country>
                  <fee_status xsi:type="xsd:string">IN</fee_status>
                  <hall_of_residence xsi:type="xsd:string">HA001</hall_of_residence>
                  <programme_id xsi:type="xsd:string">P1002</programme_id>
                  <study_type xsi:type="xsd:string">PG</study_type>
                  <year_of_study xsi:type="xsd:string">1</year_of_study>
                  <start_date xsi:type="xsd:string">02-02-2012</start_date>
                  <end_date xsi:type="xsd:string">02-02-2013</end_date>
                  <record_type xsi:type="xsd:string">New</record_type>
               </student>
            </students>
         </import_student_request>
      </urn:upload_student>
   </soapenv:Body>
</soapenv:Envelope>

Controller code:

soap_action "upload_student",
              :args   => {:import_student_request => { :students => { :student => [{:id => :string, :forename => :string,  :surname => :string, 
                        :dob => :string,  :gender => :string, :institution_email => :string, 
                        :nationality => :string,  :domicile_country => :string,         
                        :fee_status => :string,  :hall_of_residence => :string,   
                        :programme_id => :string, :study_type => :string,  :year_of_study => :string,
                        :start_date => :string, :end_date => :string, :record_type => :string } ] } }},
              :return => { :"import-student-response" => { :students => { :student => [{ :id => :string, :status => :string }] } }}
  def upload_student


    puts "--------------------------"
    puts "In upload_student...."

    request_obj = params[:import_student_request][:students]
    @student = Student.new

    response_hash = @student.save_student_for_ws(request_obj, @union)
    # response_hash contains student id as key and the status values (which can be Success/Failed - if Failed with reasons)

    stud_status_array = Array.new(response_hash.length)
    idx = 0

    response_hash.each do |student_id, status| 
      puts "Student id-->"+student_id.to_s
      puts "Status-->"+status         
      stud_status_array[idx] = Hash.new
      stud_status_array[idx][:"id"] = student_id.to_s
      stud_status_array[idx][:"status"] = status
      idx +=1;
    end

    output = { :"import-student-response"  => 
      {:students => 
        {:student =>  stud_status_array       
        }
      }
    }
    puts "---- Output of upload_student ==>"+output.to_s

    render :soap => output 

  end

Output of upload_student ==>{:"import-student-response"=>{:students=>{:student=>[{:id=>"U1001", :status=>"Success"}]}}}

@inossidabile
Copy link
Owner

I can't reproduce that. It just works for me with the structure that shows up at yours Output of upload student. Are you sure it fails while trying to respond with this one? I need the exact structure it fails with.

@arrk-shoba
Copy link
Author

Even I could not reproduce the issue on my machine. It happens almost 50% times on one of the test machines; hence I wished to drill down to the cause. However I could not yet trace the cause. Thanks a lot. I do not see any point in keeping this issue open as I tried on other machines where it worked!

inossidabile pushed a commit that referenced this issue Mar 27, 2012
…tures (#15, #19). I hope this is the last time we fix dispatcher response lambda 😱
@inossidabile
Copy link
Owner

Good news. I've managed to reproduce that. Looks fixed. Try the new 0.3.5 version.

@arrk-shoba
Copy link
Author

It seems to be fixed as I didn't see the error again on the testing machine where I had found the error before. Thanks again!

btw, how did you reproduce it? I couldn't do it on my machine.

@inossidabile
Copy link
Owner

I've played with concurrency and thread-safety a bit. And it failed miserably 😱 That's why it was so floating. Now it's ok :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants