Здравствуйте, я пытаюсь использовать остальные веб-службы из приложения jee в asp.net, когда я копирую URL, он работает отлично, но когда я извлекаю его из приложения, URL изменяет конкретно даты.
Пример erorr:
22: 03: 32,629 WARN [org.jboss.resteasy.core.ExceptionHandler] (задание по умолчанию-69) не удалось выполнить: javax.ws.rs.NotFoundException: не удалось найти ресурс для полного пути: http://localhost:18080/PiDev-web/rest/absence/creates/aaaqwqwq/07/11/2018%2000:00:00/07/11/2018%2000:00:00
[приложение JEE]
вот мой сервис:
@Override
public void createAbsence(Absence e) {
EmployeService ee =new EmployeService();
ConnectedUser emp = em.find(ConnectedUser.class, 1);
System.out.println("Service Done 0 !!!");
e.setIdEmploye(emp.getId());
e.setLogin(emp.getLogin());
e.setJustifie(false);
//e.setEmploye(UserConnected);
em.persist(e);
System.out.println("Service Done !!!");
}
и myBean:
@POST
@Path("/creates/{cause}/{dd}/{df}")
@Produces(MediaType.APPLICATION_JSON)
@Consumes(MediaType.APPLICATION_JSON)
public Response serviceCreates(@PathParam(value = "cause") String cause,@PathParam(value = "dd") String dd,@PathParam(value = "df") String df) {
DateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date dated=new Date();
Date datef=new Date();
try {
dated = dateFormat.parse(dd);
datef = dateFormat.parse(df);
System.out.println(dated);
} catch (ParseException e) {
e.printStackTrace();
}
return Response.status(Status.ACCEPTED).entity(absenceService.createAbsence(new Absence(cause,dated,datef))).build();
}
[Приложение Asp.Net] Контроллер:
[HttpPost]
public ActionResult Create(absence abs)
{
try
{
HttpClient Client = new System.Net.Http.HttpClient();
Console.WriteLine(abs.dateDebut);
Client.BaseAddress = new Uri("http://localhost:18080/PiDev-web/rest/absence/");
Client.PostAsJsonAsync<absence>("creates/" + abs.cause + "/" + abs.dateDebut + "/" + abs.dateFin, abs);
return RedirectToAction("Index");
}
catch
{
return View();
}
}
и мой взгляд:
@{
ViewBag.Title = "Home Page";
Layout = "~/Views/Shared/backLayout.cshtml";
}
@model ProjectWeb.Models.absence
@using (Html.BeginForm())
{
@Html.AntiForgeryToken()
<div class="form-horizontal">
<h4>Add Absence</h4>
<hr />
@Html.ValidationSummary(true, "", new { @class = "text-danger" })
<div class="form-group">
@Html.LabelFor(model => model.cause, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.cause, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.cause, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.dateDebut, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.dateDebut, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.dateDebut, "", new { @class = "text-danger" })
</div>
</div>
<div class="form-group">
@Html.LabelFor(model => model.dateFin, htmlAttributes: new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.dateFin, new { htmlAttributes = new { @class = "form-control" } })
@Html.ValidationMessageFor(model => model.dateFin, "", new { @class = "t-danger" })
</div>
</div>
<div class="form-group">
<div class="col-md-offset-2 col-md-10">
<input type="submit" value="Create" class="btn btn-default" />
</div>
</div>
</div>
}
<div>
@Html.ActionLink("Back to List", "Index")
</div>
Я не знаком с форматами даты, поэтому еслиВы знакомы, пожалуйста, помогите мне