Solved

expception with saaj (soap xml)

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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
configure dependency in POM for new database 3 43
Configure a Bean in an XML file 4 48
jmss example java 2 31
spring maven example issues 3 37
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

685 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