You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by sac_sachin <vb...@gmail.com> on 2009/12/28 15:49:33 UTC

Re: Sending SOAP request using HTTPPost (HttpClient 4.0)

Hi Arpita,

Hope, you have fixed this problem.  I am new to SOAP, i am writing new
application based on SOAP, can you tell me whtat the below soap body does ?

   + "<soap:Body>"
                    + "<Login
xmlns=\"http://videoos.net/2/XProtectCSServerCommand\">"
                    +
"<instanceId>6a716afc-708e-479f-8b42-f97338d794f9</instanceId>"
                    + "<currentToken/>" + "</Login>" + "</soap:Body>"

I have understood that your are login to the server "http://videoos.net"
with the instance ID 6a716afc-708e-479f-8b42-f97338d794f9. 

what kind of service should be running on the server to communicate with the
soap service?

Thanks in advance.





arpita dhundia wrote:
> 
> Hello Folks,
> 
> I have run into a very odd problem.
> I have to send a SOAP (xml data over HTTP Post) request to another server
> behind NTLM authentication. I am using HttpClient 4.0 for that.
> The NTLM authentication works fine but when I try to send the xml data
> using StringEntity and set that Entity to the HTTPPpost Object, I am
> returned 400 error code, meaning "bad request".
> I tried to see the exact request that HTTPClient is sending using
> WireShark and indeed the format of the request is not correct. The headers
> are repeated twice and the body too is not correctly placed (unfortunately
> I cant point out the exact mistake, but comparing it with a request that a
> soap client sends its different and seeming incorrect).
> 
> Is anybody aware of any problems related to StringEntity? Or maybe any
> other way I can send xml data using HttpPost method in HttpClient 4.0 API.
> 
> Any help would be highly appreciated, I am behind my deadline on this task
> :(.
> 
> Thanks!!
> 
> PS:- For better understanding, here is a snippet of the code:-
> 
> DefaultHttpClient client = new DefaultHttpClient();
>         client.getAuthSchemes().register("ntlm", new NTLMSchemeFactory());
>         client.getCredentialsProvider().setCredentials(
>                 new AuthScope("host", port, "domain"),
>                 new NTCredentials("username", "password", "domain",
>                         "domain2"));
> 
>         HttpPost httpget = new HttpPost(
>                 "http://ip/ServerAPI/ServerCommandService.asmx");
> 
>         try {
>             String soapRequest = "<?xml
> version=\"1.0\"encoding=\"utf-8\"?>"
>                     + "<soap:Envelope "
>                     +
> "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" "
>                     + "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
>                     +
> "xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""
>                     + "<soap:Body>"
>                     + "<Login
> xmlns=\"http://videoos.net/2/XProtectCSServerCommand\">"
>                     +
> "<instanceId>6a716afc-708e-479f-8b42-f97338d794f9</instanceId>"
>                     + "<currentToken/>" + "</Login>" + "</soap:Body>"
>                     + "</soap:Envelope>";
> 
> 
>             httpget.addHeader("SOAPAction",
>                    
> "\"http://videoos.net/2/XProtectCSServerCommand/Login\"");
> 
>             StringEntity strent= new StringEntity(soapRequest);
>             strent.setContentType("text/xml; charset=utf-8");
>             httpget.setEntity(strent);
> 
>             ResponseHandler<String> response = new BasicResponseHandler();
>             String responseBody = client.execute(httpget, response);
>             System.out.println(responseBody);
> }catch(IOException ex)
> {
> ex.printStackTrace();
> }
> 
> 
> 
>       Now, send attachments up to 25MB with Yahoo! India Mail. Learn how.
> http://in.overview.mail.yahoo.com/photos
> 

-- 
View this message in context: http://old.nabble.com/Sending-SOAP-request-using-HTTPPost-%28HttpClient-4.0%29-tp26127809p26943790.html
Sent from the HttpClient-User mailing list archive at Nabble.com.


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