473,398 Members | 2,403 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Encoding style

Hello, All!

I have the following webservice
[vb]
Imports System.Web.Services
Imports System.Xml

<System.Web.Services.WebService(Namespace:="http ://tempuri.org/WebApplication1/test"),
Protocols.SoapDocumentService()> _
Public Class test
Inherits System.Web.Services.WebService

#Region " Web Services Designer Generated Code "

Public Sub New()
MyBase.New()

'This call is required by the Web Services Designer.
InitializeComponent()

'Add your own initialization code after the InitializeComponent()
call

End Sub

'Required by the Web Services Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Web Services Designer
'It can be modified using the Web Services Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: This procedure is required by the Web Services Designer
'Do not modify it using the code editor.
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

#End Region

<WebMethod()> _
Public Function HelloWorld() As CustomSerialization
Return New CustomSerialization("Hello World")
End Function

Public Class CustomSerialization
Implements Serialization.IXmlSerializable

Private _str As String

Public Sub New()
_str = "default value"
End Sub

Public Sub New(ByVal str As String)
_str = str
End Sub

Public Function GetSchema() As Schema.XmlSchema Implements
Serialization.IXmlSerializable.GetSchema
Dim sr As New IO.StringReader("<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema' elementFormDefault='unqualified'
id='test'><xs:element name='string' type='xs:string'/></xs:schema>")
Dim xs As Schema.XmlSchema = Schema.XmlSchema.Read(sr, Nothing)
sr.Close()
Return xs
End Function

Public Sub ReadXml(ByVal reader As XmlReader) Implements
Serialization.IXmlSerializable.ReadXml
Throw New NotImplementedException
End Sub

Public Sub WriteXml(ByVal writer As XmlWriter) Implements
Serialization.IXmlSerializable.WriteXml
With writer
.WriteElementString("string", _str)
End With
End Sub
End Class
End Class
[/vb]

Here I have HelloWorld webmethod which returns instance of
CustomSerialization class. CustomSerialization class is the simple class,
except he is implementing IXmlSerializable. The class serializes into the
following xml
[xml]
<string>Hello world</string>
[/xml]

What I want is to get exactly that xml in webservice response, i.e.
[response]
<soap:Body>
<string>Hello World</string>
</soap:Body>

[/response]

But I've got
[actual-response]
<soap:Body>
<HelloWorldResult xmlns="http://tempuri.org/WebApplication1/test">
<string>Hello World</string>
</HelloWorldResult>
</soap:Body>
[/actual-response]

I don't want my xml is wrapped with HelloWorldResult. I try to apply
SoapDocumentMethodAttribute with ParameterStyle=Bare and Use=Literal without
success.

So, the question is how to remove wrapping HelloWorldResult element.

With best regards, Alex Shirshov.
Nov 23 '05 #1
4 2263
Search Google Groups for "<soap:Body> with Two Unique Elements". This older
thread has a solution that is probably applicable in your case too.

Regards,
Sami

"Alex Shirshov" <no****@mail.ru> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello, All!

I have the following webservice
[vb]
Imports System.Web.Services
Imports System.Xml

<System.Web.Services.WebService(Namespace:="http ://tempuri.org/WebApplication1/test"),
Protocols.SoapDocumentService()> _
Public Class test
Inherits System.Web.Services.WebService

#Region " Web Services Designer Generated Code "

Public Sub New()
MyBase.New()

'This call is required by the Web Services Designer.
InitializeComponent()

'Add your own initialization code after the InitializeComponent()
call

End Sub

'Required by the Web Services Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Web Services Designer
'It can be modified using the Web Services Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: This procedure is required by the Web Services Designer
'Do not modify it using the code editor.
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

#End Region

<WebMethod()> _
Public Function HelloWorld() As CustomSerialization
Return New CustomSerialization("Hello World")
End Function

Public Class CustomSerialization
Implements Serialization.IXmlSerializable

Private _str As String

Public Sub New()
_str = "default value"
End Sub

Public Sub New(ByVal str As String)
_str = str
End Sub

Public Function GetSchema() As Schema.XmlSchema Implements
Serialization.IXmlSerializable.GetSchema
Dim sr As New IO.StringReader("<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
elementFormDefault='unqualified' id='test'><xs:element name='string'
type='xs:string'/></xs:schema>")
Dim xs As Schema.XmlSchema = Schema.XmlSchema.Read(sr, Nothing)
sr.Close()
Return xs
End Function

Public Sub ReadXml(ByVal reader As XmlReader) Implements
Serialization.IXmlSerializable.ReadXml
Throw New NotImplementedException
End Sub

Public Sub WriteXml(ByVal writer As XmlWriter) Implements
Serialization.IXmlSerializable.WriteXml
With writer
.WriteElementString("string", _str)
End With
End Sub
End Class
End Class
[/vb]

Here I have HelloWorld webmethod which returns instance of
CustomSerialization class. CustomSerialization class is the simple class,
except he is implementing IXmlSerializable. The class serializes into the
following xml
[xml]
<string>Hello world</string>
[/xml]

What I want is to get exactly that xml in webservice response, i.e.
[response]
<soap:Body>
<string>Hello World</string>
</soap:Body>

[/response]

But I've got
[actual-response]
<soap:Body>
<HelloWorldResult xmlns="http://tempuri.org/WebApplication1/test">
<string>Hello World</string>
</HelloWorldResult>
</soap:Body>
[/actual-response]

I don't want my xml is wrapped with HelloWorldResult. I try to apply
SoapDocumentMethodAttribute with ParameterStyle=Bare and Use=Literal
without success.

So, the question is how to remove wrapping HelloWorldResult element.

With best regards, Alex Shirshov.

Nov 23 '05 #2
Search Google Groups for "<soap:Body> with Two Unique Elements". This older
thread has a solution that is probably applicable in your case too.

Regards,
Sami

"Alex Shirshov" <no****@mail.ru> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Hello, All!

I have the following webservice
[vb]
Imports System.Web.Services
Imports System.Xml

<System.Web.Services.WebService(Namespace:="http ://tempuri.org/WebApplication1/test"),
Protocols.SoapDocumentService()> _
Public Class test
Inherits System.Web.Services.WebService

#Region " Web Services Designer Generated Code "

Public Sub New()
MyBase.New()

'This call is required by the Web Services Designer.
InitializeComponent()

'Add your own initialization code after the InitializeComponent()
call

End Sub

'Required by the Web Services Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Web Services Designer
'It can be modified using the Web Services Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
End Sub

Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
'CODEGEN: This procedure is required by the Web Services Designer
'Do not modify it using the code editor.
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

#End Region

<WebMethod()> _
Public Function HelloWorld() As CustomSerialization
Return New CustomSerialization("Hello World")
End Function

Public Class CustomSerialization
Implements Serialization.IXmlSerializable

Private _str As String

Public Sub New()
_str = "default value"
End Sub

Public Sub New(ByVal str As String)
_str = str
End Sub

Public Function GetSchema() As Schema.XmlSchema Implements
Serialization.IXmlSerializable.GetSchema
Dim sr As New IO.StringReader("<xs:schema
xmlns:xs='http://www.w3.org/2001/XMLSchema'
elementFormDefault='unqualified' id='test'><xs:element name='string'
type='xs:string'/></xs:schema>")
Dim xs As Schema.XmlSchema = Schema.XmlSchema.Read(sr, Nothing)
sr.Close()
Return xs
End Function

Public Sub ReadXml(ByVal reader As XmlReader) Implements
Serialization.IXmlSerializable.ReadXml
Throw New NotImplementedException
End Sub

Public Sub WriteXml(ByVal writer As XmlWriter) Implements
Serialization.IXmlSerializable.WriteXml
With writer
.WriteElementString("string", _str)
End With
End Sub
End Class
End Class
[/vb]

Here I have HelloWorld webmethod which returns instance of
CustomSerialization class. CustomSerialization class is the simple class,
except he is implementing IXmlSerializable. The class serializes into the
following xml
[xml]
<string>Hello world</string>
[/xml]

What I want is to get exactly that xml in webservice response, i.e.
[response]
<soap:Body>
<string>Hello World</string>
</soap:Body>

[/response]

But I've got
[actual-response]
<soap:Body>
<HelloWorldResult xmlns="http://tempuri.org/WebApplication1/test">
<string>Hello World</string>
</HelloWorldResult>
</soap:Body>
[/actual-response]

I don't want my xml is wrapped with HelloWorldResult. I try to apply
SoapDocumentMethodAttribute with ParameterStyle=Bare and Use=Literal
without success.

So, the question is how to remove wrapping HelloWorldResult element.

With best regards, Alex Shirshov.

Nov 23 '05 #3
Hello, Sami!
You wrote on Tue, 7 Jun 2005 11:18:45 +0300:

[Sorry, skipped]

Thank you, Sami! I think about to return XmlDocument or XmlNode from the
method, but I cannot do this, 'cause ASP.NET will not generate proper wsdl.
I thought ASP.NET supports message exchange pattern. Now, I see it's not.
Only method calls in rpc style...

With best regards, Alex Shirshov.
Nov 23 '05 #4
Hello, Sami!
You wrote on Tue, 7 Jun 2005 11:18:45 +0300:

[Sorry, skipped]

Thank you, Sami! I think about to return XmlDocument or XmlNode from the
method, but I cannot do this, 'cause ASP.NET will not generate proper wsdl.
I thought ASP.NET supports message exchange pattern. Now, I see it's not.
Only method calls in rpc style...

With best regards, Alex Shirshov.
Nov 23 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Edward K. Ream | last post by:
The documentation for encoding lines at C:\Python23\Doc\Python-Docs-2.3.1\whatsnew\section-encodings.html states: "Encodings are declared by including a specially formatted comment in the...
1
by: Matt | last post by:
It has no error if I use <?xml version="1.0" encoding="utf-8" ?> in XML declaration. But if I use <?xml version="1.0" encoding="ISO-8859-1"?> It will produce error: The XML page cannot be...
2
by: RD | last post by:
What encoding must I use in my XML file to show the french character set correctly in the browser? I'm extracing data from a SQl server 2000 table and placing it in XML files using the...
2
by: Jeff Stewart | last post by:
I wrote the following function to accomodate a legacy driver function that only accepted VB6-style strings. The driver expects a string that represents an array of binary data to be sent over USB....
0
by: Campaniço | last post by:
On the Pocket Pc emulator of VS2003 i'm trying to run an application that want to access web services on a java server ( using JWSDP 1.5). And occurs a error, and i don't no how to slove it: ...
0
by: André | last post by:
I'm trying to change an app so that it uses gettext for translations rather than the idiosyncratic way I am using. I've tried the example on the wxPython wiki...
12
by: Christian Roth | last post by:
Hello, I am merely asking this for my own understanding: Processing instruction's data part is not entity-aware, i.e. character and numercial entities are not resolved at parsing time. E.g., ...
0
by: Chakravarthy | last post by:
Hi, I'm getting response from one of our vendor service in iso-8859-1 encoding style, which is Europian Occidental. Now tell me, how to handle this stream of input in .NET? If i'm not...
6
by: ThunderMusic | last post by:
Hi, We are trying to encode to ISO-8859-1, but we have problems doing it using the encoders in .NET. We get some unknown characters in some culture which comes out fine if we post (from IE) from a...
1
by: maxxxxel | last post by:
Hi Can anyone help me with some asp code , I changed the code to use CDO.message instead of the old cdont.sys to send mail from a ASP webpage which works fine. Our problem is that when we send...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.