AnsweredAssumed Answered

WS with Ruby

Question asked by ruizja on Feb 21, 2008
I'm working in a project for integrate Alfresco + Ruby app, but the examples in:

http://forge.alfresco.com/projects/ruby/

seems that don't work for me. This is my last barrier:


Ticket: TICKET_f994a109bdf2613bd231784aa8e80849b7846666
Wire dump:

opening connection to localhost…
opened
= Request

<?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:Header>
        <n1:Security xmlns:n1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"
            env:mustUnderstand="1">{&lt;}Timestamp xmlns=&apos;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'&gt; +
            &lt;Created&gt;2008-02-21T17:28:46Z&lt;/Created&gt; +
            &lt;Expires&gt;2008-02-21T18:28:46Z&lt;/Expires&gt;  +
          &lt;/Timestamp&gt; +
          &lt;UsernameToken&gt;  +
            &lt;Password&gt;TICKET_f994a109bdf2613bd231784aa8e80849b7846666&lt;/Password&gt; +
            &lt;Username&gt;admin&lt;/Username&gt; +
          &lt;/UsernameToken&gt;</n1:Security>
  </env:Header>
  <env:Body>
    <n2:getStores xmlns:n2="http://www.alfresco.org/ws/service/repository/1.0"></n2:getStores>
  </env:Body>
</env:Envelope>
<- "POST /alfresco/api/RepositoryService HTTP/1.1\r\nAccept: */*\r\nContent-Type: text/xml; charset=utf-8\r\nUser-Agent: SOAP4R/1.5.8\r\nSoapaction: \"http://www.alfresco.org/ws/service/repository/1.0/getStores\'\r\nContent-Length: 1050\r\nHost: localhost:8080\r\n\r\n"
<- "<?xml version=\"1.0\" encoding=\"utf-8\" ?>\n<env:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\'\n    xmlns:env=\"http://schemas.xmlsoap.org/soap/envelope/\'\n    xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\">\n  <env:Header>\n        <n1:Security xmlns:n1=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\'\n            env:mustUnderstand=\"1\">{&lt;}Timestamp xmlns=&apos;http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd'&gt; +\n            &lt;Created&gt;2008-02-21T17:28:46Z&lt;/Created&gt; +\n            &lt;Expires&gt;2008-02-21T18:28:46Z&lt;/Expires&gt;  +\n          &lt;/Timestamp&gt; +\n          &lt;UsernameToken&gt;  +\n            &lt;Password&gt;TICKET_f994a109bdf2613bd231784aa8e80849b7846666&lt;/Password&gt; +\n            &lt;Username&gt;admin&lt;/Username&gt; +\n          &lt;/UsernameToken&gt;</n1:Security>\n  </env:Header>\n  <env:Body>\n    <n2:getStores xmlns:n2=\"http://www.alfresco.org/ws/service/repository/1.0\"></n2:getStores>\n  </env:Body>\n</env:Envelope>"
-> "HTTP/1.1 500 Error Interno del Servidor\r\n"
-> "Server: Apache-Coyote/1.1\r\n"
-> "Set-Cookie: JSESSIONID=2AE543F09615CAC851026280115F8667; Path=/alfresco\r\n"
-> "Content-Type: text/xml;charset=utf-8\r\n"
-> "Transfer-Encoding: chunked\r\n"
-> "Date: Thu, 21 Feb 2008 17:28:46 GMT\r\n"
-> "Connection: close\r\n"
-> "\r\n"
-> "b24\r\n"
reading 2852 bytes&#8230;
-> "<?xml version=\"1.0\" encoding=\"utf-8\"?><soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.generalException</faultcode><faultstring>WSDoAllReceiver: security processing failed (actions number mismatch)</faultstring><detail><ns1:stackTrace xmlns:ns1=\"http://xml.apache.org/axis/\">WSDoAllReceiver: security processing failed (actions number mismatch)\r\n\tat org.apache.ws.axis.security.WSDoAllReceiver.invoke(WSDoAllReceiver.java:351)\r\n\tat org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)\r\n\tat org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:"
-> "118)\r\n\tat org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)\r\n\tat org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)\r\n\tat org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)\r\n\tat org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)\r\n\tat org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)\r\n\tat org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)\r\n\tat org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:710)\r\n\tat org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)\r\n\tat javax.servlet.http.HttpServlet.service(HttpServlet.java:803)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)\r\n\tat org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)\r\n\tat org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)\r\n\tat org.apache.catal"
-> "ina.core.StandardContextValve.invoke(StandardContextValve.java:174)\r\n\tat org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)\r\n\tat org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)\r\n\tat org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)\r\n\tat org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)\r\n\tat org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)\r\n\tat org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)\r\n\tat org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)\r\n\tat org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)\r\n\tat org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)\r\n\tat java.lang.Thread.run(Thread.java:595)\r\n</ns1:stackTrace><ns2:hostname xmlns:ns2=\"http://xml.apache.org/axis/\">jruiz8</ns2:hostname></detail>"
-> "</soapenv:Fault></soapenv:Body></soapenv:Envelope>"
read 2852 bytes
reading 2 bytes&#8230;
-> "\r\n"
read 2 bytes
-> "0\r\n"
-> "\r\n"
Conn close


= Response

<?xml version="1.0" encoding="utf-8"?><soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Body><soapenv:Fault><faultcode>soapenv:Server.generalException</faultcode><faultstring>WSDoAllReceiver: security processing failed (actions number mismatch)</faultstring><detail><ns1:stackTrace xmlns:ns1="http://xml.apache.org/axis/">WSDoAllReceiver: security processing failed (actions number mismatch)

   at org.apache.ws.axis.security.WSDoAllReceiver.invoke(WSDoAllReceiver.java:351)

   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

   at org.apache.axis.strategies.InvocationStrategy.visit(InvocationStrategy.java:32)

   at org.apache.axis.SimpleChain.doVisiting(SimpleChain.java:118)

   at org.apache.axis.SimpleChain.invoke(SimpleChain.java:83)

   at org.apache.axis.handlers.soap.SOAPService.invoke(SOAPService.java:454)

   at org.apache.axis.server.AxisServer.invoke(AxisServer.java:281)

   at org.apache.axis.transport.http.AxisServlet.doPost(AxisServlet.java:699)

   at javax.servlet.http.HttpServlet.service(HttpServlet.java:710)

   at org.apache.axis.transport.http.AxisServletBase.service(AxisServletBase.java:327)

   at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:269)

   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:188)

   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)

   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:174)

   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)

   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)

   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:108)

   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:151)

   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:870)

   at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)

   at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)

   at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)

   at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)

   at java.lang.Thread.run(Thread.java:595)

</ns1:stackTrace><ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">jruiz8</ns2:hostname></detail></soapenv:Fault></soapenv:Body></soapenv:Envelope>


#<SOAP::Mapping::Object:0x2d76228>: WSDoAllReceiver: security processing failed (actions number mismatch) (SOAP::FaultError)
   
As you can see, the SOAP header is not created properly ( &lt;Created&gt instead of <Created> ) &#8230; anybody have a idea about how solve it?

I have installed soap4r & Wss4r ok and I have modified the lines


  created = Time.now.strftime("%Y-%m-%dT%H:%M:%SZ")
  expires = (Time.now + 60*60).strftime("%Y-%m-%dT%H:%M:%SZ")

  for

  created = Time.now.utc.strftime("%Y-%m-%dT%H:%M:%SZ")
  expires = (Time.now + 0*60).utc.strftime("%Y-%m-%dT%H:%M:%SZ")

Thanks in advance,
Javier

Outcomes