|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
The root element is required in a well-formed document |
« View previous topic :: View next topic » |
Author |
Message
|
tariqjawed83 |
Posted: Sun Dec 20, 2009 6:02 pm Post subject: The root element is required in a well-formed document |
|
|
Newbie
Joined: 24 Nov 2009 Posts: 6
|
I'm creating SOAP Message from Scratch, but after creating it when I pass the message to SoapReply Node, it gives this error
The root element is required in a well-formed document
This is the message which is formed
Code: |
Message
Properties
MessageSet:CHARACTER:ESPN_WSDL
MessageType:CHARACTER:
MessageFormat:CHARACTER:
Encoding:INTEGER:273
CodedCharSetId:INTEGER:1208
Transactional:BOOLEAN:false
Persistence:BOOLEAN:false
CreationTime:TIMESTAMP:java.util.GregorianCalendar[time=1261380478743,
areFieldsSet=true,areAllFieldsSet=false,lenient=true,
zone=sun.util.calendar.ZoneInfo[id="America/Chicago",
offset=-21600000,dstSavings=3600000,useDaylight=true,
transitions=235,
lastRule=java.util.SimpleTimeZone[id=America/Chicago,
offset=-21600000,dstSavings=3600000,useDaylight=true,
startYear=0,startMode=3,startMonth=2,startDay=8,
startDayOfWeek=1,startTime=7200000,
startTimeMode=0,endMode=3,endMonth=10,endDay=1,
endDayOfWeek=1,endTime=7200000,endTimeMode=0]],
firstDayOfWeek=1,minimalDaysInFirstWeek=1,
ERA=?,YEAR=2009,MONTH=11,WEEK_OF_YEAR=?,
WEEK_OF_MONTH=?,DAY_OF_MONTH=21,DAY_OF_YEAR=?,
DAY_OF_WEEK=?,DAY_OF_WEEK_IN_MONTH=?,AM_PM=0,HOUR=1,
HOUR_OF_DAY=1,MINUTE=27,SECOND=58,
MILLISECOND=743,ZONE_OFFSET=?,DST_OFFSET=?]
ExpirationTime:INTEGER:-1
Priority:INTEGER:0
ReplyIdentifier:BLOB:[B@15a415a4
ReplyProtocol:CHARACTER:SOAP-AXIS2
Topic:UNKNOWN:null
ContentType:CHARACTER:text/xml
IdentitySourceType:CHARACTER:
IdentitySourceToken:CHARACTER:
IdentitySourcePassword:CHARACTER:
IdentitySourceIssuedBy:CHARACTER:
IdentityMappedType:CHARACTER:
IdentityMappedToken:CHARACTER:
IdentityMappedPassword:CHARACTER:
IdentityMappedIssuedBy:CHARACTER:
HTTPResponseHeader
X-Original-HTTP-Status-Line:CHARACTER:HTTP/1.1 200 OK
X-Original-HTTP-Status-Code:INTEGER:200
Content-Type:CHARACTER:text/xml; charset=utf-8
SOAP
Context
operation:CHARACTER:RXESPNUpdateOperation
operationType:CHARACTER:REQUEST_RESPONSE
portType:CHARACTER:RXESPNUpdatePort
portTypeNamespace:CHARACTER:http://www.RXESPNUpdate.RC105R.com
port:CHARACTER:RXESPNUpdatePort
service:CHARACTER:RXESPNUpdateService
SOAP_Version:CHARACTER:1.1
Namespace
s:CHARACTER:http://schemas.xmlsoap.org/soap/envelope/
Header
Body
xsi:CHARACTER:http://www.w3.org/2001/XMLSchema-instance
xsd:CHARACTER:http://www.w3.org/2001/XMLSchema
RXESPNUpdateOperationResponse
xmlns:CHARACTER:http://www.RXESPNUpdate.RC105R.Response.com
output_message
cf_shipment_id:DECIMAL:3213
cf_facility_id:DECIMAL:3312
store_nbr:DECIMAL:55640
update_status:INTEGER:9311
status_txt:CHARACTER:Unable to Update or Communicate with SAPS
vndr_shpmt_id:CHARACTER:2331
|
and this is the error I'm having
Code: |
RecoverableException
File:CHARACTER:/build/S610_P/src/WebServices/WSLibrary/ImbSOAPReplyNode.cpp
Line:INTEGER:711
Function:CHARACTER:ImbSOAPReplyNode::evaluate
Type:CHARACTER:
Name:CHARACTER:
Label:CHARACTER:
Catalog:CHARACTER:BIPv610
Severity:INTEGER:3
Number:INTEGER:3701
Text:CHARACTER:Error Making SOAP JNI Call: Axis2Invoker_sendReplyDataOverHTTPNonSoap
Insert
Type:INTEGER:5
Text:CHARACTER:Axis2Invoker_sendReplyDataOverHTTPNonSoap
Insert
Type:INTEGER:5
Text:CHARACTER:org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: The root element is required in a well-formed document.
Insert
Type:INTEGER:5
Text:CHARACTER:Frame : 0 org.apache.axiom.om.OMException: javax.xml.stream.XMLStreamException: The root element is required in a well-formed document.| @: org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:249)| @: org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:132)| @: org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:411)| @: com.ibm.broker.axis2.SoapUtilities.wrapDataInSoapEnvelopeIfRequiredAvoidingAxis2(SoapUtilities.java:1667)| @: com.ibm.broker.axis2.Axis2Invoker.sendReplyDataOverHTTPNonSoap(Axis2Invoker.java:650)| @: com.ibm.broker.plugin.MbOutputTerminal._propagate(Native Method)| @: com.ibm.broker.plugin.MbOutputTerminal.propagate(MbOutputTerminal.java:103)| @: EspnStoreForward_JComputeErrors.evaluate(EspnStoreForward_JComputeErrors.java:75)| @: com.ibm.broker.javacompute.MbRuntimeJavaComputeNode.evaluate(MbRuntimeJavaComputeNode.java:179)| @: com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1434)|Frame : 1 javax.xml.stream.XMLStreamException: The root element is required in a well-formed document.| @: com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwXMLStreamException(StAXMessageProvider.java:68)| @: com.ibm.xml.xlxp.api.stax.XMLStreamReaderImpl.next(XMLStreamReaderImpl.java:535)| @: com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl$XMLStreamReaderProxy.next(XMLInputFactoryImpl.java:173)| @: org.apache.axiom.om.impl.builder.StAXOMBuilder.parserNext(StAXOMBuilder.java:506)| @: org.apache.axiom.om.impl.builder.StAXOMBuilder.next(StAXOMBuilder.java:161)| @: org.apache.axiom.om.impl.llom.OMDocumentImpl.getOMDocumentElement(OMDocumentImpl.java:132)| @: org.apache.axiom.om.impl.builder.StAXOMBuilder.getDocumentElement(StAXOMBuilder.java:411)| @: com.ibm.broker.axis2.SoapUtilities.wrapDataInSoapEnvelopeIfRequiredAvoidingAxis2(SoapUtilities.java:1667)| @: com.ibm.broker.axis2.Axis2Invoker.sendReplyDataOverHTTPNonSoap(Axis2Invoker.java:650)| @: com.ibm.broker.plugin.MbOutputTerminal._propagate(Native Method)| @: com.ibm.broker.plugin.MbOutputTerminal.propagate(MbOutputTerminal.java:103)| @: EspnStoreForward_JComputeErrors.evaluate(EspnStoreForward_JComputeErrors.java:75)| @: com.ibm.broker.javacompute.MbRuntimeJavaComputeNode.evaluate(MbRuntimeJavaComputeNode.java:179)| @: com.ibm.broker.plugin.MbNode.evaluate(MbNode.java:1434)
|
and this is the code I'm using, Java Compute Node
Code: |
MbOutputTerminal out = getOutputTerminal("out");
MbOutputTerminal alt = getOutputTerminal("alternate");
MbMessage inMessage = assembly.getMessage();
// create new message
MbMessage outMessage = new MbMessage();
MbMessageAssembly outAssembly = new MbMessageAssembly(assembly,
assembly.getLocalEnvironment(),
new MbMessage(),
outMessage);
try {
String storeNbr = inMessage.getRootElement().getFirstElementByPath("/SOAP/Body/RXESPNUpdateOperation/input_message/store_nbr").getValue().toString();
String cfShipmentId = inMessage.getRootElement().getFirstElementByPath("/SOAP/Body/RXESPNUpdateOperation/input_message/cf_shipment_id").getValue().toString();
String cfFacilityId = inMessage.getRootElement().getFirstElementByPath("/SOAP/Body/RXESPNUpdateOperation/input_message/cf_facility_id").getValue().toString();
String vndrShpmtId = inMessage.getRootElement().getFirstElementByPath("/SOAP/Body/RXESPNUpdateOperation/input_message/vndr_shpmt_id").getValue().toString();
MbElement root = outMessage.getRootElement();
MbElement msgProps = inMessage.getRootElement().getFirstElementByPath("/Properties").copy();
root.addAsFirstChild(msgProps);
MbElement httpResHdr = root.createElementAsLastChild(MbElement.TYPE_NAME, "HTTPResponseHeader", null);
httpResHdr.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "X-Original-HTTP-Status-Line", "HTTP/1.1 200 OK");
httpResHdr.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "X-Original-HTTP-Status-Code", 200);
httpResHdr.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "Content-Type", "text/xml; charset=utf-8");
MbElement soapEl = root.createElementAsLastChild(MbElement.TYPE_NAME, "SOAP", null);
MbElement soapCtx = soapEl.createElementAsLastChild(MbElement.TYPE_NAME, "Context", null);
soapCtx.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "operation", "RXESPNUpdateOperation");
soapCtx.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "operationType", "REQUEST_RESPONSE");
soapCtx.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "portType", "RXESPNUpdatePort");
soapCtx.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "portTypeNamespace", "http://www.RXESPNUpdate.RC105R.com");
soapCtx.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "port", "RXESPNUpdatePort");
soapCtx.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "service", "RXESPNUpdateService");
soapCtx.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "SOAP_Version", "1.1");
MbElement nameSpc = soapCtx.createElementAsLastChild(MbElement.TYPE_NAME, "Namespace", null);
nameSpc.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "s", "http://schemas.xmlsoap.org/soap/envelope/");
MbElement soapHdr = soapEl.createElementAsLastChild(MbElement.TYPE_NAME, "Header", null);
MbElement soapBdy = soapEl.createElementAsLastChild(MbElement.TYPE_NAME, "Body", null);
soapBdy.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "xsi", "http://www.w3.org/2001/XMLSchema-instance");
soapBdy.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "xsd", "http://www.w3.org/2001/XMLSchema");
MbElement firstEl = soapBdy.createElementAsLastChild(MbElement.TYPE_NAME, "RXESPNUpdateOperationResponse", null);
firstEl.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE, "xmlns", "http://www.RXESPNUpdate.RC105R.Response.com");
MbElement secEl = firstEl.createElementAsLastChild(MbElement.TYPE_NAME, "output_message", null);
secEl.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "cf_shipment_id", java.math.BigDecimal.valueOf(Long.parseLong(cfShipmentId)));
secEl.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "cf_facility_id", java.math.BigDecimal.valueOf(Long.parseLong(cfFacilityId)));
secEl.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "store_nbr", java.math.BigDecimal.valueOf(Long.parseLong(storeNbr)));
secEl.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "update_status", 9311);
secEl.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "status_txt", "Unable to Update or Communicate with SAPS");
secEl.createElementAsLastChild(MbElement.TYPE_NAME_VALUE, "vndr_shpmt_id", vndrShpmtId);
outMessage.finalizeMessage(MbMessage.FINALIZE_VALIDATE);
// The following should only be changed
// if not propagating message to the 'out' terminal
out.propagate(outAssembly);
} finally {
// clear the outMessage
outMessage.clearMessage();
} |
any help would be greatly appreciated, stucked on this from quite a while...
[admin]edited for readability[/admin] |
|
Back to top |
|
 |
kimbert |
Posted: Mon Dec 21, 2009 3:13 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Add a Trace node and post the result here. Please use [code] tags around the trace node output to make it readable. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Dec 22, 2009 2:33 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Shouldn't there be an Envelope? |
|
Back to top |
|
 |
mgk |
Posted: Tue Dec 22, 2009 3:01 am Post subject: |
|
|
 Padawan
Joined: 31 Jul 2003 Posts: 1642
|
Quote: |
Shouldn't there be an Envelope? |
No, not with the SOAP Domain, it builds it for you. Like kimbert says, trace node output would be useful here. The error posted makes me suspect that the SOAP domain was not created because the code is wrong; this line:
Code: |
MbElement soapEl = root.createElementAsLastChild(MbElement.TYPE_NAME, "SOAP", null); |
Does not create an owning parser, and should be changed to the method that does like this:
Code: |
MbElement soapEl = root.createElementAsLastChild( "SOAP" ); |
Once the parser has been created, you should be ok...
Regards, _________________ MGK
The postings I make on this site are my own and don't necessarily represent IBM's positions, strategies or opinions. |
|
Back to top |
|
 |
tariqjawed83 |
Posted: Fri Dec 25, 2009 12:09 pm Post subject: Thanks |
|
|
Newbie
Joined: 24 Nov 2009 Posts: 6
|
Thanks guys for your help.
Actually I solved the problem by creating only payload and first element as XMLNSC parser element.
and when the output passed to SOAPReply Node, it takes care of creating the full soap message by embedding envelope and body to the payload itself. |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|
|
|