SOAP Gateway exception: Server redirected too many times

Hello again:

I’m configuring the SOAP gateway for accessing to an external web service. I’ve configured the proxy settings for the host manager, the factory and the Mediator Studio (editing the .bat launchers). Using the SOAP Gateway Assistant Wizard, I put the wsdl URL and when I push the “next” button, this error occurs:

FATAL Exception connecting to URL http://xxx.xxx.xxx.xxx/entirextest/wsdl/myservice.wsdl (init WSDLAccessor)

java.net.ProtocolException: Server redirected too many times (20)

…any ideas? Thanks in advance:

Charlie.

Hello, I’m back:

I’ve found the problem, but I’m not sure it has an easy solution:

The problem is the proxy authentication. I’ve created a java class for testing the connection through the proxy, setting all the jvm options (http.proxyHost, http.proxyPort and http.nonProxyHost). Opening an external url (http://www.google.com), the same error occurs:


java.net.ProtocolException: Server redirected too many times (20)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)

I’ve solved the problem adding a password authentication:


private static final class ProxyAuth extends java.net.Authenticator {
        private PasswordAuthentication auth;

        private ProxyAuth(String user, String pass) {
            auth = new PasswordAuthentication(user, pass.toCharArray());
        }

        protected PasswordAuthentication getPasswordAuthentication() {
            return auth;
        }
    }

…and adding this line before the URL connection:


java.net.Authenticator.setDefault(new ProxyAuth("domain\\username", "password"));  

How can I force the gateway to perform this authentication?

Thanks :wink:

El Charlie.
[/code]

I’ve tried with this additional jvm options:

-Dhttp.proxyUser=“domain\username”
-Dhttp.proxyPassword=pasword

…without success :frowning: . More ideas???

Thankz 2 all.


El Charlie.

Hi Charlie,

The “good news” is that the Mediator includes a limited and partly documented implementation of the java.net.Authenticator class. If you set message properties xbd.authenticator.userid and xbd.authenticator.password appropriately, the authentication should occur. You should be able to see message in the log at DEBUG level when the Authenticator gets control.

The “bad news” is two-fold. First, this implementation is not currently in the Studio, so you would need to copy the WSDL file to a local location in order to access it. Second, The authenticator mechanism, as designed and implemented by Sun, maintains a cache and will only call the authenticator once for any network address. This means that once the JVM has authenticated with a particular server, all subsequent authentications will use the original userid/password values. This may or may not be a problem in you case, but we consider it to be a rather dangerous hole for a multi-user application like Mediator.

Hope this helps.

Hello Mike:

Thanks for replying. I’ve tried to use the sun authentication, setting the “xbd.authenticator” properties in the host manager, as default properties, but it failed again :-(.

My current configuration is:

  1. “.bat” launcher files (Host Manager, Factory, Studio, JBoss)-> added
    “-Dhttp.proxyHost” & “-Dhttp.proxyPort” & “-Dhttp.nonProxyHost”

  2. Host manager configuration:

  • “JVM Options” →
    added “-Dhttp.proxyHost” & “-Dhttp.proxyPort” & “-Dhttp.nonProxyHost”

  • “Log Level” → DEBUG

  • “Default Message Properties” → added “xbd.authenticator.userid” & “xbd.authenticator.password”

… invoking a sequence that contains a reference to an external URL (HttpGateway, SOAPGateway…), this exception occurs:

SOAPGateway:


[slf5s.start]01 ago 2005 12:04:53,156[slf5s.DATE]Thread-6[slf5s.THREAD]ERROR[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- SagSoapGateway - 1e228bc~105710e0ce4~~7ee4 - Error creating Service or Call: javax.xml.rpc.ServiceException: Error processing WSDL document:
java.net.ConnectException: Connection timed out: connect[slf5s.MESSAGE]
javax.xml.rpc.ServiceException: Error processing WSDL document:
java.net.ConnectException: Connection timed out: connect
at org.apache.axis.client.Service.initService(Service.java:239)
at org.apache.axis.client.Service.(Service.java:154)
at org.apache.axis.client.ServiceFactory.createService(ServiceFactory.java:198)
at com.softwareag.xbridge.soapgateway.SoapGatewayImpl.modify(DashOB6501:610)
at com.softwareag.xbridge.infrastructure.y.modify(DashOB6501:56)
at com.softwareag.xbridge.sequencer.KeywordSTEP.execute(DashOB6501:233)
at com.softwareag.xbridge.sequencer.SequencerImpl.execute(DashOB6501:1081)
at com.softwareag.xbridge.sequencer.SequencerImpl.dispatch(DashOB6501:753)
at com.softwareag.xbridge.infrastructure.ac.perform(DashOB6501:278)
at com.softwareag.xbridge.util.WorkerThread.run(DashOB6501:459)

HTTPGateway:

[color=“red”]
[slf5s.start]01 ago 2005 11:02:46,781[slf5s.DATE]Thread-4[slf5s.THREAD]ERROR[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- SagHttpGateway - 1e228bc~105710e0ce4~~7f18 - sendAndReceive: Cannot create http://www.google.es: Connection timed out: connect[slf5s.MESSAGE]
java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(Unknown Source)
at java.net.PlainSocketImpl.connectToAddress(Unknown Source)
at java.net.PlainSocketImpl.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at java.net.Socket.connect(Unknown Source)
at sun.net.NetworkClient.doConnect(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.openServer(Unknown Source)
at sun.net.www.http.HttpClient.(Unknown Source)
at sun.net.www.http.HttpClient.(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.http.HttpClient.New(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.plainConnect(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.connect(Unknown Source)
at com.softwareag.xbridge.gateways.HttpGatewayImpl.modify(DashOB6501:356)
at com.softwareag.xbridge.infrastructure.y.modify(DashOB6501:56)
at com.softwareag.xbridge.sequencer.KeywordSTEP.execute(DashOB6501:233)
at com.softwareag.xbridge.sequencer.SequencerImpl.execute(DashOB6501:1081)
at com.softwareag.xbridge.sequencer.SequencerImpl.dispatch(DashOB6501:753)
at com.softwareag.xbridge.infrastructure.ac.perform(DashOB6501:278)
at com.softwareag.xbridge.util.WorkerThread.run(DashOB6501:459)

[/color]

All ideas are welcome


Charlie.

Pardon…is my fault:

I didn’t reload the factory. Now, the error is different:



[slf5s.start]01 ago 2005 11:01:08,421[slf5s.DATE]Thread-6[slf5s.THREAD]DEBUG[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- SagHttpGateway - 1e228bc~105710e0ce47f22 - key: xbd.authenticator.userid[slf5s.MESSAGE]

[slf5s.start]01 ago 2005 11:01:08,421[slf5s.DATE]Thread-6[slf5s.THREAD]DEBUG[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- SagHttpGateway - 1e228bc~105710e0ce4
7f22 - key: xbd.authenticator.password[slf5s.MESSAGE]

[slf5s.start]01 ago 2005 14:39:39,609[slf5s.DATE]Thread-7[slf5s.THREAD]DEBUG[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- MessagePropertyAuthenticator entered[slf5s.MESSAGE]
[slf5s.start]01 ago 2005 14:39:39,609[slf5s.DATE]Thread-7[slf5s.THREAD]DEBUG[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- MessagePropertyAuthenticator port:8080[slf5s.MESSAGE]
[slf5s.start]01 ago 2005 14:39:39,609[slf5s.DATE]Thread-7[slf5s.THREAD]DEBUG[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- MessagePropertyAuthenticator prompt:[slf5s.MESSAGE]
[slf5s.start]01 ago 2005 14:39:39,609[slf5s.DATE]Thread-7[slf5s.THREAD]DEBUG[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- MessagePropertyAuthenticator protocol:http[slf5s.MESSAGE]
[slf5s.start]01 ago 2005 14:39:39,609[slf5s.DATE]Thread-7[slf5s.THREAD]DEBUG[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- MessagePropertyAuthenticator scheme:ntlm[slf5s.MESSAGE]
[slf5s.start]01 ago 2005 14:39:39,609[slf5s.DATE]Thread-7[slf5s.THREAD]ERROR[slf5s.PRIORITY]xbd[slf5s.CATEGORY]- SagSequencer - 1e228bc~105710e0ce4~~7e38 - SEQUENCER ERROR: sequence “http://defen2:8090/slide/users/sergas/repositorio/pruebasConexion/seq/httpSeq.xml”, line 5, : java.lang.NullPointerException[slf5s.MESSAGE]

[color=“red”]
java.lang.RuntimeException: java.lang.NullPointerException
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at com.softwareag.xbridge.gateways.HttpGatewayImpl.modify(DashOB6501:385)
at com.softwareag.xbridge.infrastructure.y.modify(DashOB6501:56)
at com.softwareag.xbridge.sequencer.KeywordSTEP.execute(DashOB6501:233)
at com.softwareag.xbridge.sequencer.SequencerImpl.execute(DashOB6501:1081)
at com.softwareag.xbridge.sequencer.SequencerImpl.dispatch(DashOB6501:743)
at com.softwareag.xbridge.infrastructure.ac.perform(DashOB6501:278)
at com.softwareag.xbridge.util.WorkerThread.run(DashOB6501:459)
Caused by: java.lang.NullPointerException
at com.softwareag.xbridge.util.MessagePropertyAuthenticator.getPasswordAuthentication(DashOB6501:69)
at java.net.Authenticator.requestPasswordAuthentication(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.privilegedRequestPasswordAuthentication(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHttpProxyAuthentication(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.resetProxyAuthentication(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
at sun.net.www.protocol.http.HttpURLConnection.getHeaderField(Unknown Source)
at java.net.URLConnection.getContentType(Unknown Source)
at com.softwareag.xbridge.gateways.HttpGatewayImpl.httpReceive(DashOB6501:499)
at com.softwareag.xbridge.gateways.HttpGatewayImpl.modify(DashOB6501:357)
… 6 more

[/color]

Any idea?

Hi Charlie,

The log indicates two issues. First, the NPE is being caused because the Authenticator cannot report the target host address. Please report this problem through normal support channels so a correction can be tracked.

The second issues is that the type of authentication is “ntlm” which makes me think that your proxy server is a windows server that requires authentication. Is that correct?

Hope this helps.

Hello Mike:

You are right about the proxy. It’s a windows proxy and needs authentication. This is the origin of all the problems.

I’ve already reported them, and I’m waiting for reply. I think the authentication problem could be in the “Proxy-Authorization” http header. I think Java encripts the user and password when it builds the http header:


Proxy-Authorization: Basic ATUYZ07678YYTYYTYTNKUY

and the proxy spects something like:


Proxy-Authorization: Basic domain\user:password

…but I’m not completely sure. I’ll continue with my investigations and keep you informed if I find the solution. Thanks 4 all:

Carlos.