How to consume from Java a Web Service made in PHP

1

I have a Web Service made in php, when I try to create a Java client to consume it, I get the following error.

I have seen on several pages that to install the missing plugin you should use this link link

But it does not work for me, I get this other error

    
asked by Sagara 24.01.2018 в 13:18
source

1 answer

0

That way, it is only used when the web service is java , what you have to do is create a class and make the call from there only validate that it responds ok .

This could be an example of the code you could use

try {
Client client = Client.create();
WebResource webResource = client.resource("http://localhost/tuUrl.php?parametro=xxx"); 

ClientResponse response = webResource.accept("").get(ClientResponse.class);

if (response.getStatus() != 200) {
 throw new RuntimeException("Fallo : Codigo HTTP error : " + response.getStatus());
}

String salida = response.getEntity(String.class);
System.out.println("\n============Plain Text Response============");
System.out.println(output2);

} catch (Exception e) {
e.printStackTrace();
}
    
answered by 02.02.2018 / 17:21
source