Hi.

I've trying to construct a SOAP mesg and this is the exception I'm getting. I've tried everything short of standing on my head and the error just refuses to go away. Any hint as to what I'm doing wrong would be appreciated.

The Document seems to be picked up and parsed correctly, but the content obviously isn't acceptable... HELP!

Exception in thread "main" javax.xml.soap.SOAPException: Unable to get header stream in saveChanges: SOAP exception while trying to externalize: Unable to create envelope from given source: com.sun.xml.messaging.saaj.soap.dom4j.ElementImpl
    at com.sun.xml.messaging.saaj.soap.MessageImpl.saveChanges(MessageImpl.java:358)
    at com.sun.xml.messaging.saaj.soap.MessageImpl.writeTo(MessageImpl.java:399)
    at in.bitfish.protocoltranslator.TestSOAP.main(TestSOAP.java:218)

code snippet:

            Document docEnv = builder.parse("file:///Envelope.xml");

            SOAPMessage mesg = new MessageFactoryImpl().createMessage();
            mesg.writeTo(System.out);
           
            MimeHeaders mimeHeaders = mesg.getMimeHeaders();
            mimeHeaders.addHeader ( "SOAPAction", "OTA" );
            mesg.writeTo(System.out);
           
            SOAPPart part = mesg.getSOAPPart();
            part.setContent( new DOMSource( docEnv ));
            System.out.println(part);
            mesg.writeTo(System.out);
           
Envelope.xml:

<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV=" http://schemas.xmlsoap.org/soap/envelope/" xmlns:eb="http://www.ebxml.org/namespaces/messageHeader" xmlns:xlink=" http://www.w3.org/1999/xlink" xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Header>
        <eb:MessageHeader SOAP-ENV:mustUnderstand="1" eb:version=" 1.0">
            <eb:ConversationId>
                [EMAIL PROTECTED]
            </eb:ConversationId>
         </eb:MessageHeader>
    </SOAP-ENV:Header>
    <SOAP-ENV:Body>
        <eb:Manifest SOAP-ENV:mustUnderstand="1" eb:version="1.0">
            <eb:Reference xlink:href="" xlink:type="simple" xmlns:xlink=" http://www.w3.org/1999/xlink">
            </eb:Reference>
        </eb:Manifest>
    </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

Reply via email to