Hello,

Thank you for the reply.

Below is the sample code that i am using - 
           
import org.apache.commons.httpclient.Credentials;
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpMethod;
import org.apache.commons.httpclient.UsernamePasswordCredentials;
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.GetMethod;
import org.apache.commons.httpclient.methods.PutMethod;
                
        public static void main(String[] args) {
                                
                                private static HttpClient httpClient;

                                httpClient = getHttpSesssion(); // Getting the 
authentication for the
application by using username/password
                                StringBuffer fetchURL = new 
StringBuffer(ConnectionConstants.SCHEME);
                                fetchURL.append(HOST);
                                fetchURL.append(REPOSITORY);
                                fetchURL.append(QUESTIONMARK);                  
        
                                fetchURL.append("oslc.where=domain:=DOMAIN . . 
. .);

// Forming the web service url to be called (fetchURL)

                                HttpMethod method = new 
GetMethod(fetchURL.toString());
                                                                try {
                                                                        
System.out.println("Setting header info...");
                                                                        
method.addRequestHeader("Accept", "application/json");
                                                                        
method.addRequestHeader("OSLC-Core-Version", "2.0");
                                                                        
                                                                        
executeMethod = httpClient.executeMethod(method);
                                                                        
                                                                        
System.out.println("Response Code :::" +
method.getStatusCode());

                                                                        String 
response = method.getResponseBodyAsString();
                                                                        
                                                                        
                                                                
                                                                
}catch(Exception e){
                                                                        //Wrap 
the exception                                      
                                                                }finally{
                                                                        
                                                                }

                                
                        }
                        


When the control reaches " executeMethod =
httpClient.executeMethod(method);"

It doesnt goahead and instead it stops/ goes back to the caller method
without any response.

In Karaf, i have installed httpClient -

103 | Active    |  50 | 3.1.0.7  | Apache ServiceMix :: Bundles ::
commons-httpclient

My manifest import statement - 

Import-Package:
org.osgi.framework,org.apache.camel,org.apache.commons.httpclient,org.apache.commons.httpclient.auth

Anything is missing? 



--
View this message in context: 
http://karaf.922171.n3.nabble.com/Karaf-Issue-Web-services-not-getting-called-not-working-as-expected-tp4043195p4043200.html
Sent from the Karaf - Dev mailing list archive at Nabble.com.

Reply via email to