C
cxc
Hi
I am trying to submit to UK's Gov Talk SOAP System using SAAJ. The
error message occurs when I try and check the SOAP body to verify all
the tags. I have been having a lot of trouble with loading the XML
because of the non standard tag. Could someone please advise the
correct way to send this XML?
The envelopes employ the following root tag:
<?xml version="1.0" encoding="UTF-8"?>
<GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope">
....
20-May-2005 22:30:42 com.sun.xml.messaging.saaj.soap.SOAPPartImpl
lookForEnvelope
SEVERE: SAAJ0514: Unable to create envelope from given source because
the root element is not named Envelope
20-May-2005 22:30:42 com.sun.xml.messaging.saaj.soap.EnvelopeFactory
createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given source
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = factory.createConnection();
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
//Populate the Message
StreamSource preppedMsgSrc = new StreamSource( new
FileInputStream("core-v2-0.xml"));
soapPart.setContent(preppedMsgSrc);
//Save the message
message.saveChanges();
// Allow HTTPS
System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// Get the SOAP body and check the output to verify the XML is correct
SOAPBody soapBody = message.getSOAPBody();
// Get the SOAP body and check the output to verify the XML is correct
SOAPBody soapBody = message.getSOAPBody();
java.util.Iterator iterator = soapBody.getChildElements();
while (iterator.hasNext()) {
SOAPBodyElement bodyElement = (SOAPBodyElement)iterator.next();
String localName = bodyElement.getLocalName();
System.out.println(localName);
TIA
Nick
I am trying to submit to UK's Gov Talk SOAP System using SAAJ. The
error message occurs when I try and check the SOAP body to verify all
the tags. I have been having a lot of trouble with loading the XML
because of the non standard tag. Could someone please advise the
correct way to send this XML?
The envelopes employ the following root tag:
<?xml version="1.0" encoding="UTF-8"?>
<GovTalkMessage xmlns="http://www.govtalk.gov.uk/CM/envelope">
....
20-May-2005 22:30:42 com.sun.xml.messaging.saaj.soap.SOAPPartImpl
lookForEnvelope
SEVERE: SAAJ0514: Unable to create envelope from given source because
the root element is not named Envelope
20-May-2005 22:30:42 com.sun.xml.messaging.saaj.soap.EnvelopeFactory
createEnvelope
SEVERE: SAAJ0511: Unable to create envelope from given source
SOAPConnectionFactory factory = SOAPConnectionFactory.newInstance();
SOAPConnection connection = factory.createConnection();
MessageFactory messageFactory = MessageFactory.newInstance();
SOAPMessage message = messageFactory.createMessage();
SOAPPart soapPart = message.getSOAPPart();
SOAPEnvelope envelope = soapPart.getEnvelope();
SOAPBody body = envelope.getBody();
//Populate the Message
StreamSource preppedMsgSrc = new StreamSource( new
FileInputStream("core-v2-0.xml"));
soapPart.setContent(preppedMsgSrc);
//Save the message
message.saveChanges();
// Allow HTTPS
System.setProperty("java.protocol.handler.pkgs",
"com.sun.net.ssl.internal.www.protocol");
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider());
// Get the SOAP body and check the output to verify the XML is correct
SOAPBody soapBody = message.getSOAPBody();
// Get the SOAP body and check the output to verify the XML is correct
SOAPBody soapBody = message.getSOAPBody();
java.util.Iterator iterator = soapBody.getChildElements();
while (iterator.hasNext()) {
SOAPBodyElement bodyElement = (SOAPBodyElement)iterator.next();
String localName = bodyElement.getLocalName();
System.out.println(localName);
TIA
Nick