ClassCastException when retrieving SOAP content

I got a java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.dom4j.TextImpl
when retrieving SOAP content.
The code looks like:
SOAPPart part = message.getSOAPPart();
SOAPEnvelope envelope = part.getEnvelope();
SOAPBody body = envelope.getBody();
SOAPBodyElement bookElement = ( SOAPBodyElement ) body.getChildElements().next();
SOAPElement isbnElement = ( SOAPElement ) bookElement.getChildElements().next();
System.out.println( isbnElement.getValue() );
The SOAP message as follows:
<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<soapenv:Body>
<ns1:getPrice xmlns:ns1="http://www.deitel.com/BookPrie.wsdl">
<arg0 xsi:type="xsd:string">0130895601</arg0>
</ns1:getPrice>
</soapenv:Body>
</soapenv:Envelope>
Any help?
Thanks in advance.

I had a similar problem and solved it. Please look at http://forum.java.sun.com/thread.jsp?forum=331&thread=268806 .

Similar Messages

  • ClassCastException when calling SOAP adapter

    Hello,
    I created a Web service interface to an ABAP RFC
    via XI and a corresponding communication channel
    (SOAP/HTTP to a specific message interface with data
    types, message types, mappings etc. defined in the
    integration repository). Sending SOAP messages
    and receiving the correct replies works fine.
    However, when I transport the relevant objects
    from our test system to the consolidation system
    by exporting and then importing via the file system
    (all objects of the software component in the integration
    repository, all objects of the communication scenario
    in the integration directory), the
    ClassCastException given below is returned
    when sending the same SOAP messages
    to the consolidation system. Other SOAP interfaces
    work, but the one I imported does not.
    Unfortunately, the request neither shows up in
    the XmlMonitor nor in MessageMonitoring in the
    Runtime workbench, so I do not get a further
    indication what actually went wrong.
    Questions:
    - Has anyone had a similar problem or the same
      error message? If so, what was the cause?
    - Does anyone (maybe from SAP) know what exactly
      happens in the mentioned code line where the
      exception is thrown?
    - Where could I look to find further information
      about the error?
    System information:
    - SAP BASE 6.40, XI 3.0 with Service Pack 15
    Thanks + Cheers,
      Guido
    <?xml version='1.0'?>
    <!-- see the documentation -->
    <SOAP:Envelope xmlns:SOAP='http://schemas.xmlsoap.org/soap/envelope/'>
      <SOAP:Body>
        <SOAP:Fault>
          <faultcode>SOAP:Server</faultcode>
          <faultstring>Server Error</faultstring>
          <detail>
            <s:SystemError xmlns:s='http://sap.com/xi/WebService/xi2.0'>
              <context>XIAdapter</context>
              <code>ClassCastException</code>
              <text><![CDATA[
    java.lang.ClassCastException
         at com.sap.aii.af.mp.ejb.ModuleProcessorBean.process(ModuleProcessorBean.java:227)
         at com.sap.aii.af.mp.processor.ModuleProcessorLocalLocalObjectImpl0.process(ModuleProcessorLocalLocalObjectImpl0.java:103)
         at com.sap.aii.af.mp.soap.web.MessageServlet.callModuleProcessor(MessageServlet.java:159)
         at com.sap.aii.af.mp.soap.web.MessageServlet.doPost(MessageServlet.java:383)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:95)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:160)
              ]]></text>
            </s:SystemError>
          </detail>
        </SOAP:Fault>
      </SOAP:Body>
    </SOAP:Envelope>

    Hi,
    looking to the stack trace provided by i found this
    >>at java.security.AccessController.doPrivileged(Native >>Method)
    this means that you have defined assigned users for the business service in configuration directory.
    Make sure the client is making the webservice call using that specific user.
    cheers,
    naveen

  • ClassCastException when retring soap attachment-image

    Hi
    When i try to retrive my gif(picture) attachment server firs an
    exception message -exception fires exception is
    java.lang.ClassCastException: sun.awt.windows.WImage
    with out retriving .
    How do i over come this??
    pLEASE post me the code how do i retrive the image
    if (attachment.getContentType().equals("image/gif")) {
    p2.println("inside image gif");
    try{
    ByteArrayInputStream contentStream = (ByteArrayInputStream)attachment.getContent();
         int bytesToRead = contentStream.available();
    byte[] buffer = new byte[bytesToRead];
    contentStream.read(buffer);
    // write buffer to new file
         FileOutputStream file = new FileOutputStream("C:/form.gif");
         file.write(buffer);
         file.close();
    p2.println("Finish retriving");
    }catch(Exception e){
    p2.println("exception fires");
    This My client part
    DataSource source = new FileDataSource("E:/img1.GIF");
    DataHandler handler = new DataHandler(source);
    // create attachment for message
    AttachmentPart attachment = msg.createAttachmentPart(handler);
    // set content id (optional)
    msg.addAttachmentPart(attachment);// send message
    Thanks for your time and help
    Priya

    Can you please post how you solved your problem (if you solved it of course).

  • ClassCastException when using javax.xml.soap.DetailEntry

    I am using the Java Web Services development pack and I'm getting a ClassCastException when trying to use a DetailEntry object.
    My code is basically as follows:
    SOAPFault fault = responseSoapBody.getFault();
    Detail detail = fault.getDetail();
    Iterator iterator = detail.getDetailEntries();
    DetailEntry entry = (DetailEntry)iterator.next(); //exception!!
    Exception:
    java.lang.ClassCastException: com.sun.xml.messaging.saaj.soap.dom4j.TextImpl
    The object being returned from the Iterator seems to be a TextImpl. In my CLASSPATH are the jars in the lib directory under <JWSDP>\jwsdp-1_0_01\common\lib.
    Any idea why I'm getting this Exception? Is this a bug in the JWSDP, or in my code?
    Thanks...

    You post has been forwarded to the SAAJ person as it seems
    like a SAAJ exception ... u should be hearing from the
    individual soon
    asengup

  • Oracle.j2ee.ws.saaj.ContentTypeException:Not a valid SOAP Content-Type:text

    Hi,
    I m trying to invoke external webservice using Oracle BPEL. I create BPEL process to invoke the webservice.
    BPEL process invokes the external webservice, retrieving the session id,etc. But, when the same webservice is invoked again using the session id throught the same BPEL process, BPEL process is throwing this fault error:
    <fault>
    -<remoteFault xmlns="http://schemas.oracle.com/bpel/extension">
    -<part name="summary">
    <summary>
    exception on JaxRpc invoke: HTTP transport error: javax.xml.soap.SOAPException: java.security.PrivilegedActionException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html; charset=UTF-8
    </summary>
    </part>
    </remoteFault>
    </fault>
    Can any one tell how to resolve the above exception...
    Thanks in Advance.
    Ajay

    I am having a very similar problem. Did you end up solving this problem?

  • Not a valid SOAP Content-Type: text/html; charset=iso-8859-1

    Friends
    JDEV and SOA suite 10134
    I have multiple domains on my BPEL Server. In one of the domain since I deployed the new process, all the processes of that domain are now failing on execution with following error in opmn/soa_instance/*.err log files. No errors in domain.log
    +"Caused by: java.security.PrivilegedActionException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html; cha+
    +rset=iso-8859-1"+
    At the same time we get Internal Server Error on BPEL Console.
    I have sync processes with 1 or two invokes, so I am generally losing the instances, cannot provide the details in the process execution. All BPEL processes are invoking Siebel Web Services, that is the common part.
    When I restart my system, it may or may not work; even if it works then within few instances execution again starts giving the same error. I can see that after the errors the instance are going through and getting completed successfully few times. All these processes were working successfully earlier.
    Any idea about this !!!!
    Thanks

    Thanks Anirudh,
    I don't use compensation handlers. Moreover I have properly defined the scopes and sequences throughout the bpel process. My processes are sync in nature and I'm not able say at what step exactly the processes are failing and throwing the SOAP content Type error though the instances are getting completed with delay soemtimes.

  • Servlet retrieves pdf content stored in oracle and sends this content

    I have pdf content stored in an oracle database. The database column type is LONG RAW. I am retrieving the contents using jdbc's getBinaryStream. The content type is set to pplication/pdf. When the code is executed, the acrobat is launched but the content is not displayed. After analyzing the contents retrieved from the database, I discovered that characters were missing. I replicated the same code in a different language and it was working.
    Has anyone else encountered this problem? If so, how was it resolved.
    Any ideas or comments would be appreciated.
    z.

    What is the character set of the Oracle db that you are using. I would suggest that you try to set the char set to Unicode and try.

  • Invalid SOAP Content-Type

    I have deployed an 11g SOA-BPEL process that invokes a an external Web Service exposed by Oracle/PeopleSoft. When I test the deployment, I am getting the following error messages:
    *oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: javax.xml.soap.SOAPException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html<br>
    java.lang.Exception: oracle.sysman.emSDK.webservices.wsdlapi.SoapTestException: javax.xml.soap.SOAPException: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html*
    What are the possibilities here?
    TIA

    I tested the Soap Template thru SoapUI. But, I do not have a message as it is created for calling the Web SEevice reference. The SOA deployment is barren of any info other than the error log.
    Is there anywhere I can look to isolate the problem?
    Edited by: Steve Davies on Feb 15, 2010 2:18 PM
    Edited by: Steve Davies on Feb 15, 2010 2:19 PM

  • Printing SOAP Contents

    I have two programs, the Server.java and Client.java. The Client creates a simple SOAP message and send to the server. The server listens to the port and print out whatever it received from the port:  // Server.java -----------------------------------------------------------------------
      ServerSocket serverSocket = new ServerSocket(4444);
      Socket socket = serverSocket.accept();
      BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
      String line = null;
      while ((line = in.readLine()) != null) {
        System.out.println(line);
      // Client.java -----------------------------------------------------------------------
      MessageFactory msgFactory = MessageFactory.newInstance();
      SOAPMessage message = msgFactory.createMessage();
      SOAPConnectionFactory connFactory = SOAPConnectionFactory.newInstance();
      SOAPConnection connection = connFactory.createConnection();
      SOAPBody body = message.getSOAPBody();
      SOAPFactory soapFactory = SOAPFactory.newInstance();
      Name bodyName = soapFactory.createName("GetLastTradePrice", "m", "http://wombat.ztrade.com");
      SOAPBodyElement bodyElement = body.addBodyElement(bodyName);
      URL endpoint = new URL("http://localhost:4444/");
      SOAPMessage response = connection.call(message, endpoint);
      connection.close();Unfortunately, when I run the programs, the Server console prints only the following lines but there is no SOAP contents printed, what could be the problem? Is this normal?  Output from Server console:
      POST / HTTP/1.1
      Content-Type: text/xml; charset="utf-8"
      Content-Length: 246
      SOAPAction: ""
      Cache-Control: no-cache
      Pragma: no-cache
      User-Agent: Java/1.4.2_03
      Host: localhost:4444
      Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2
      Connection: keep-alive
      // no more lines, waiting for next connection

    first of all: to open a server socket it is not webservice technique !!!!!!!!!!!!!!
    you have to use a servlet to accept SOAP call message.
    public void doPost( HttpServletRequest req, HttpServletResponse res ) {
    InputStream in = req.getInputStream() ;
    SOAPMessage soapMessage =
    messageFactory.createMessage(getHeaders(req), in) ;
    // to print SOAP message to Console :
    soapMessage.writeTo( System.out );
    Thank you

  • How to retrieving the content using Links

    Hi
    Please suggest me how to retrive content using link property.
    I have added link property to my Content. and i have added in internal resource path to the Link property.
    But my question is how access the page which is linked to my Content.
    How can i use it with anchor tag when i want show display the linked page content.
    what are tags to be used to retrive the linked content in the page.
    I found below line in CM documentation
    "These relationships are used by developers in their content queries when retrieving content to display in
    your portal."
    But i could found how to retrive.
    Genarally what technique we use to link an internal resource of our Content management
    thanks in advance
    Edited by: vamshi krishna on Jun 12, 2011 12:32 AM

    It sounds like there may be a misunderstanding about our link property feature.
    That feature is not for web hyperlinks. For that you can just use a string property. The links feature is for pointers to other pieces of content.
    (from: http://download.oracle.com/docs/cd/E13155_01/wlp/docs103/cm/contentTypesCm.html)
    "Using Link Properties
    You can create properties that allow content contributors to associate content items. Content contributors can link to content within the same or different repositories within the Virtual Content Repository. For example, if you have related content items that are stored in different folders, you can use content link properties to create relationships among content items. These relationships are used by developers in their content queries when retrieving content to display in your portal.
    Link properties can also be multi-valued to allow content contributors to link to multiple content items. For detailed instructions on adding a link property, see Define the Properties of a Content Type."
    Edited by: Chris Bales on Jun 13, 2011 2:56 PM

  • Error when calling SOAP Runtime functions - Please help!

    Hi,
    Very new to SAP. I just installed SAPNW7.0ABAPTrialSP12 (sandbox server, with default options) and setup the
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/db/7c623cf568896be10000000a11405a/content.htm">Flight Data</a>.
    I wanted to invoke some of the Flight Data functions through SOAP. So I invoked the following URL:
    http://localhost:8000/sap/bc/srt/rfc/sap/BAPI_FLIGHT_GETDETAIL?sap-client=000&wsdl=1.1
    I get the following error:
      The following error text was processed in the system NSP : Error when calling SOAP Runtime functions
    The error occurred on the application server hs_NSP_00 and in the work process 0 .
    The termination type was: RABAX_STATE
    The ABAP call stack was:
          Method: HANDLE_REQUEST of program CL_SOAP_TRANSPORT_EXTENSN_ROOTCP
          Method: HANDLE_REQUEST of program CL_SOAP_HTTP_EXTENSION========CP
          Method: IF_HTTP_EXTENSION~HANDLE_REQUEST of program CL_SOAP_HTTP_EXTENSION========CP
          Method: EXECUTE_REQUEST of program CL_HTTP_SERVER================CP
          Function: HTTP_DISPATCH_REQUEST of program SAPLHTTP_RUNTIME
          Module: %_HTTP_START of program SAPMHTTP
    FROM Runtime Error Log:
    Runtime Errors                     UNCAUGHT_EXCEPTION                                                          
    Exception                          CX_SOAP_CORE
           Termination occurred in the ABAP program "CL_SOAP_TRANSPORT_EXTENSN_ROOTCP" -                
               in "HANDLE_REQUEST".                                                                               
    The main program was "SAPMHTTP ".                                                                               
    In the source code you have the termination point in line 37                                 
              of the (Include) program "CL_SOAP_TRANSPORT_EXTENSN_ROOTCM004".
    Does anyone have any ideas on what is going on? Thanks in advance.

    Hi,
    Have a look at this blog from Michal Krawczyk to find a solution:
    The specified item was not found.
    Hope this helps,
    Grzegorz

  • Oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: te

    oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html; charset=UTF-8
    Cause: oracle.j2ee.ws.saaj.ContentTypeException: Not a valid SOAP Content-Type: text/html; charset=UTF-8
    I am getting the above error message when i test the soa webservcies in a browser.when i test with soap ui it works fine

    user9055538 wrote:
    i test the soa webservcies in a browserHi,
    It would help if you could give us more details...
    What type of soa webservices are we talking about here (JAX-RPC/BPEL/OSB)?
    And how exactly are you testing your soa webservices in a browser (EM)?
    A valid SOAP will have content-type: text/xml
    You may be pointing to a invalid endpoint or you may have an authentication/authorisation problem, so you are receiving html instead of soap...
    Cheers,
    Vlad

  • EXC_BAD_ACCESS on device when getting URL contents

    Hi Guys
    I'm having an issue retrieving the contents of a URL, only when I am testing on the iPhone device itself.
    It works fine when I use the simulator but when testing on the device itself I get a EXC_BAD_ACCESS on the following line:
    NSString * example = [NSString stringWithContentsOfURL:nsURL];
    The device is a iPhone 4 with iOS 4.1
    Can someone please help as I have tried everything I can think of?
    Thanks in advance

    The error occurs when I call [NSString stringWithContentsOfURL:nsURL];
    The entire code is as follows:
    NSURL *nsURL = [NSURL URLWithString:@"http://www.mywebsite.com/xmlfeed.jsp"];
    NSString * example = [NSString stringWithContentsOfURL:nsURL];
    Only other thing I can add is that this code is running in a background thread when the app is launched and that the returned data is XML.
    I have also tried using TouchXML and the following line also has the same problem:
    CXMLDocument *xmlParser = [[[CXMLDocument alloc] initWithContentsOfURL:[NSURL URLWithString:@"http://www.mywebsite.com/xmlfeed.jsp"] options:0 error:nil] autorelease];
    The strange thing is that both options work 100% of the time on the simulator. Could there be a flag or option I need to set to allow the app to communicate with the network connection?

  • Retrieve tag content

    Hi, I am new of JSP and I want to do this:
    for example I have this line in my HTML page:
    <span> xxx </span>
    when I press a button of a form I want to pass the string xxx to a Java Bean, how can I do that? of course the tag content changes dinamically.
    Thank you!

    It would have to be javascript. Give the element an ID and then you can retrieve the content using the innerHTML element. I'm not sure if the span element supports this, the div does.
    <div id="yourdiv">bla bla bla</div>
    <form name="yourform" method="post" action="yourjsp.jsp">
    <input type="hidden" name="divcontent" value="">
    <input type="button" value="submit" onClick="doSubmit();">
    </form>When submitting do the following:
    function getElement(id)
    if(document.all) { return document.all[id]; }
    return document.getElementById(id);
    function doSubmit()
    document.yourform.divcontent.value = getElement('yourdiv').innerHTML;
    document.yourform.submit();
    }That should work, if I didn't make a typo somewhere (typed from memory)

  • A black airplay info window floats around on my HDTV screen when sending audio content via airplay up to sound system w Apple TV.  How can I get rid of this?

    A black airplay info window floats around on my HDTV screen when sending audio content via airplay up to sound system w Apple TV.  How can I get rid of this?

    Had this happen to me after a recent update, was super annoying.  To turn off, go to Settings > AirPlay > Conference Room Display > Off.

Maybe you are looking for

  • DO NOT BUY HP PAVILLION TOUCHSMART 20 ALL-IN-ONE

    My experience with this desktop has been very poor.  I have owned a computer since they have been offered to consumers and I say from experience that this is the worst computer I have owned.  I have been on the phone with techs twice for over an hour

  • Java applet IO Filepermissions

    From what I understand, all a local applet needs to write to a local file is granted permission. I have 2 files. Both are located in the directory "C:\Documents and Settings\Soots\Desktop": Stuff.txt - Blank document. TestWriter.java - Java applet co

  • Scrollable frame in MSO v18

    Hello all I have updated to V18 and one of the new feature was to enable scrollable content in MSO Wich I try, several time, It works will in the desktop preview but on the Ipad the scrollable text dissapear..... I can just see the scrollable bar....

  • Bookmarks don't sync after upgrade to Tiger :-(

    I have 3 computers synced to the same .Mac account. Until this week everything has worked perfectly. This week I upgraded my powerbook to Tiger (already upgraded my iMac and a DualG5 desktop). With the upgrade of my powerbook, (1) the name that iSync

  • Is my Iphone 4's Battery Normal ?

    I Bought a Used iPhone 4 Yesterday. I charged it to 100% by wall charger, and I used it randomly for about 1 hours 31 Minutes ( as shown in stats of my phone ) and kept it on standby for 2 hours 30 mins,  and the battery went down to 79%. I did a 10