Skip to content
This repository was archived by the owner on Oct 1, 2018. It is now read-only.
This repository was 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

@glassfishrobot

Description

@glassfishrobot

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

Metadata

Metadata

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions