Skip to content
This repository has been archived by the owner on Oct 1, 2018. It is now read-only.

SOAP Response message parsing error java.lang.ClassCastException: oracle.j2ee.ws.saaj.soap.TextImpl cannot be cast to javax.xml.soap.SOAPElement #76

Open
glassfishrobot opened this issue Sep 24, 2014 · 3 comments

Comments

@glassfishrobot
Copy link
Contributor

We are getting error java.lang.ClassCastException: oracle.j2ee.ws.saaj.soap.TextImpl cannot be cast to javax.xml.soap.SOAPElement while parsing SOAP response message.

Below code is for your reference.

<%@page import="javax.xml.soap.,javax.xml.parsers."%>

SOAPConnectionFactory CF = SOAPConnectionFactory.newInstance();
SOAPConnection soapC = CF.createConnection();
MessageFactory MF = MessageFactory.newInstance();
SOAPMessage soapMsg = MF.createMessage();
SOAPPart soapP = soapMsg.getSOAPPart();
SOAPEnvelope soapE = soapP.getEnvelope();

try

{ soapE.addNamespaceDeclaration("urn","urn:sap-com:document:sap:rfc:functions"); SOAPBody soapB = soapE.getBody(); SOAPElement soapEle = soapB.addChildElement("Z_RAP_BAPI_PO_GETDETAILS","urn"); SOAPElement soapEle1 = soapEle.addChildElement("PURCHASEORDER"); soapEle1.addTextNode("4100528320"); MimeHeaders MH = soapMsg.getMimeHeaders(); MH.addHeader("SOAPAction","http://sap.com/xi/WebService/soap1.1"); soapMsg.saveChanges(); System.out.println("Request SOAP message"); soapMsg.writeTo(System.out); SOAPMessage soapResponse = soapC.call(soapMsg,"http://sappidev..."); System.out.println("Response SOAP message"); soapResponse.writeTo(System.out); SOAPElement ele = (SOAPElement)(soapResponse.getSOAPBody().getChildElements().next()); out.println(ele.getValue()); }

catch(Exception e)

{ out.println("::::::::Exception::::::::::::::"+e); }

soapC.close();

Quick response will be useful.

Environment

Oracle 10g application server

@glassfishrobot
Copy link
Contributor Author

Reported by priyadarsini

@glassfishrobot
Copy link
Contributor Author

Was assigned to gagordon

@glassfishrobot
Copy link
Contributor Author

This issue was imported from java.net JIRA SAAJ-76

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant