Why lose xml headers? Xml declaration and xsl instruction

P

Piculo

Hi,

I have a WebServices in ASP.NEt VisualBasic, the declaration of the method
is :
Public Function saveDocumentXML(ByVal pvXmlDocument As Xml.XmlDocument) As
String

And i call to this method with a webreference in this way:
Dim myString as String = myWS.saveDocumentXML(myXMlDocument)

Wherein myXmlDocument is something like this:
<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" href="testlayer24.xsl"?>
<testlayer>
<text1>Text test1</text1>
<text12>Text test12</text12>
<text2>Text test2</text2>
<text22>Text test22</text22>
<text3>Text test3</text3>
<text32>Text test32</text32>
</testlayer>

But in the webservices i receive:
<testlayer xmlns="">
<text1>Text test1</text1>
<text12>Text test12</text12>
<text2>Text test2</text2>
<text22>Text test22</text22>
<text3>Text test3</text3>
<text32>Text test32</text32>
</testlayer>

This means that i ve lost the header of the XML in the WebServices, the
declaration and the Xsl transformation reference.
Anyone knows why? What is wrong?

Thanks,
Pikulo.
 
D

Dino Chiesa [Microsoft]

can you explain what you were trying to do ?
In web services the response is contained in a soap envelope. soap is just
an XML container. the declaration lines which apply once per XML document
will apply to the soap Envelope and not to what is contained within the
Envelope. when you extract what is contained within the envelope then there
are no declaration lines.
 
P

Piculo

I was supposing that this was the problem but i dont know why when i get the
Xml document from the webservices i get the header (the xsl declaration) and
when i pass the xmldocument to the gebServices i lost the header (the header
i mean it is the declaration of the xsl related).

This is the declaration of the SaveDocument whitin i lost the header:

SOAP
The following is a sample SOAP request and response. The placeholders shown
need to be replaced with actual values.

POST /WebService1/Service1.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/WebService1/Service1/saveDocumentXML"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<saveDocumentXML xmlns="http://tempuri.org/WebService1/Service1">
<pvXmlDocument>xml</pvXmlDocument>
</saveDocumentXML>
</soap:Body>
</soap:Envelope>HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<saveDocumentXMLResponse
xmlns="http://tempuri.org/WebService1/Service1">
<saveDocumentXMLResult>string</saveDocumentXMLResult>
</saveDocumentXMLResponse>
</soap:Body>
</soap:Envelope>

And this is the declaration of the method that return the xml document with
the headers about xsl:


SOAP
The following is a sample SOAP request and response. The placeholders shown
need to be replaced with actual values.

POST /WebService1/Service1.asmx HTTP/1.1
Host: localhost
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/WebService1/Service1/returnDocumentXML"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<returnDocumentXML xmlns="http://tempuri.org/WebService1/Service1">
<idXML>string</idXML>
</returnDocumentXML>
</soap:Body>
</soap:Envelope>HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<returnDocumentXMLResponse
xmlns="http://tempuri.org/WebService1/Service1">
<returnDocumentXMLResult>xml</returnDocumentXMLResult>
</returnDocumentXMLResponse>
</soap:Body>
</soap:Envelope>HTTP POST
The following is a sample HTTP POST request and response. The placeholders
shown need to be replaced with actual values.

POST /WebService1/Service1.asmx/returnDocumentXML HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length

idXML=stringHTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0"?>
xml
Cheers.
 
P

Piculo

I was wrong, in both cases, return and save i lost the headers.
So, if i want obtain a xmlDocument (with xsl declaration) i must pass the
document as String, and convert in the other side to xmlDocument. Isnt?

Cheers,
Piculo.
 
D

Dino Chiesa [Microsoft]

yes, that is one way.

if you want a complete document (with xsl) why use SOAP?

or, if you want SOAP , why not include the XSL sheet as a separate
parameter?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,996
Messages
2,570,238
Members
46,826
Latest member
robinsontor

Latest Threads

Top