Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTPS Endpoints #34

Open
anavarrd opened this issue Mar 18, 2015 · 5 comments
Open

HTTPS Endpoints #34

anavarrd opened this issue Mar 18, 2015 · 5 comments

Comments

@anavarrd
Copy link

Hello,

I am using your jar to create dinamic ws client in java. You have done a good job with this .jar
All was going good until I have to connect with https endpoint.

This is my example code:


String wsdl="https://des-gesat.redsara.es/ws/catalog/services/call/carpetaciudadana?wsdl";
String bindingName = "WS_Services_CarpetaciudadanaBinding";
String operationName = "consultaExpedientes";
String endpointUrl="https://des-gesat.redsara.es/ws/catalog/services/call/carpetaciudadana";
String request="soapenv:Envelope... my request ....</soapenv:Envelope>";
int timeout=1000;
// WSDL
final Wsdl wsdl = Wsdl.parse(wsdl);

// CLIENT
final SoapBuilder soapBuilder = wsdl.binding().localPart(bindingName).find();
final SoapOperation operation = soapBuilder.operation().name(operationName).find();
final Builder builder = SoapClient.builder();
builder.connectTimeoutInMillis(timeout);
URI endpointURI = new URI(endpointUrl);
builder.endpointUri(endpointURI);
final SoapClient client = builder.build();
// RESPONSE
final String response = client.post(operation.getSoapAction(), request);


In this case, at line
final SoapClient client = builder.build() throws this exception:
java.lang.IllegalArgumentException: Port is invalid: -1

If I use the following endpoint url it works but the server dont listen prorperly to the url.
endpointUrl="https://des-gesat.redsara.es:443/ws/catalog/services/call/carpetaciudadana";

How can I use https endpoint without including the port in the url?

Thank you so much. Im looking forward your answer.

@cfalzone
Copy link

Ever figure this out? I am having the same issue. Full stack trace:

2015-07-14 13:18:02,502 ERROR com.aquent.osgi.AquentActivator - Exception testing web service client
java.lang.IllegalArgumentException: Port is invalid
    at org.apache.http.util.Args.check(Args.java:36)
    at org.apache.http.conn.scheme.Scheme.<init>(Scheme.java:91)
    at org.reficio.ws.client.core.SoapClient.registerTlsScheme(SoapClient.java:249)
    at org.reficio.ws.client.core.SoapClient.configureTls(SoapClient.java:237)
    at org.reficio.ws.client.core.SoapClient.initialize(SoapClient.java:192)
    at org.reficio.ws.client.core.SoapClient.access$900(SoapClient.java:72)
    at org.reficio.ws.client.core.SoapClient$Builder.initializeClient(SoapClient.java:407)
    at org.reficio.ws.client.core.SoapClient$Builder.build(SoapClient.java:385)
    at com.aquent.osgi.AquentActivator.start(AquentActivator.java:75)
    at com.dotcms.repackage.org.apache.felix.framework.util.SecureAction.startActivator(SecureAction.java:645)
    at com.dotcms.repackage.org.apache.felix.framework.Felix.activateBundle(Felix.java:2146)
    at com.dotcms.repackage.org.apache.felix.framework.Felix.startBundle(Felix.java:2064)
    at com.dotcms.repackage.org.apache.felix.framework.BundleImpl.start(BundleImpl.java:955)
    at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1175)
    at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:1153)
    at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:458)
    at com.dotcms.repackage.org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:263)

@bashoogzaad
Copy link

Same issue here! Would be great if somebody could post a workaround or fix...

@bashoogzaad
Copy link

UPDATE: When I add a port to the URI passed in the builder, I get the following exception:

Uncaught exception from servlet
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.kiba.api.cif.GetBarcode.performGet(GetBarcode.java:87)
    at org.kiba.api.support.APIPage.doGet(APIPage.java:74)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
    at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511)
    at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1166)
    at com.google.apphosting.utils.servlet.ParseBlobUploadFilter.doFilter(ParseBlobUploadFilter.java:125)

Can you check if this is also the case in your situation? Then I can determine if it is the server's fault.

@cfalzone
Copy link

Well, for me, the fix was just to add port 443 to the url, though I know in some, or maybe most, cases that won't work as in the OP's and your cases. I think a workaround, if you wanted to internalize the code until a fix is made is to hardcode the port here:

and/or here

What happens is the port ends up being null in those cases.

Or perhaps a check here if port is null than set port to 443 or something?

Scheme sch = new Scheme(HTTPS, port, factory);

@bashoogzaad
Copy link

I just set the URI port like it is done here: http://stackoverflow.com/questions/6490014/modifying-the-port-of-a-uri . So it should find 443 and I think it does. So hardcoding is not the solution here. Could it be that the SOAP Server doesn't allow connections on this port (which would be very weird)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants