1

I am working in cisco CVP environment. I have created a client in Netbeans for GRC webservices. I am using that jar file inside of my code. First I was getting a problem that when I run that jar on the machine it work perfectly fine but when I load that jar inside of CVP container it didn't work. After doing a lot search i come out that I have to add few jar's inside of CVP tomcat container. I have added these jar's in the tomcat endorsed folder

  1. jaxb-impl.jar
  2. jaxws-rt.jar
  3. stax-ex.jar
  4. steambuffer.jar

After adding these jar my problem was solved.

Now I come with another problem, I have to set connection timeout and request time in my project. Now again same problem I am facing when I run that jar file outside of CVP Tomcat container (on window cmd) it work perfectly fine, but when I run this jar file inside the CVP Tomcat container it didn't reflect. Here is my code.

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package goldwsclient;


import java.util.Map;
import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLSession;
import javax.xml.ws.BindingProvider;
import ma.iam.wsgold.ws.impl.AppBusinessException_Exception;
import ma.iam.wsgold.ws.impl.FidelioDto;

/**
 *
 * @author Malik
 */
public class GoldWsClient {
    final static String REQUEST_TIMEOUT = "com.sun.xml.internal.ws.request.timeout";
    final static String CONNECT_TIMEOUT = "com.sun.xml.internal.ws.connect.timeout";

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
          try {
        FidelioDto fd=GoldWsClient.getInfoFidelioByND("234234234234324");
          System.out.println(fd.getCodeFidelio()+" This is code");
          System.out.println(fd.getQualite()+"This is the qualite");
        }
        catch(Exception e)
        {
           System.out.println(e.getMessage());
        }
    }

    public static FidelioDto getInfoFidelioByND(java.lang.String nd) throws AppBusinessException_Exception {
        ma.iam.wsgold.ws.impl.FidelioWebServiceImplService service = new ma.iam.wsgold.ws.impl.FidelioWebServiceImplService();
        ma.iam.wsgold.ws.impl.FidelioWebServiceImpl port = service.getFidelioWebServiceImplPort();
         BindingProvider prov = ((BindingProvider)port); 


        HttpsURLConnection.setDefaultHostnameVerifier(new HostnameVerifier()
        {
                @Override
            public boolean verify(String hostname, SSLSession session)
            {
                // ip address of the service URL(like.23.28.244.244)
                if (hostname.equals("IP"))
                {
                    return true;
                }
                return false;
            }
        });
        prov.getRequestContext().put(BindingProvider.USERNAME_PROPERTY, "centreAppel_USER");
        prov.getRequestContext().put(BindingProvider.PASSWORD_PROPERTY, "azer+654");

Map<String, Object> ctxt = ((BindingProvider) port).getRequestContext();
ctxt.put(CONNECT_TIMEOUT, 500);
ctxt.put(REQUEST_TIMEOUT, 500);

        return port.getInfoFidelioByND(nd);
    }
}
Cœur
  • 37,241
  • 25
  • 195
  • 267
user1722376
  • 107
  • 3
  • 10
  • possible duplicate of [Web-Service on Tomcat with Timeout](http://stackoverflow.com/questions/4472210/web-service-on-tomcat-with-timeout) – sgpalit Mar 12 '15 at 15:15
  • @sgplit thanks , but i didn't get any similarity in this question. Can you help please. – user1722376 Mar 12 '15 at 15:27
  • your port is client in the code of the solution. – sgpalit Mar 12 '15 at 15:30
  • I am not getting, what is ClientProxy etc :( – user1722376 Mar 12 '15 at 15:35
  • 1
    Ok wrong solution provided, it is for CXF. for your case you are on right way. you can check this solution http://stackoverflow.com/questions/2148915/how-do-i-set-the-timeout-for-a-jax-ws-webservice-client – sgpalit Mar 12 '15 at 15:41

0 Answers0