Created
June 11, 2014 19:08
-
-
Save juankiz123/6fd2a41ae70ccbae8436 to your computer and use it in GitHub Desktop.
Envio de objetos por webservice
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
registroFactory.testing =function ($scope){ | |
var cad = ""; | |
cad = $sessionStorage['JSESSION']; | |
var response={}; | |
var datos={}; | |
var empresa={ | |
'@id':1, | |
idEmpresa:3, | |
ruc:"1077884561"}; | |
var empresita={'@id':2,idEmpresa:9, | |
ruc:"1077884222"}; | |
var pais={'@id':3,idPais:3, | |
nombre:"Eslovaquia"}; | |
datos['empresa']= empresa; | |
datos['empresita'] = empresita; | |
datos['pais'] = pais; | |
response.observacion = "LOL"; | |
response.result = false; | |
response.data = datos; | |
console.log(response); | |
$http({ | |
method : 'POST', | |
url : '/api/public/test', | |
data : response | |
}) | |
.success(function(status) { | |
if(status==200){ | |
console.log('me llegoooo'); | |
} | |
}); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package edu.pe.pm.ilcb.sga.rest.objects; | |
import java.util.Map; | |
import javax.persistence.Column; | |
import javax.persistence.Entity; | |
import javax.persistence.Table; | |
import com.fasterxml.jackson.annotation.JsonIdentityInfo; | |
import com.fasterxml.jackson.annotation.ObjectIdGenerators; | |
@JsonIdentityInfo(generator=ObjectIdGenerators.IntSequenceGenerator.class, property="@id") | |
@Entity | |
@Table | |
public class RestDataResponse { | |
private String observacion; | |
private Boolean result; | |
private Map<String,Object> data; | |
public RestDataResponse(){ | |
} | |
public RestDataResponse(String observacion, boolean result ) { | |
this.observacion = observacion; | |
this.result = result; | |
} | |
@Column | |
public String getObservacion() { | |
return observacion; | |
} | |
public void setObservacion(String observacion) { | |
this.observacion = observacion; | |
} | |
@Column | |
public Boolean getResult() { | |
return result; | |
} | |
public void setResult(Boolean result) { | |
this.result = result; | |
} | |
@Column | |
public Map<String, Object> getData() { | |
return data; | |
} | |
public void setData(Map<String, Object> data) { | |
this.data = data; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@RequestMapping( headers = "Content-Type=application/json",value="/test", method=RequestMethod.POST) | |
@ResponseStatus(value = HttpStatus.OK) | |
public @ResponseBody RestMessageResponse testCesar(@RequestBody RestDataResponse data){ | |
System.out.println(data.getData()); | |
return new RestMessageResponse("Enter"); | |
} |
czegarram
commented
Jun 11, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment