You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomee.apache.org by sgjava <sg...@gmail.com> on 2015/08/03 21:23:41 UTC

JAX-WS client timeouts

In Java 6 you could use the following to set JAX-WS client timeouts:

import com.sun.xml.ws.client.BindingProviderProperties;

    /**
     * Configure port timeouts and endpoint.
     *
     * @param port Port to configure.
     * @param masIp MAS IP address.
     */
    public final void configPort(final BindingProvider port, final String
masIp) {
        // Add endpoint binding
        port.getRequestContext().put(
                BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
                String.format(getEndpoint(), masIp));
        // Add client connect timeout
        port.getRequestContext().put(
                BindingProviderProperties.CONNECT_TIMEOUT,
                getConnectTimeout());
        // Add client request timeout
        port.getRequestContext().put(
                BindingProviderProperties.REQUEST_TIMEOUT,
                getRequestTimeout());
    }

However, with TomEE 7.0 and Java 8 you are not allowed to use internal sun
classes:

import com.sun.xml.internal.ws.client.BindingProviderProperties;

Failed to execute goal
org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile)
on project masblaster: Compilation failure: Compilation failure:
com/bhn/services/masblaster/MasService.java:[10,38] package
com.sun.xml.internal.ws.client does not exist
com/bhn/services/masblaster/MasService.java:[95,17] cannot find symbol
symbol:   variable BindingProviderProperties

Should I just use the actual string values? I'm only using the following for
JEE:

        <dependency>
            <groupId>org.apache.tomee</groupId>
            <artifactId>javaee-api</artifactId>
            <version>7.0-SNAPSHOT</version>
            <scope>provided</scope>
        </dependency>



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JAX-WS client timeouts

Posted by Romain Manni-Bucau <rm...@gmail.com>.
depend your deployment and can be at startup but globally yes.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-03 22:14 GMT+02:00 sgjava <sg...@gmail.com>:

> Understood, but that still requires coding around it, correct? Your
> producer
> method would have to select bean at runtime vs. using the property
> mechanism?
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675694.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: JAX-WS client timeouts

Posted by sgjava <sg...@gmail.com>.
Understood, but that still requires coding around it, correct? Your producer
method would have to select bean at runtime vs. using the property
mechanism?



--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675694.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JAX-WS client timeouts

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Generally i extract it in @Produces (cdi) then migrating to another
container is easy.


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-03 22:09 GMT+02:00 Steve Goldsmith <sg...@gmail.com>:

> I'd like to keep this Generic in case I need to port it to another JEE
> container. Hopefully then it's just changing properties in a config :)
>
> On Mon, Aug 3, 2015 at 4:05 PM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
> > Didnt check it was reused in ws layer. Maybe just use HTTPConduit API, it
> > allows you to see when your property doesnt work anymore where the String
> > will make the app green but not working.
> >
> > Keys I was thinking about are:
> >
> > javax.xml.ws.client.receiveTimeout and
> > javax.xml.ws.client.connectionTimeout
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-08-03 22:01 GMT+02:00 Steve Goldsmith <sg...@gmail.com>:
> >
> > > Are they the same as the JAX-RS client non-proprietary?
> > >
> > >         client = ClientBuilder.newClient();
> > >         // Set timeout properties without importing CXF packages
> > >         client.property("http.connection.timeout"), 5000);
> > >         client.property("http.receive.timeout"), 5000);
> > >
> > > In the case of JAX-WS you are using BindingProvider, but under the hood
> > are
> > > the values the same (i.e. a wrapped HttpClient)?
> > >
> > >
> > > On Mon, Aug 3, 2015 at 3:54 PM, Romain Manni-Bucau <
> > rmannibucau@gmail.com>
> > > wrote:
> > >
> > > > with cxf you can set it on httpconduit in a proprietary - but sure -
> > way.
> > > > think properties were not com.sun... but javax.something
> > > >
> > > >
> > > > Romain Manni-Bucau
> > > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > > <http://rmannibucau.wordpress.com> | Github <
> > > > https://github.com/rmannibucau> |
> > > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > > <http://www.tomitribe.com>
> > > >
> > > > 2015-08-03 21:49 GMT+02:00 sgjava <sg...@gmail.com>:
> > > >
> > > > > I tried the compile flag, but it didn't work in Maven 3.3.3/Java 8.
> > Are
> > > > the
> > > > > values the same (this is from my config):
> > > > >
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> <connectionTimeoutProperty>com.sun.xml.internal.ws.connect.timeout</connectionTimeoutProperty>
> > > > >
> > > > >
> > > > >
> > > > >
> > > >
> > >
> >
> <receiveTimeoutProperty>com.sun.xml.internal.ws.request.timeout</receiveTimeoutProperty>
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > View this message in context:
> > > > >
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675687.html
> > > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > > >
> > > >
> > >
> > >
> > >
> > > --
> > > Steven P. Goldsmith
> > >
> >
>
>
>
> --
> Steven P. Goldsmith
>

Re: JAX-WS client timeouts

Posted by Steve Goldsmith <sg...@gmail.com>.
I'd like to keep this Generic in case I need to port it to another JEE
container. Hopefully then it's just changing properties in a config :)

On Mon, Aug 3, 2015 at 4:05 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> Didnt check it was reused in ws layer. Maybe just use HTTPConduit API, it
> allows you to see when your property doesnt work anymore where the String
> will make the app green but not working.
>
> Keys I was thinking about are:
>
> javax.xml.ws.client.receiveTimeout and
> javax.xml.ws.client.connectionTimeout
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-08-03 22:01 GMT+02:00 Steve Goldsmith <sg...@gmail.com>:
>
> > Are they the same as the JAX-RS client non-proprietary?
> >
> >         client = ClientBuilder.newClient();
> >         // Set timeout properties without importing CXF packages
> >         client.property("http.connection.timeout"), 5000);
> >         client.property("http.receive.timeout"), 5000);
> >
> > In the case of JAX-WS you are using BindingProvider, but under the hood
> are
> > the values the same (i.e. a wrapped HttpClient)?
> >
> >
> > On Mon, Aug 3, 2015 at 3:54 PM, Romain Manni-Bucau <
> rmannibucau@gmail.com>
> > wrote:
> >
> > > with cxf you can set it on httpconduit in a proprietary - but sure -
> way.
> > > think properties were not com.sun... but javax.something
> > >
> > >
> > > Romain Manni-Bucau
> > > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > > <http://rmannibucau.wordpress.com> | Github <
> > > https://github.com/rmannibucau> |
> > > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > > <http://www.tomitribe.com>
> > >
> > > 2015-08-03 21:49 GMT+02:00 sgjava <sg...@gmail.com>:
> > >
> > > > I tried the compile flag, but it didn't work in Maven 3.3.3/Java 8.
> Are
> > > the
> > > > values the same (this is from my config):
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> >
> <connectionTimeoutProperty>com.sun.xml.internal.ws.connect.timeout</connectionTimeoutProperty>
> > > >
> > > >
> > > >
> > > >
> > >
> >
> <receiveTimeoutProperty>com.sun.xml.internal.ws.request.timeout</receiveTimeoutProperty>
> > > >
> > > >
> > > >
> > > >
> > > > --
> > > > View this message in context:
> > > >
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675687.html
> > > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > > >
> > >
> >
> >
> >
> > --
> > Steven P. Goldsmith
> >
>



-- 
Steven P. Goldsmith

Re: JAX-WS client timeouts

Posted by Romain Manni-Bucau <rm...@gmail.com>.
Didnt check it was reused in ws layer. Maybe just use HTTPConduit API, it
allows you to see when your property doesnt work anymore where the String
will make the app green but not working.

Keys I was thinking about are:

javax.xml.ws.client.receiveTimeout and javax.xml.ws.client.connectionTimeout


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-03 22:01 GMT+02:00 Steve Goldsmith <sg...@gmail.com>:

> Are they the same as the JAX-RS client non-proprietary?
>
>         client = ClientBuilder.newClient();
>         // Set timeout properties without importing CXF packages
>         client.property("http.connection.timeout"), 5000);
>         client.property("http.receive.timeout"), 5000);
>
> In the case of JAX-WS you are using BindingProvider, but under the hood are
> the values the same (i.e. a wrapped HttpClient)?
>
>
> On Mon, Aug 3, 2015 at 3:54 PM, Romain Manni-Bucau <rm...@gmail.com>
> wrote:
>
> > with cxf you can set it on httpconduit in a proprietary - but sure - way.
> > think properties were not com.sun... but javax.something
> >
> >
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> > <http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> |
> > LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> > <http://www.tomitribe.com>
> >
> > 2015-08-03 21:49 GMT+02:00 sgjava <sg...@gmail.com>:
> >
> > > I tried the compile flag, but it didn't work in Maven 3.3.3/Java 8. Are
> > the
> > > values the same (this is from my config):
> > >
> > >
> > >
> > >
> > >
> >
> <connectionTimeoutProperty>com.sun.xml.internal.ws.connect.timeout</connectionTimeoutProperty>
> > >
> > >
> > >
> > >
> >
> <receiveTimeoutProperty>com.sun.xml.internal.ws.request.timeout</receiveTimeoutProperty>
> > >
> > >
> > >
> > >
> > > --
> > > View this message in context:
> > >
> >
> http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675687.html
> > > Sent from the TomEE Users mailing list archive at Nabble.com.
> > >
> >
>
>
>
> --
> Steven P. Goldsmith
>

Re: JAX-WS client timeouts

Posted by Steve Goldsmith <sg...@gmail.com>.
Are they the same as the JAX-RS client non-proprietary?

        client = ClientBuilder.newClient();
        // Set timeout properties without importing CXF packages
        client.property("http.connection.timeout"), 5000);
        client.property("http.receive.timeout"), 5000);

In the case of JAX-WS you are using BindingProvider, but under the hood are
the values the same (i.e. a wrapped HttpClient)?


On Mon, Aug 3, 2015 at 3:54 PM, Romain Manni-Bucau <rm...@gmail.com>
wrote:

> with cxf you can set it on httpconduit in a proprietary - but sure - way.
> think properties were not com.sun... but javax.something
>
>
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github <
> https://github.com/rmannibucau> |
> LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
>
> 2015-08-03 21:49 GMT+02:00 sgjava <sg...@gmail.com>:
>
> > I tried the compile flag, but it didn't work in Maven 3.3.3/Java 8. Are
> the
> > values the same (this is from my config):
> >
> >
> >
> >
> >
> <connectionTimeoutProperty>com.sun.xml.internal.ws.connect.timeout</connectionTimeoutProperty>
> >
> >
> >
> >
> <receiveTimeoutProperty>com.sun.xml.internal.ws.request.timeout</receiveTimeoutProperty>
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675687.html
> > Sent from the TomEE Users mailing list archive at Nabble.com.
> >
>



-- 
Steven P. Goldsmith

Re: JAX-WS client timeouts

Posted by sgjava <sg...@gmail.com>.
Does this look right?

public void testConfigureTimeout() throws Exception  
{
  //Set timeout until a connection is established
  ((BindingProvider) port).getRequestContext().
          put("javax.xml.ws.client.connectionTimeout", "6000");
  //Set timeout until the response is received      
  ((BindingProvider) port).getRequestContext().
          put("javax.xml.ws.client.receiveTimeout", "1000");
   String response = port.echo("testTimeout");
   System.out.prinltn("Received response : response"); 
}

https://developer.jboss.org/message/562353#562353







--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675691.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JAX-WS client timeouts

Posted by Romain Manni-Bucau <rm...@gmail.com>.
with cxf you can set it on httpconduit in a proprietary - but sure - way.
think properties were not com.sun... but javax.something


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-03 21:49 GMT+02:00 sgjava <sg...@gmail.com>:

> I tried the compile flag, but it didn't work in Maven 3.3.3/Java 8. Are the
> values the same (this is from my config):
>
>
>
>
> <connectionTimeoutProperty>com.sun.xml.internal.ws.connect.timeout</connectionTimeoutProperty>
>
>
>
> <receiveTimeoutProperty>com.sun.xml.internal.ws.request.timeout</receiveTimeoutProperty>
>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675687.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>

Re: JAX-WS client timeouts

Posted by sgjava <sg...@gmail.com>.
I tried the compile flag, but it didn't work in Maven 3.3.3/Java 8. Are the
values the same (this is from my config):

        
       
<connectionTimeoutProperty>com.sun.xml.internal.ws.connect.timeout</connectionTimeoutProperty>
        
       
<receiveTimeoutProperty>com.sun.xml.internal.ws.request.timeout</receiveTimeoutProperty>




--
View this message in context: http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685p4675687.html
Sent from the TomEE Users mailing list archive at Nabble.com.

Re: JAX-WS client timeouts

Posted by Romain Manni-Bucau <rm...@gmail.com>.
there is a flag to force it but yes string would work


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-08-03 21:23 GMT+02:00 sgjava <sg...@gmail.com>:

> In Java 6 you could use the following to set JAX-WS client timeouts:
>
> import com.sun.xml.ws.client.BindingProviderProperties;
>
>     /**
>      * Configure port timeouts and endpoint.
>      *
>      * @param port Port to configure.
>      * @param masIp MAS IP address.
>      */
>     public final void configPort(final BindingProvider port, final String
> masIp) {
>         // Add endpoint binding
>         port.getRequestContext().put(
>                 BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
>                 String.format(getEndpoint(), masIp));
>         // Add client connect timeout
>         port.getRequestContext().put(
>                 BindingProviderProperties.CONNECT_TIMEOUT,
>                 getConnectTimeout());
>         // Add client request timeout
>         port.getRequestContext().put(
>                 BindingProviderProperties.REQUEST_TIMEOUT,
>                 getRequestTimeout());
>     }
>
> However, with TomEE 7.0 and Java 8 you are not allowed to use internal sun
> classes:
>
> import com.sun.xml.internal.ws.client.BindingProviderProperties;
>
> Failed to execute goal
> org.apache.maven.plugins:maven-compiler-plugin:3.3:compile
> (default-compile)
> on project masblaster: Compilation failure: Compilation failure:
> com/bhn/services/masblaster/MasService.java:[10,38] package
> com.sun.xml.internal.ws.client does not exist
> com/bhn/services/masblaster/MasService.java:[95,17] cannot find symbol
> symbol:   variable BindingProviderProperties
>
> Should I just use the actual string values? I'm only using the following
> for
> JEE:
>
>         <dependency>
>             <groupId>org.apache.tomee</groupId>
>             <artifactId>javaee-api</artifactId>
>             <version>7.0-SNAPSHOT</version>
>             <scope>provided</scope>
>         </dependency>
>
>
>
> --
> View this message in context:
> http://tomee-openejb.979440.n4.nabble.com/JAX-WS-client-timeouts-tp4675685.html
> Sent from the TomEE Users mailing list archive at Nabble.com.
>