KSoap-Android \ JCIFS发送空的HTTP帖子

Ada*_*oll 5 android ntlm jcifs http ksoap2

我基于KSOAP-Android和JCIFS创建了NTLM身份验证SOAP客户端。实现看起来像这样:

public class NtlmServiceConnection implements ServiceConnection 
{
    public NtlmServiceConnection(final SoapConnectionInfo connectionInfo, String path)      
    {
        httpclient = new DefaultHttpClient();
        httpclient.getAuthSchemes().register(AuthPolicy.NTLM, new NTLMSchemeFactory());

    //...

    @Override
    public InputStream openInputStream() throws IOException {
        ByteArrayEntity re = new ByteArrayEntity(bufferStream.toByteArray());
        post.removeHeaders("CONTENT-LENGTH");
        post.setEntity(re);
        HttpResponse rep = httpclient.execute(post);
        InputStream stream = rep.getEntity().getContent();
        return stream;
    }

    //....
}
Run Code Online (Sandbox Code Playgroud)

从外观上看,KSOAP正在生成正确的消息,因为bufferStream按预期填充了SOAP信封。JCIFS似乎正在完成其工作,而且我可以看到通过Wireshark进行了NTLM挑战响应。问题是消息正文丢失。它只是null。因此,Web服务遇到501,InputStream返回的为null。

有人知道为什么会发生这种情况吗?

注意:我要删除下面的CONTENT-LENGTH标头,因为setEntity显然试图设置它,但是KSOAP已经设置了它。我只是将其删除并允许对其setEntity进行重置。

Ada*_*oll 1

我终于弄清楚了并在这里写了博客:http://csharpening.net/blog/ ?p=271