SOAP communication error. Lack of XML tag ending character

Asked

Viewed 664 times

7

It took me a while to implement communication with Webservices SOAP in legacy applications written in Delphi 6. The Webservices I needed to communicate with these systems were written in Delphi (newer versions with Unicode) and C# (asax).

Unfortunately it was not possible to use the Webservices palette components of Delphi 6, but I was able to copy all Unit’s from the Webservices palette of Delphi 7 and added in Delphi 6. I had to make several adjustments.

The communication has worked well. Problems with the communication of the systems with the Webservices made available at C#.

A same process carried out in several clients works without problems, however, this same process, has presented problems in 2 or three customers. This communication is with a Webservice written with Delphi (in newer versions).

The error I believe to be specific. In a certain request the following exception is thrown:

Mensagem de erro

It says that it was not possible to find the character ending / determines the closing of a tag.
The message says the error is on line 2 of the request.

So, I soon tried to analyze the XML that is being generated:

<?xml version="1.0"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:SOAP ENV="http://schemas.xmlsoap.org/soap/envelope/">
    <SOAP-ENV:Header xmlns:NS1="urn:UntSecurityHeader" SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
        <NS1:TSecurityHeader xsi:type="NS1:TSecurityHeader">
            <Identification xsi:type="xsd:string">2C0463C3BFC0DC44385BA3</Identification>
        </NS1:TSecurityHeader>
    </SOAP-ENV:Header>
<SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<NS2:Obter xmlns:NS2="urn:UntContracts-IContainerContract">
    <ContainerID xsi:type="xsd:int">0</ContainerID>
    <ContratoID xsi:type="xsd:int">0</ContratoID>
</NS2:Obter>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

This XML, opened by the notepad, copied and pasted here is exactly like this:

<?xml version="1.0"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"><SOAP-ENV:Header SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" xmlns:NS1="urn:UntSecurityHeader"><NS1:TSecurityHeader xsi:type="NS1:TSecurityHeader"><Identification xsi:type="xsd:string">2C0463C3BFC0DC44385BA3</Identification></NS1:TSecurityHeader></SOAP-ENV:Header><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"><NS2:Obter xmlns:NS2="urn:UntContracts-IContainerContract"><ContainerID xsi:type="xsd:int">0</ContainerID><ContratoID xsi:type="xsd:int">0</ContratoID></NS2:Obter></SOAP-ENV:Body></SOAP-ENV:Envelope>

I mean, all in one line.
Opened by IE, is presented like this:

XML conforme apresentado no IE

I know the image was very small, but I wanted to put it here to appear exactly as it is in IE.

By zooming in the browser you can clearly see the content.

I decided to put this image to demonstrate that it is exactly in the second line that IE breaks the text in two lines. I don’t know if there is or if the break refers only to formatting the browser not to exceed the size of the document.

Another detail I would like to add is that when working with Webservice made in Delphi I usually have problems with accentuation, anyway, special characters.
Already with the Webservices in C# this does not occur.

Both conjuncts of Webservice were written and published by me.

I tried to manipulate XML by removing line break characters, by performing replace #13#10, thinking that it could be an interpretation problem between character sets. But it did not solve either.

Rebound that in just a few customers, with Windows XP to Seven systems, the problem occurs.

Can these be problems of character types? The strange thing is not having this kind of problem with the Webservices written in C#.

1 answer

1

I may be wrong, but something tells me that the error has to do with how XML is interpreted by SOAP since on most machines it works and only some do not. Try updating the protocol on the machines where it does not work. I believe this is the latest version : http://www.microsoft.com/en-us/download/details.aspx?id=15697

Browser other questions tagged

You are not signed in. Login or sign up in order to post.