views:

28

answers:

3

how can i post xml to https web service and get the xml in response... the requirement is this..

The web service accepts a parameter payload in which we can pass xml and i will be getting response xml.

the url looks like this: https://servername/aaa/bbb/us/ws.do?

A: 

Get the WSDL for the web service, and use it for your tooling. A good place to start is the Web Service Explorer in Eclipse JEE.

Thorbjørn Ravn Andersen
A: 

Get the webservice definition (WSDL) and use a wsdl2java client to generate java client for the WSDL. Use the generated client code to invoke the webservice. Webservice framework that you choose will take care of constructing and parsing SOAP request/response for you. Example , refer Apache Axis

chedine
A: 

private static final String CERT_FILE_LOC = "/aaa/bbb/ccffdd.jks"; System.setProperty("javax.net.ssl.trustStore", CERT_FILE_LOC);

        HostnameVerifier hv = new HostnameVerifier() {
            public boolean verify(String urlHostName, SSLSession session) {
                System.out.println("Warning: URL Host: "+urlHostName+" vs. "+session.getPeerHost());

                return true;
            }
        };

        HttpsURLConnection.setDefaultHostnameVerifier(hv);

        URL url = new URL(inputUrl);
        HttpsURLConnection connection = (HttpsURLConnection)url.openConnection();

        connection.setDoOutput(true);

        BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        String line;

        while ((line = in.readLine()) != null) {
            responseXml=responseXml+line;
            }
        in.close();
        System.out.println("responseXml");
AutoMEta