Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: Not able to receive SOAP response

  1. #1
    Junior Member
    Join Date
    May 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Not able to receive SOAP response

    Hello,

    I'm trying to send a SOAP request and receive SOAP response.
    But, I'm not able to get the response object, It is coming as NULL.

    The code goes like this :
    public class SoapRequest {
      public static void main(String[] args) {
        try {
          MessageFactory mf = MessageFactory.newInstance(SOAPConstants.SOAP_1_2_PROTOCOL);
          SOAPMessage sm = mf.createMessage();
          SOAPBody sb = sm.getSOAPBody();
     
     
          QName bodyName = new QName("http://ec2-184-73-115-196.compute-1.amazonaws.com/foundation-webapp/services/wsservice?wsdl", "getServiceListByHostName", "urn");
          SOAPBodyElement bodyElement = sb.addBodyElement(bodyName);
          QName qn = new QName("hostName");
          SOAPElement quotation = bodyElement.addChildElement(qn);
     
          quotation.addTextNode("i-e3aeee88@ami-29ef0840");
     
          System.out.println("\n Soap Request:\n");
          sm.writeTo(System.out);
          System.out.println();
     
          SOAPConnectionFactory soapConnectionFactory = SOAPConnectionFactory.newInstance();
          SOAPConnection connection = soapConnectionFactory.createConnection();
          URL endpoint = new URL("http://ec2-184-73-115-196.compute-1.amazonaws.com/foundation-webapp/services/wsservice?wsdl");
          SOAPMessage response = connection.call(sm, endpoint);
          connection.close();
     
          System.out.println("SOAP Reponse : " + response.getContentDescription());
        } catch (Exception ex) {
          ex.printStackTrace();
        }
      }
    }

    Thanks in Advance.

    Abhi
    Last edited by Json; May 12th, 2010 at 06:25 AM. Reason: Please use code tags.


  2. #2
    Super Moderator Json's Avatar
    Join Date
    Jul 2009
    Location
    Warrington, United Kingdom
    Posts
    1,274
    My Mood
    Happy
    Thanks
    70
    Thanked 156 Times in 152 Posts

    Default Re: Not able to receive SOAP response

    Is the response null or is the actual contentDescription null?

    // Json

  3. #3
    Junior Member
    Join Date
    May 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Not able to receive SOAP response

    Quote Originally Posted by Json View Post
    Is the response null or is the actual contentDescription null?

    // Json
    response.getContentDescription() is returning NULL.

Similar Threads

  1. Simple Java SOAP client
    By andy in forum Java Networking
    Replies: 3
    Last Post: December 16th, 2010, 03:05 PM
  2. [help] cant receive sms
    By ordinarypeople in forum Java ME (Mobile Edition)
    Replies: 0
    Last Post: April 4th, 2010, 02:41 PM
  3. Replies: 6
    Last Post: April 14th, 2009, 08:02 AM
  4. [SOLVED] Java for loop problem and out put is not coming
    By thewonderdude in forum Loops & Control Statements
    Replies: 9
    Last Post: March 15th, 2009, 02:31 PM
  5. SOAP Message Factory response error
    By Buglish in forum File I/O & Other I/O Streams
    Replies: 3
    Last Post: November 6th, 2008, 12:42 PM