Hello guys,

I have created an API to process a PUT request and a GET request. The  
GET works perfectly fine, but with the PUT the XML seems to be lost in  
its way. I have the following code:

  def dispatch: LiftRules.DispatchPF = {
         case Req("api" :: "person" :: userName :: Nil, "",  
GetRequest) =>
             () => showPerson(userName)

       case r @ Req(List("api", "person"), "", PutRequest) =>
             () => addPerson(r)
     }

In the addPerson method I have the following code:

req.xml match {
             case Full(<person>{parameters @_*}</person>) => {
                     for(parameter <- parameters){ parameter match {

                        All the XML parsing....

                         }
                     }

                     try {
                         person.validate match {
                             case Nil =>
                                 person.save
                                 CreatedResponse(wrapXmlBody 
(<operation id="addPerson" success="true"></operation>), "text/xml")
                             case _ =>
                                 CreatedResponse(wrapXmlBody 
(<operation id="addPerson" success="false"></operation>), "text/xml")
                         }
                     }
                     catch {
                         case e => Log.error("Could not add person",  
e); BadResponse()
                     }
                 }
             case _ => Log.error("Request was malformed "+req.view);  
BadResponse()
         }

The method always goes through the last case: "Request was malformed".

I was checking the values to req.view and req.xml.toString and the  
results are "person" and empty, respectively.

Any ideas about what it could be happening?

Thanks in advance,

GA


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Lift" group.
To post to this group, send email to liftweb@googlegroups.com
To unsubscribe from this group, send email to 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to