Solved

expception with saaj (soap xml)

Posted on 2007-11-18
1
2,579 Views
Last Modified: 2013-11-23
Hi experts

I write simple java program that call soap xml service using saaj and I get exception ...

this is the code

        try {
              
                  //First create the connection
                  SOAPConnectionFactory soapConnFactory =
                                     SOAPConnectionFactory.newInstance();
                  SOAPConnection connection =
                                      soapConnFactory.createConnection();
                  
                  // Next, create the actual message
                  MessageFactory messageFactory = MessageFactory.newInstance();
                  SOAPMessage message = messageFactory.createMessage();
                  
                  
                //Create objects for the message parts            
                  SOAPPart soapPart =     message.getSOAPPart();
                  SOAPEnvelope envelope = soapPart.getEnvelope();
                  SOAPBody body =         envelope.getBody();

                  
                         body.addChildElement(envelope.createName("RV-Get-Default-SIP-Message"));
                  //Save the message
                  message.saveChanges();

                  //Check the input
                  System.out.println("\nREQUEST:\n");
                  message.writeTo(System.out);
                  System.out.println();

                 //Send the message and get a reply  
                    
                 //Set the destination
                 String destination = "http://10.202.202.222:5050";
                 //Send the message
                 SOAPMessage reply = connection.call(message, destination);
                  
                
                     //Close the connection            
                  connection.close();
                    
                 } catch(Exception e) {
                     System.out.println(e.getMessage());
                     e.printStackTrace();
                 }
        



and this is the exception that I get



Nov 18, 2007 6:11:24 PM com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection post
SEVERE: SAAJ0008: Bad Response; null
java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
com.sun.xml.messaging.saaj.SOAPExceptionImpl: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:146)
      at yuval.main(yuval.java:85)
Caused by: java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:140)
      ... 1 more
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:323)
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:169)
      ... 3 more

CAUSE:

java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:140)
      at yuval.main(yuval.java:85)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:323)
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:169)
      ... 3 more

CAUSE:

java.security.PrivilegedActionException: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.call(HttpSOAPConnection.java:140)
      at yuval.main(yuval.java:85)
Caused by: com.sun.xml.messaging.saaj.SOAPExceptionImpl: Bad response: (-1null
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection.post(HttpSOAPConnection.java:323)
      at com.sun.xml.messaging.saaj.client.p2p.HttpSOAPConnection$PriviledgedPost.run(HttpSOAPConnection.java:169)
      ... 3 more



the send xml is :

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<RV-Get-Default-SIP-Message/>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

and it seems ok


and I get this xml as answer

<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"><SOAP-ENV:Header/><SOAP-ENV:Body><RV-Get-Default-SIP-Message/></SOAP-ENV:Body></SOAP-ENV:Envelope>

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:ProLab">
      <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
            <ns:RV-Get-Default-SIP-MessageResponse>
                  <DefaultSipMassegeName>SdpEconf</DefaultSipMassegeName>
                  <DefaultSipMassegeType>Application/SDP</DefaultSipMassegeType>
            </ns:RV-Get-Default-SIP-MessageResponse>
      </SOAP-ENV:Body></SOAP-ENV:Envelope>


but in the java I get exception ...
does any one can help ?


thanks

I sniffed the packets using ethereal
0
Comment
Question by:aquasw
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 9

Accepted Solution

by:
ysnky earned 500 total points
ID: 20356284
why dont you use wsdl2java tool?
could you send your web-service url or wsdl?
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…

617 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question