reficio / soap-ws

Java library, based on Spring-WS, that enables handling SOAP on a purely XML level
297 stars 145 forks source link

HTTP response=[Internal Server Error] code=[500] #35

Closed DanylS closed 9 years ago

DanylS commented 9 years ago

Hi Tom,

First of all, thank you very much for your soap-ws library. I meet an issue when I try to use "Consume a Web-Serivce in 60 seconds" from your User Guide.

I got this error : "Exception in thread "main" org.reficio.ws.client.TransmissionException: HTTP response=[Internal Server Error] code=[500] at org.reficio.ws.client.core.SoapClient.executePost(SoapClient.java:171) at org.reficio.ws.client.core.SoapClient.transmit(SoapClient.java:161) at org.reficio.ws.client.core.SoapClient.post(SoapClient.java:116) at org.reficio.ws.client.core.SoapClient.post(SoapClient.java:103) at newWsTest.wsTest.main(wsTest.java:37)"

Why ?

Here you have my code with Eclipse :


package newWsTest;

import org.reficio.ws.builder.SoapBuilder; import org.reficio.ws.builder.SoapOperation; import org.reficio.ws.builder.core.Wsdl; import org.reficio.ws.client.core.SoapClient;

public class wsTest { public static void main(String[] args) { Wsdl wsdl = Wsdl.parse("http://cpwebtst:8184/cpwebservice/wslogin.asmx?WSDL"); SoapBuilder builder = wsdl.binding().localPart("WSLoginSoap").find(); System.out.println("a"); SoapOperation operation = builder.operation().soapAction("http://compuware.com/changepoint/CPWebService/WSLogin/GetVersion").find(); System.out.println("b"); String request = builder.buildInputMessage(operation); System.out.println("c"); SoapClient client = SoapClient.builder().endpointUri("http://cpwebtst:8184/cpwebservice/wslogin.asmx").build(); System.out.println("d"); //String request2 = "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:wsl=\"http://compuware.com/changepoint/CPWebService/WSLogin\">soapenv:Header/soapenv:Bodywsl:GetVersion//soapenv:Body/soapenv:Envelope"; String response = client.post(request); System.out.println("e"); System.out.println(response); } }


Like you can see if you test the code with eclipse, the println display "a", "b", "c", "d" but not "e", so I think that my issue deal with the "client.post(request)" or "SoapClient.builder().endpointUri().build();".

I don't understand where is the problem. Can you help me to fix this issue please Tom ? Thanks

Regards, Dan

DanylS commented 9 years ago

EDIT : I just find the solution, it was very easy : at the "String response =", client.post take 2 arguments ! The operation link AND the request, not only the request.

Like that : At the String response = client.post("http://compuware.com/changepoint/CPWebService/WSLogin/TestConnection", request);

Have a good day