Skip to content

Instantly share code, notes, and snippets.

@jvz
Last active August 29, 2015 13:56
Show Gist options
  • Save jvz/9030105 to your computer and use it in GitHub Desktop.
Save jvz/9030105 to your computer and use it in GitHub Desktop.
import java.io.File;
import java.io.IOException;
import org.apache.http.client.fluent.Request;
import org.apache.http.client.fluent.Response;
import org.apache.http.entity.ContentType;
/**
* @author msicker
* @version 1.0
*/
public class PostSoap {
public static void main( final String... args )
throws IOException {
final String url = args[ 0 ].trim();
final String soapAction = args[ 1 ].trim();
final String inputFileName = args[ 2 ].trim();
final File inputFile = new File( inputFileName );
final Response response = Request.Post( url )
.addHeader( "SOAPAction", soapAction.equalsIgnoreCase( "none" ) ? "" : soapAction )
.bodyFile( inputFile, ContentType.parse( "application/soap+xml" ) )
.execute();
System.out.println(response.returnContent().asString());
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment