hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nishant Gupta <nisha...@alabot.com>
Subject mailing list
Date Sat, 31 May 2008 11:46:48 GMT

hi,

I am Facing issues regarding posting the soap xml as a string (it was 
working fine till i was using file) in setting post.requestEntity();


PostMethod post = new PostMethod(strURL);
        // Get target URL
      
        // Request content will be retrieved directly
        // from the input stream
        String xm = "<soap:Envelope 
xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\" 
xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" 
xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"><soap:Header><AuthenticationToken
xmlns=\"http://user.mynamesspace.com\">..................................</soap:Body></soap:Envelope>";
 
                             // String to be passed

        RequestEntity entity1 =  new 
StringRequestEntity(xm,"SOAPREQUEST",""); //*my error is here.* I have 
tried passing         
                                                                        
                                                                
//StringRequestEntity(content) and
                                                                        
                                                                
//StringRequestEntity(content, contenttype, charset);
       
        //RequestEntity entity = new FileRequestEntity(input, "text/xml; 
charset=ISO-8859-1");           //file was working fine earlier
        post.setRequestEntity(entity1);
         post.setRequestHeader("SOAPAction", strSoapAction);
        // Get HTTP client
        HttpClient httpclient = new HttpClient();
        // Execute request
        try {
            int result = httpclient.executeMethod(post);
              response = post.getResponseBodyAsString();
            System.out.println("String 
Response"+post.getResponseBodyAsString());
        }
        finally {

            // Release current connection to the connection pool once 
you are done
            post.releaseConnection();
        }


---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message