Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

expception with saaj (soap xml)

Posted on 2007-11-18
1
Medium Priority
?
2,599 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 1500 total points
ID: 20356284
why dont you use wsdl2java tool?
could you send your web-service url or wsdl?
0

Featured Post

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

721 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