Solved

expception with saaj (soap xml)

Posted on 2007-11-18
1
2,496 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
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

Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Weekend adv creator 3 36
servlet web applications   metadata-complete="true" or false 3 36
spring jars download 1 26
How to determine if a string is a valid SHA value 7 28
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

813 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now