none
system.xml.xmlexception CDATA elements not valid at top level of an XML document. Line 1, position 3 RRS feed

  • Question

  • Hi All,

    I am receiving below error while calling WCF-Service, and I am using wcf-custom adapter.and transfered mode property is set to buffered .

    CData elements not valid at top level of an XML document. Line 1, position 3. Stack Trace: at System.Xml.XmlExceptionHelper.ThrowXmlException(XmlDictionaryReader reader, XmlException exception) at System.Xml.XmlUTF8TextReader.Read() at System.Xml.XmlBaseReader.MoveToContent() at Microsoft.IdentityModel.Protocols.WSFederation.WSFederationSerializer..ctor(XmlDictionaryReader reader) at Microsoft.IdentityModel.Web.WSFederationAuthenticationModule.CreateSerializerForResultXml(String resultXml) at Microsoft.IdentityModel.Web.WSFederationAuthenticationModule.GetXmlTokenFromMessage(SignInResponseMessage message) at Microsoft.IdentityModel.Web.WSFederationAuthenticationModule.GetSecurityToken(SignInResponseMessage message) at Microsoft.IdentityModel.Web.WSFederationAuthenticationModule.SignInWithResponseMessage(HttpRequest request) at Microsoft.IdentityModel.Web.WSFederationAuthenticationModule.OnAuthenticateRequest(Object sender, EventArgs args) at System.Web.HttpApplication.SyncEventExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

    When I reprocess the file it went fine , but don't know sometime throwing this error, do I need to change any specfic settings for this.

    Thanks

    Friday, September 23, 2016 9:58 AM

Answers

  • That's the point, the issue is intermittent and you/the STS endpoint owner will have to debug this with the help of WCF traces. Some responses from the WS-Fed endpoint is causing this - next step is to figure out why. Basically the BizTalk SendPort is failing to parse some of the responses(ClaimSets) being sent by the STS/WS-Fed endpoint  (the issuer address in the binding config).

    Another tool in addition to WCF traces that will help you is WIF tracing.


    Thanks Arindam



    Friday, September 23, 2016 12:51 PM
    Moderator
  • Hi

    You need to set both the WCF (and optionally WIF) tracing in the BizTalk config file (BTSNTSvc.exe.config, or BTSNTSvc64.exe.config file in the BizTalk installation folder depending on bitness of the Send Host Instance).

    You can find more on that here-

    https://msdn.microsoft.com/en-us/library/cc185440(v=bts.10).aspx

    Note that you don't have to install anything to set this up. The logs will get generated in the path you specify in the config, and you can then open them up using the Service Trace Viewer Tool that ships with .NET. You will find many resources online on how to use this tool.


    Thanks Arindam





    Friday, September 23, 2016 2:26 PM
    Moderator

All replies

  • Hi,

    It shows that your request message has some error. 

    Please use the same message and try to call the service from SOAP UI and see whether you are able to call the service or not?

    It will be better if you will ask your service owner a working request message, so you can compare your message and find out what mistake you are doing here.

    Regards

    Abhay Giri

    mark this as Answered if this reply provided your answer

    Friday, September 23, 2016 10:26 AM
  • Hi Giri,

    If I reprocess the same xml then it will process with out any issues.

    also I have compared with failed xml and xml which sent sucess but no difference.

    Thanks

    Friday, September 23, 2016 11:31 AM
  • Hi Biztalk1234,

    Please validate the xmlmessage that you are sending against the xsd of the message. I believe you will find difference.

    Regards,


    Mandar Dharmadhikari

    Friday, September 23, 2016 11:33 AM
  • Hi

    When you say reprocess, does resuming the suspended instance work?

    If yes, I think it is an auth issue with the WS-Fed endpoint. Maybe you need to check with the service owner of the STS/WS-Fed service you are using for auth.


    Thanks Arindam

    Friday, September 23, 2016 11:33 AM
    Moderator
  • Hi Mandar,

    Ok , when I validate the message I got some warnings.but I when I reprocess the same file again then why it is processing without issues.

    Thanks

    Friday, September 23, 2016 12:05 PM
  • Not resuming..

    I am dropping the same file it is sending successfully sent to oracle so same file same xml when I reprocess it is good.

    Thanks

    Friday, September 23, 2016 12:06 PM
  • What are the warnings....

    Mandar Dharmadhikari

    Friday, September 23, 2016 12:13 PM
  • It is saying element is invalid...Also I just checked this is not only for the xml which is failed it is coming for all files(XML) same kind of warning when i am validating..

    Thnaks

    Friday, September 23, 2016 12:19 PM
  • What is the SendPort adapter? What are the bindings?

    Thanks Arindam

    Friday, September 23, 2016 12:19 PM
    Moderator
  • WCF-Custom adapter and web http binding...

    Thanks

    Friday, September 23, 2016 12:21 PM
  • As I mentioned earlier, I think it is an auth issue with the WS-Fed endpoint (the issuer address in the binding config). You need to check with the service owner of the STS/WS-Fed service you are using for auth on the SendPort.

    You can collect WCF traces and share it with the service owner of the WS-Fed endpoint/service - enable both Tracing and Message Logging. It is likely that they are sending some invalid characters in the ClaimSet that is causing the process of parsing the claims to fail on the SendPort.


    Thanks Arindam




    Friday, September 23, 2016 12:37 PM
    Moderator
  • If it is an auth issue I am getting different error.

    But why this is processing successfully 2nd time when I reprocess where I am using same auth no change here.

    Thanks

    Friday, September 23, 2016 12:41 PM
  • That's the point, the issue is intermittent and you/the STS endpoint owner will have to debug this with the help of WCF traces. Some responses from the WS-Fed endpoint is causing this - next step is to figure out why. Basically the BizTalk SendPort is failing to parse some of the responses(ClaimSets) being sent by the STS/WS-Fed endpoint  (the issuer address in the binding config).

    Another tool in addition to WCF traces that will help you is WIF tracing.


    Thanks Arindam



    Friday, September 23, 2016 12:51 PM
    Moderator
  • Ok I agree with you..!

    Can you please tell me how to enable traces on WCF adapter .also we are not sure if this issue is reproducible when traces is on.... also not sure whether client agree for installing some trace tools in prod...

    Thanks

    Friday, September 23, 2016 2:18 PM
  • Hi

    You need to set both the WCF (and optionally WIF) tracing in the BizTalk config file (BTSNTSvc.exe.config, or BTSNTSvc64.exe.config file in the BizTalk installation folder depending on bitness of the Send Host Instance).

    You can find more on that here-

    https://msdn.microsoft.com/en-us/library/cc185440(v=bts.10).aspx

    Note that you don't have to install anything to set this up. The logs will get generated in the path you specify in the config, and you can then open them up using the Service Trace Viewer Tool that ships with .NET. You will find many resources online on how to use this tool.


    Thanks Arindam





    Friday, September 23, 2016 2:26 PM
    Moderator
  • Ok Arindam, Thank you .

    Here main challenge is we don't know when this issue will be reproduced.

    Friday, September 23, 2016 2:32 PM
  • I know, such issues are difficult to track down.

    You may also want to watch out for the WCF trace file size, as it can get big. One option is to use a custom XmlWriterTraceListener  instead of the default XmlWriterTraceListener.


    Thanks Arindam

    Friday, September 23, 2016 2:38 PM
    Moderator