Soap Message from XML file using private key (SSL)

Israr Ahmad
Israr Ahmad used Ask the Experts™
I am facing Problem when converting xml file to soap message for making a call to web service attaching my code and request  

following is the error

<soapenv:Envelope xmlns:soapenv="" 

ContentDescription >> null
Soap Header        >> [soapenv:Header: null]
Soap Part          >> com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPPart1_1Impl@37f8bb67
SOAP Body          >> [soapenv:Body: null]

Open in new window
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
mccarlIT Business Systems Analyst / Software Developer
Top Expert 2015

I can't see any error in what you have posted.

BUT... I am guessing that you are worried about where it says the the Header and Body are null? If so, you don't need to be concerned. You have simply fallen into to trap of just trying to convert a DOM node to a String and print it out. This rarely (if ever) works the way you want.

You need to traverse the DOM elements that the getSOAPHeader and getSOAPBody calls return to see something more useful. Paste the following code over what you have in your sendSoapMessage method and you will see more detail and hopefully realize that it is doing what you want it to.

        try {
            NodeList nodes;
            System.out.println("ContentDescription >> "+message.getContentDescription());

            System.out.println("Soap Header Contents... ");
            nodes = message.getSOAPHeader().getChildNodes();
            for (int i = 0; i < nodes.getLength(); i++) {
                Node node = nodes.item(i);
                System.out.println("\t\t" + node.getNodeName());

            System.out.println("Soap Part          >> "+message.getSOAPPart());

            System.out.println("SOAP Body Contents... ");
            nodes = message.getSOAPBody().getChildNodes();
            for (int i = 0; i < nodes.getLength(); i++) {
                Node node = nodes.item(i);
                System.out.println("\t\t" + node.getNodeName());
        } catch (SOAPException e) {
            // TODO Auto-generated catch block

Open in new window


Hello mccarl,

Thanks, now i am able to move one step forward. My issue is i am getting error while sending a signed soap request using java class. I am getting success message when sending request using soapUI.

I am attaching four files which will help in investigation

1- Request payload from soupUI - getting success message
2- request payload from Java class - not  success
3- Error message i am getting while snding request from java class
4- Java class
5- soapUI outgoing request security configuration

I am struggling for making a successful SSL call even i am sending same Request payload of soupUI from java still getting same error.
i will be grateful for quick support.


There is a difference between both the request between Req_SoapUI.xml and signature_rq.xml. Server is expecting the request like Req_SoapUI.xml.
Any suggestion and help is appreciable.


I figure out the requirement

Sign XML request using OASIS SHA1 in Java

We need to sign a request and add that security tag to the Soap Request, we need to use OASIS standard

the requirements for the sign are

Standard  - OASIS
Keystore  - pfx
Key Identifier - X509 CERTIFICATE
Signature Algorithm - rsa-sha1
Canonicalization - exc-c14n
Digesest Algorithm - sha1
Authorisation - NTLM
Strip whitespaces - true

We Want to sign our generated request xml, the code we want will receive an string and produce a sign
Attaching the request file and signed file (Req_SoapUI.xml)format.


I have resolved it.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial