cancel
Showing results for 
Search instead for 
Did you mean: 

Could not parse XMBMessage due to Can't parse the document

Former Member
0 Kudos

*Dear all,*

*i have a SOAP to RFC Scenario. XML Validation by Adapter is turned on in SenderAgreement.*

*XSD Files are placed in the correct directory. Incoming requests are validated. However,*

*it seems that responses produce an error in the soap adapter.*

*This is the error message i am getting:*

+SOAP:Fault>+

+<faultcode>SOAP:Server</faultcode>+

+<faultstring>Server Error</faultstring>+

+<detail>+

+<s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">+

+<context>XIAdapter</context>+

+<code>ADAPTER.JAVA_EXCEPTION</code>+

+<text>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessagingException: Could not parse XMBMessage due to Can't parse the document+

+ at com.sap.aii.adapter.soap.ejb.XISOAPAdapterBean.process(XISOAPAdapterBean.java:1173)+

+ at sun.reflect.GeneratedMethodAccessor678.invoke(Unknown Source)+

+ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)+

+ at java.lang.reflect.Method.invoke(Method.java:592)....+

*In SXMB_MONI my response includes the following passages*

+- <!-- ************************************+

-->

+<Trace level="3" type="T">Pipeline Service = PLSRV_XML_VALIDATION_RS_OUT</Trace>+

+<Trace level="3" type="T">Skip Inbound Validation =</Trace>+

+<Trace level="3" type="T">Skip Outbound Validation =</Trace>+

+<Trace level="3" type="T">Area = XML_VALIDATION_OUT</Trace>+

+<Trace level="1" type="T">Reading sender agreement</Trace>+

+<Trace level="3" type="T">Validation Mode = Validation by Adapter</Trace>+

+<Trace level="1" type="T">Outbound validation of response takes place</Trace>+

+<Trace level="3" type="T">Interface Name = SI_xxx_xxx_xxx_Sync_Outbound</Trace>+

+<Trace level="3" type="T">Interface Namespace = http://xxx.de/xxx</Trace>+

+<Trace level="3" type="T">Software Component Version = D390B9E10A6B11DF8C15C7540A484C06</Trace>+

+<Trace level="2" type="T">Java Validation Service Call</Trace>+

+<Trace level="1" type="T">System error occurred during XML validation</Trace>+

+<Trace level="1" type="E">CL_XMS_PLSRV_VALIDATION~ENTER_PLSRV</Trace>+

+</Trace>+

+<Trace level="1" type="B" name="CL_XMS_MAIN-WRITE_MESSAGE_TO_PERSIST" />+

+- <!-- ************************************+

-->

+<Trace level="3" type="T">Persisting message Status = 023</Trace>+

+<Trace level="3" type="T">Message version 009</Trace>+

+<Trace level="3" type="T">Pipeline CENTRAL</Trace>+

+</SAP:Trace>+

*I see the following error message:*

+<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>+

+- <!-- Aufruf eines Adapters+

-->

- <SAP:Error SOAP:mustUnderstand="1" xmlns:SAP="http://sap.com/xi/XI/Message/30" xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">

<SAP:Category>XIServer</SAP:Category>

<SAP:Code area="XML_VALIDATION_OUT">CX_XMS_SYSERR_VALIDATION</SAP:Code>

<SAP:P1>Schema xxx.response.xsd not found in J:\usr\sap\xxx\SYS\global\xi\runtime_server\validation\schema\00000000000000000000000000000000\ u00D3u00B9u00E1 k u00DFŒ u00C7T HL \SI_xxx_xxx_xxx_Sync_Outbound\urnsap-comdocumentsaprfc~functions\xxx.response.xsd (J:\usr\sap\xxx\SYS\global\xi\runtime_server\validation\schema)</SAP:P1>

<SAP:P2 />

<SAP:P3 />

<SAP:P4 />

<SAP:AdditionalText>not used at the moment.</SAP:AdditionalText>

<SAP:Stack>System error occurred during XML validation</SAP:Stack>

<SAP:Retry>M</SAP:Retry>

</SAP:Error>

There seems to be an error in the adapter trying to validate the response. Does anyone has a clue as to why ?

Accepted Solutions (1)

Accepted Solutions (1)

former_member854360
Active Contributor
0 Kudos

Hi,

<SAP:P1>Schema Z_HE_FREIGABE_KASSE.response.xsd not found in

your error message clearly indicate that XSD not fond in the specified path

J:usrsapxxxSYSglobalxi
untime_servervalidationschema 0000000000000000000000000000000 Ӑ¹á k ߌ ÇT HL SI_xxx_xxx_xxx_Sync_Outboundurn~sap-com~document~sap~rfc~functionsxxx.response.xsd

Please make sure that it is available

Also see the doc for details

http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d026d253-3108-2c10-69a0-a5460fc1f...

Expand the Schema folder in RHS. Select the relevant SCW and Interface Name.
<SAP installation directory>/<system id>/<instance number>/j2ee/cluster/server0/validation/schema/<GUID of software component version to which Service Interface is assigned>/<Repository Namespace of Service Interface>
It is to be noted that the folder where exported schema needs to be saved (i.e. RHS) the folder should be like urn~VisaDetailsUpdateRequest

Former Member
0 Kudos

Hi,

but

- validation by integration engine is not activated. In sender agreement, only validation by adapter is activated. The folder

mentioned is used for validation by integration engine, or isn't it ? (According to [SAP Help|http://help.sap.com/saphelp_nwpi71/helpdata/en/44/23641dc2b36491e10000000a1553f7/content.htm] it is.) Also, the path contains cryptic characters, which can not be right.

<Trace level="3" type="T">Pipeline Service = PLSRV_XML_VALIDATION_RS_OUT</Trace> 
  <Trace level="3" type="T">Skip Inbound Validation =</Trace> 
  <Trace level="3" type="T">Skip Outbound Validation =</Trace> 
  <Trace level="3" type="T">Area = XML_VALIDATION_OUT</Trace> 
  <Trace level="1" type="T">Reading sender agreement</Trace> 
  <Trace level="3" type="T">Validation Mode = Validation by Adapter</Trace> 
  <Trace level="1" type="T">Outbound validation of response takes place</Trace> 
  <Trace level="3" type="T">Interface Name = SI_xxx_xxx_xxx_Sync_Outbound</Trace> 
  <Trace level="3" type="T">Interface Namespace = <a href="http://xxx" TARGET="test_blank">http://xxx</a></Trace> 
  <Trace level="3" type="T">Software Component Version = D390B9E10A6B11DF8C15C7540A484C06</Trace> 
  <Trace level="2" type="T">Java Validation Service Call</Trace> 
  <Trace level="1" type="T">System error occurred during XML validation</Trace> 
  <Trace level="1" type="E">CL_XMS_PLSRV_VALIDATION~ENTER_PLSRV</Trace>

The file as mentioned is inside the same directory as the file for validating requests.

My requests are getting validated, see example for request:

<faultcode>SOAP:Server</faultcode>
         <faultstring>Server Error</faultstring>
         <detail>
            <s:SystemError xmlns:s="http://sap.com/xi/WebService/xi2.0">
               <context>XIAdapter</context>
               <code>ADAPTER.JAVA_EXCEPTION</code>
               <text>com.sap.engine.interfaces.messaging.api.exception.MessagingException: com.sap.engine.interfaces.messaging.api.exception.MessageFormatException: XML Validation for payload with root element name xxx, target namespace urn:sap-com:document:sap:rfc:functions Failed!Errors Encountered During Parsing 
1.cvc-minLength-valid: Value '123456789' with length = '9' is not facet-valid with respect to minLength '10' for type 'null'.
2.cvc-type.3.1.3: The value '123456789' of element 'xxx' is not valid.

former_member854360
Active Contributor
0 Kudos

Hi Jan;

i guess its a synchronus interface and has both request and response.

It is searching for response XSD for validation.

Schema xxx.response.xsd not found in

So please upload both the request and resonse XSD in the folder

Former Member
0 Kudos

Hi,

you are right. It is a synchronous interface. Unfortunately, also the response.xsd is already in that folder.

former_member854360
Active Contributor
0 Kudos

i think you are getting some error response which is not matching with your SOAP adapter response structure.

So its failing in Validation.........

Have you maintained any Fault message in the synchronus interface? If you maintain fault message then it will not be validated.

If you dont maintain any fault message in the interface then it will throw error in validation in case of any fault generated.

In the synchronous scenario or using an adapter that can handle synchronous messages (e.g. HTTP and SOAP adapters), when a validation error occurs, the error message will be returned to the sender. In the case of asynchronous scenarios (e.g. file adapter), the error message will be logged to the SXI_MONITOR when the validation is done in the Integration Server or to the Runtime Workbench (RWB) when the validation is done in the Adapter Engine. In both cases, the messaging will be terminated with error.

Former Member
0 Kudos

Hi,

my service interface has the following settings:

Category: Outbound

Interface Pattern: Stateless (XI30compatible)

It has Request, Response and Fault messages, each with external definition.

It is ok for me if fault messages will not be validated. However, this applies to fault messages receveid from the receiver adapter. The receiver adapter however sends a correct response which i can see in sxmb_moni. I think, like you do, that the soap adapter can not parse the response coming from the receiver adapter.

former_member854360
Active Contributor
0 Kudos

Hi Jan,

First disable the validation and check first that your response from RFC is successfully processed by the SOAP adapter or not.

Are you using any response mapping?

Former Member
0 Kudos

Hi,

if i turn off "adapter validation", the response is coming through with no error:

<SOAP:Envelope xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP:Header/>
   <SOAP:Body>
      <ns0:Z_xxx.Response xmlns:ns0="urn:sap-com:document:sap:rfc:functions">
         <ET_MESSAGES/>
      </ns0:Z_xxx.Response>
   </SOAP:Body>
</SOAP:Envelope>

Yes, i am using a mapping for the response message to convert from imported RFC message to external definition.

Former Member
0 Kudos

Since i cannot get i running, i helped myself using a java mapping, that i packaged into a jar

along with the xsd files. See code below:


import com.sap.aii.*;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.BufferedReader;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;

import java.io.InputStreamReader;
import java.io.Reader;

import javax.xml.transform.sax.SAXResult;
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;
import javax.xml.validation.Validator;

import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

@SuppressWarnings("unused")
public class CustomValidator extends AbstractTransformation {

	public void transform(TransformationInput arg0, TransformationOutput arg1)
			throws StreamTransformationException {
		Validator validator;
		InputStreamReader insr;
		String inputPayloadString;
		try {

			// Trace
			getTrace().addInfo("com.xxx.pi.mapping.validation.CustomValidator called");

			InputStream inputPayloadStream = arg0.getInputPayload()
					.getInputStream();
			insr = new InputStreamReader(inputPayloadStream);
	
			InputHeader inpHeader = arg0.getInputHeader();		

			String intfName = inpHeader.getInterface();
			
			getTrace().addInfo("Interface Name is :" + intfName);
			
			String xsdName = "";
			if (intfName
					.equalsIgnoreCase("SI_xxx_Sync_Outbound")) {
				xsdName = "Z_xxx.xsd";
			}
			if (intfName.equalsIgnoreCase("SI_xxx")) {
				xsdName = "Z_xxx.xsd";
			}
			if (intfName
					.equalsIgnoreCase("SI_xxx_Sync_Outbound")) {
				xsdName = "Z_xxx.xsd";
			}
			if (intfName
					.equalsIgnoreCase("SI_xxxx_Sync_Outbound")) {
				xsdName = "Z_xxx.xsd";
			}
			
			getTrace().addInfo("Using schema: " + xsdName);

			if (xsdName.equals(""))
				throw new StreamTransformationException("Schema für "
						+ intfName + " nicht gefunden.");

			BufferedReader reader = new BufferedReader(new InputStreamReader(
					getClass().getResourceAsStream(
							"/com/xxx/pi/mapping/xsd/" + xsdName)));

			// prepare document validator:
			String schemaLang = "http://www.w3.org/2001/XMLSchema";
			SchemaFactory jaxp = SchemaFactory.newInstance(schemaLang);
			Schema schema = jaxp.newSchema(new StreamSource(reader));

			validator = schema.newValidator();

		} catch (SAXException saxe) {
			throw new StreamTransformationException(saxe.getMessage());
		}

		// validate
		try {

			SAXSource source = new SAXSource(new InputSource(insr));
			validator.validate(source);
		} catch (Exception e) {
			getTrace().addInfo(e.getMessage());
			String trace = e.getMessage();
			throw new StreamTransformationException(trace, e.getCause());
		}
		// Write the response
		try {
			inputPayloadString = convertStreamToString(arg0.getInputPayload()
					.getInputStream());

			arg1.getOutputPayload().getOutputStream()
					.write(inputPayloadString.getBytes("UTF-8"));
			
			getTrace().addInfo("Schema Validierung erfolgreich !");
		} catch (Exception e) {
			throw new StreamTransformationException(e.getMessage());
		}

	}
	
	
	// helper to convert to String
	private static String convertStreamToString(InputStream in) {
		StringBuffer sb = new StringBuffer();
		try {
			InputStreamReader isr = new InputStreamReader(in);
			BufferedReader reader = new BufferedReader(isr);

			String line;
			while ((line = reader.readLine()) != null) {
				sb.append(line);
			}

		}

		catch (Exception exception) {
		}
		return sb.toString();
	}

Answers (0)