Search...
FAQs
Subscribe
Pie
FAQs
Recent topics
Flagged topics
Hot topics
Best topics
Search...
Search within Web Services
Search Coderanch
Advance search
Google search
Register / Login
Post Reply
Bookmark Topic
Watch Topic
New Topic
programming forums
Java
Mobile
Certification
Databases
Caching
Books
Engineering
Micro Controllers
OS
Languages
Paradigms
IDEs
Build Tools
Frameworks
Application Servers
Open Source
This Site
Careers
Other
Pie Elite
all forums
this forum made possible by our volunteer staff, including ...
Marshals:
Campbell Ritchie
Jeanne Boyarsky
Ron McLeod
Paul Clapham
Liutauras Vilda
Sheriffs:
paul wheaton
Rob Spoor
Devaka Cooray
Saloon Keepers:
Stephan van Hulst
Tim Holloway
Carey Brown
Frits Walraven
Tim Moores
Bartenders:
Mikalai Zaikin
Forum:
Web Services
AXIS2 mustUnderstand fault
Rodrigo Soto
Greenhorn
Posts: 11
posted 14 years ago
1
Number of slices to send:
Optional 'thank-you' note:
Send
Hi all,
I am trying to send a
soap
message. The problem is that I am getting an Axis fault message as follow:
org.apache.axis2.AxisFault: Must Understand check failed for header http://www.w3.org/2005/08/addressing/ : Action at org.apache.axis2.util.Utils.getInboundFaultFromMessageContext(Utils.java:512) at org.apache.axis2.description.OutInAxisOperationClient.handleResponse(OutInAxisOperation.java:370) at org.apache.axis2.description.OutInAxisOperationClient.send(OutInAxisOperation.java:416) at org.apache.axis2.description.OutInAxisOperationClient.executeImpl(OutInAxisOperation.java:228) at org.apache.axis2.client.OperationClient.execute(OperationClient.java:163) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:548) at org.apache.axis2.client.ServiceClient.sendReceive(ServiceClient.java:528) at com.philips.xmpe.xds.documentsource.producer.Producer.sendXDS(Producer.java:276) at com.philips.xmpe.xds.documentsource.test.TestProducer.main(TestProducer.java:47)
Thank you in advance for your cooperation.
By the way here is the code that I am using to create the message.
public boolean sendXDS(Document xdsDocument, File documentFile) { try{ EndpointReference targetEPR = new EndpointReference(this.xdsSubmissionServer); TransformerFactory transfac = TransformerFactory.newInstance(); Transformer trans = transfac.newTransformer(); trans.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, "no"); trans.setOutputProperty(OutputKeys.INDENT, "yes"); //create string from xml tree StringWriter sw = new StringWriter(); StreamResult result = new StreamResult(sw); DOMSource source = new DOMSource(xdsDocument); trans.transform(source, result); String xmlString = sw.toString(); StAXOMBuilder builder = new StAXOMBuilder(new ByteArrayInputStream(xmlString.getBytes())); //Adding Document File Iterator iter = builder.getDocumentElement().getChildrenWithLocalName("ProvideAndRegisterDocumentSetRequest"); OMElement documentElement = (OMElement) iter.next(); if(documentElement != null){ FileDataSource dataSource = new FileDataSource(documentFile); DataHandler handler = new DataHandler(dataSource); //String file = handler.getContent().toString(); //System.out.println(file); //String fileEncoded = Base64.encode(file.getBytes()); OMFactory messageFactory = OMAbstractFactory.getOMFactory(); OMElement documentChild = messageFactory.createOMElement(new QName("Document")); documentChild.addAttribute("id", "Document01", null); OMText textNode = messageFactory.createOMText(handler, true); documentChild.addChild(textNode); documentElement.insertSiblingAfter(documentChild); System.out.println(); } else { throw new DocumentSourceException("Cannot attach File to document"); } Options options = new Options(); // specify sender options: target, transport protocol, and soap // action options.setTo(targetEPR); options.setTransportInProtocol(Constants.TRANSPORT_HTTP); options.setAction("urn:ihe:iti:2007:ProvideAndRegisterDocumentSet"); //options.setAction(this.xdsSubmissionServer); options.setProperty(Constants.Configuration.ENABLE_MTOM, Constants.VALUE_TRUE); options.setSoapVersionURI(org.apache.axiom.soap.SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI); ServiceClient sender = new ServiceClient(); sender.setOptions(options); OMFactory fac = OMAbstractFactory.getSOAP12Factory(); OMNamespace wsa = fac.createOMNamespace("http://www.w3.org/2005/08/addressing/", "wsa"); SOAP12Factory factory = (SOAP12Factory) OMAbstractFactory.getSOAP12Factory(); SOAPHeaderBlock to = factory.createSOAPHeaderBlock("To", wsa); to.setText(this.xdsSubmissionServer); SOAPHeaderBlock messageID = factory.createSOAPHeaderBlock("MessageID", wsa); messageID.setText("urn:uuid:806D8FD2D542EDCC2C1199332890651"); SOAPHeaderBlock action = factory.createSOAPHeaderBlock("Action", wsa); action.addAttribute("mustUnderstand", "true", OMAbstractFactory.getSOAP12Factory().getNamespace()); action.setText("urn:ihe:iti:2007:ProvideAndRegisterDocumentSet"); sender.addHeader(to); sender.addHeader(messageID); sender.addHeader(action); OMElement response = sender.sendReceive(builder.getDocumentElement()); //print out the response StringWriter writer = new StringWriter(); response.serialize(XMLOutputFactory.newInstance().createXMLStreamWriter(writer)); writer.flush(); System.out.println(writer.toString()); }catch(Exception e){ e.printStackTrace(); return false; } return true; }
Are you here to take over the surface world? Because this tiny ad will stop you!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
reply
Bookmark Topic
Watch Topic
New Topic
Boost this thread!
Similar Threads
org.apache.axis2.AxisFault exception - Operation not Found
Add complex type to axis2 sample code
How to improve the performance of web service
AXIS2 Axis fault SOAPEnvelope must contain a body element
Axis2 Rampart client configuration
More...