Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / Web Services / October 2004

Tip: Looking for answers? Try searching our database.

Why lose xml headers? Xml declaration and xsl instruction

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Piculo - 25 Oct 2004 10:49 GMT
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.
Dino Chiesa [Microsoft] - 26 Oct 2004 17:10 GMT
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.

> Hi,
>
[quoted text clipped - 34 lines]
> Thanks,
> Pikulo.
Piculo - 27 Oct 2004 13:02 GMT
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.

> can you explain what you were trying to do ?
> In web services the response is contained in a soap envelope. soap is just
[quoted text clipped - 43 lines]
>> Thanks,
>> Pikulo.
Piculo - 27 Oct 2004 15:19 GMT
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.

>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
[quoted text clipped - 138 lines]
>>> Thanks,
>>> Pikulo.
Dino Chiesa [Microsoft] - 27 Oct 2004 15:27 GMT
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?

>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
[quoted text clipped - 145 lines]
>>>> Thanks,
>>>> Pikulo.
Piculo - 31 Oct 2004 17:01 GMT
But it is possible use a WebServices without SOAP?

Thanks,
Piculo.

> yes, that is one way.
>
[quoted text clipped - 153 lines]
>>>>> Thanks,
>>>>> Pikulo.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.