Solved

expception with saaj (soap xml)

Posted on 2007-11-18
1
2,466 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
Comment Utility
why dont you use wsdl2java tool?
could you send your web-service url or wsdl?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
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…
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…
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

743 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

7 Experts available now in Live!

Get 1:1 Help Now