XMLファイルをリクエストとしてSOAPサーバーに送信したい。これが私が持っているコードです:( org.apache.httpを使用してSOAPアクションでHTTPPostリクエストを送信することから変更されました)
import org.apache.http.client.*;
import org.apache.http.client.methods.*;
import org.apache.http.impl.client.*;
import org.apache.http.entity.StringEntity;
import org.apache.http.protocol.HTTP;
import org.apache.http.HttpResponse;
import java.net.URI;
public static void req()   {
        try {
            HttpClient httpclient = new DefaultHttpClient();
            String body="xml here";
            String bodyLength=new Integer(body.length()).toString();
            URI uri=new URI("http://1.1.1.1:100/Service");
            HttpPost httpPost = new HttpPost(uri);
            httpPost.setHeader( "SOAPAction", "MonitoringService" );
            httpPost.setHeader("Content-Type", "text/xml;charset=UTF-8");
            StringEntity entity = new StringEntity(body, "text/xml",HTTP.DEFAULT_CONTENT_CHARSET);
            httpPost.setEntity(entity);
            RequestWrapper requestWrapper=new RequestWrapper(httpPost);
            requestWrapper.setMethod("POST");
            requestWrapper.setHeader("Content-Length",bodyLength);
            HttpResponse response = httpclient.execute(requestWrapper);
            System.out.println(response);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
これまで、サーバーからエラー「http 500」(内部サーバーエラー)が発生していましたが、現在はまったく応答がありません。他のクライアントでは問題がないので、サーバーが正しく機能していることを私は知っています。
ありがとう。