473,503 Members | 1,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

<soap:Body> with Two Unique Elements?

Hello All.

Is it possible to create a Web service with C# that returns a response with
two different elements in the SOAP Body? I'm thinking of something like
this:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<summary_data>
<!-- summary_data elements here -->
</summary_data>
<detail_data>
<!-- detail_data elements here -->
</detail_data>
</soap:Body>
</soap:Envelope>

I've tried a few different method attributes, but just can't seem to get it
looking this way.

Thanks very much.
--
Earl Damron
ea**@earldamron.com
Nov 21 '05 #1
5 3172
You should be able to add the SoapDocumentMethod attribute and set the
ParameterStyle to Bare.

[SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare),
WebMethod]
public void DoSomething(SummaryClass summary_data, DetailClass
detail_data)
{
}

Drew Robbins
Earl Damron wrote:
Hello All.

Is it possible to create a Web service with C# that returns a response with
two different elements in the SOAP Body? I'm thinking of something like
this:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<summary_data>
<!-- summary_data elements here -->
</summary_data>
<detail_data>
<!-- detail_data elements here -->
</detail_data>
</soap:Body>
</soap:Envelope>

I've tried a few different method attributes, but just can't seem to get it
looking this way.

Thanks very much.

Nov 21 '05 #2
I tried that. My Web method is:

[WebMethod(), SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare)]
public string HelloWorld()
{
...
}

Despite this, my response comes out as:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<HelloWorldResult xmlns="http://tempuri.org/"> desired result elements
here... </HelloWorldResult>
</soap:Body>
</soap:Envelope>

I can't seem to get rid of the overriding <HelloWorldResult> element
wrapper. I can rename it using [result: XmlElement(...)], but not get rid
of it.

Is there some parameter of the SoapDocumentMethod constructor I'm not aware
of?

Thanks

Earl

"Drew Robbins" <"drew at drewby.com"> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
You should be able to add the SoapDocumentMethod attribute and set the
ParameterStyle to Bare.

[SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare),
WebMethod]
public void DoSomething(SummaryClass summary_data, DetailClass
detail_data)
{
}

Drew Robbins
Earl Damron wrote:
Hello All.

Is it possible to create a Web service with C# that returns a response with two different elements in the SOAP Body? I'm thinking of something like
this:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<summary_data>
<!-- summary_data elements here -->
</summary_data>
<detail_data>
<!-- detail_data elements here -->
</detail_data>
</soap:Body>
</soap:Envelope>

I've tried a few different method attributes, but just can't seem to get it looking this way.

Thanks very much.

Nov 21 '05 #3
Sorry, I missed that it was the response that you wanted formatted that
way. Mark your parameters with the 'out' keyword and use the Bare
ParameterStyle.

[WebMethod(), SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare)]
public void HelloWorld(out string result1, out string result2)
{
result1 = "Hello";
result2 = "World";
}

Earl Damron wrote:
I tried that. My Web method is:

[WebMethod(), SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare)]
public string HelloWorld()
{
...
}

Despite this, my response comes out as:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<HelloWorldResult xmlns="http://tempuri.org/"> desired result elements
here... </HelloWorldResult>
</soap:Body>
</soap:Envelope>

I can't seem to get rid of the overriding <HelloWorldResult> element
wrapper. I can rename it using [result: XmlElement(...)], but not get rid
of it.

Is there some parameter of the SoapDocumentMethod constructor I'm not aware
of?

Thanks

Earl

"Drew Robbins" <"drew at drewby.com"> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
You should be able to add the SoapDocumentMethod attribute and set the
ParameterStyle to Bare.

[SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare),
WebMethod]
public void DoSomething(SummaryClass summary_data, DetailClass
detail_data)
{
}

Drew Robbins
Earl Damron wrote:
Hello All.

Is it possible to create a Web service with C# that returns a response
with
two different elements in the SOAP Body? I'm thinking of something like
this:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<summary_data>
<!-- summary_data elements here -->
</summary_data>
<detail_data>
<!-- detail_data elements here -->
</detail_data>
</soap:Body>
</soap:Envelope>

I've tried a few different method attributes, but just can't seem to get
it
looking this way.

Thanks very much.


Nov 21 '05 #4
You can also achieve what you want with this code:

[WebMethod()]
[SoapDocumentMethodAttribute(ParameterStyle = SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlAnyElement]
public XmlElement[] GetXml()
{
// return two XML elements here
}

Regards,
Sami
"Earl Damron" <ea********@mail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I tried that. My Web method is:

[WebMethod(), SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare)]
public string HelloWorld()
{
...
}

Despite this, my response comes out as:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<HelloWorldResult xmlns="http://tempuri.org/"> desired result elements
here... </HelloWorldResult>
</soap:Body>
</soap:Envelope>

I can't seem to get rid of the overriding <HelloWorldResult> element
wrapper. I can rename it using [result: XmlElement(...)], but not get rid
of it.

Is there some parameter of the SoapDocumentMethod constructor I'm not aware of?

Thanks

Earl

"Drew Robbins" <"drew at drewby.com"> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
You should be able to add the SoapDocumentMethod attribute and set the
ParameterStyle to Bare.

[SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare),
WebMethod]
public void DoSomething(SummaryClass summary_data, DetailClass
detail_data)
{
}

Drew Robbins
Earl Damron wrote:
Hello All.

Is it possible to create a Web service with C# that returns a response with two different elements in the SOAP Body? I'm thinking of something like this:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<summary_data>
<!-- summary_data elements here -->
</summary_data>
<detail_data>
<!-- detail_data elements here -->
</detail_data>
</soap:Body>
</soap:Envelope>

I've tried a few different method attributes, but just can't seem to
get
it looking this way.

Thanks very much.


Nov 21 '05 #5
This works like a champ Sami! I changed the return type to XmlNode[], since
that's what my code creates, but it works great.

This seems to be the ONLY way I get my exact node contents returned without
having them wrapped in anything or modified in any way.

Thanks very much!

"Sami Vaaraniemi" <sa**********@pleasejippii.fi> wrote in message
news:Ot**************@TK2MSFTNGP14.phx.gbl...
You can also achieve what you want with this code:

[WebMethod()]
[SoapDocumentMethodAttribute(ParameterStyle = SoapParameterStyle.Bare)]
[return: System.Xml.Serialization.XmlAnyElement]
public XmlElement[] GetXml()
{
// return two XML elements here
}

Regards,
Sami
"Earl Damron" <ea********@mail.com> wrote in message
news:%2***************@TK2MSFTNGP12.phx.gbl...
I tried that. My Web method is:

[WebMethod(), SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare)]
public string HelloWorld()
{
...
}

Despite this, my response comes out as:

<?xml version="1.0" encoding="utf-16"?>
<soap:Envelope ...>
<soap:Body>
<HelloWorldResult xmlns="http://tempuri.org/"> desired result elements here... </HelloWorldResult>
</soap:Body>
</soap:Envelope>

I can't seem to get rid of the overriding <HelloWorldResult> element
wrapper. I can rename it using [result: XmlElement(...)], but not get rid of it.

Is there some parameter of the SoapDocumentMethod constructor I'm not

aware
of?

Thanks

Earl

"Drew Robbins" <"drew at drewby.com"> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
You should be able to add the SoapDocumentMethod attribute and set the
ParameterStyle to Bare.

[SoapDocumentMethod(ParameterStyle=SoapParameterSty le.Bare),
WebMethod]
public void DoSomething(SummaryClass summary_data, DetailClass
detail_data)
{
}

Drew Robbins
Earl Damron wrote:
> Hello All.
>
> Is it possible to create a Web service with C# that returns a
response with
> two different elements in the SOAP Body? I'm thinking of something

like > this:
>
> <?xml version="1.0" encoding="utf-16"?>
> <soap:Envelope ...>
> <soap:Body>
> <summary_data>
> <!-- summary_data elements here -->
> </summary_data>
> <detail_data>
> <!-- detail_data elements here -->
> </detail_data>
> </soap:Body>
> </soap:Envelope>
>
> I've tried a few different method attributes, but just can't seem to

get
it
> looking this way.
>
> Thanks very much.



Nov 21 '05 #6

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

Similar topics

1
1948
by: Casper Hornstrup | last post by:
Is there anyway I can make my xml webservice not htmlencode the response from a call to an API? I have: public int PerformOperation(string operation, out string result) The content of result...
1
3363
by: Clara Yeung | last post by:
I have captured some SOAP messages (using org.wsi.test.monitor.Monitor of the WSI test tool). When I try to analyze the messages with WSI test tool analyzer, the "message" artifact of the report...
0
2278
by: Michael Jackson | last post by:
I have attempted to mark up a service and it's methods so that it doesn't require the SOAPAction HTTP header to resolve the methods being called, this is done from first element in <SOAP-ENV:Body>...
5
5375
by: Jeff | last post by:
We are using .Net and the wsdl Utility to generate proxies to consume web services built using the BEA toolset. The data architects on the BEA side create XML schemas with various entities in...
0
4327
by: Matt Wood | last post by:
Hi, I have written a Web Service for a customer which expects a SOAP message with Document/Literal encoding, and uses RoutingStyle=SoapServiceRoutingStyle.RequestElement to route the SOAP body...
6
24215
by: tentstitcher | last post by:
Hi all: I have a source xml document with an element of type string. This element contains something like the following: <stringData> &lt;Header&gt; &lt;Body&gt; </stringData> I would like to apply an...
3
11669
by: jparulan | last post by:
Hi All, I'm using SOAP3.0. I was able to successfully call a WSDL file and get a value properly. But when the WSDL changed to have a MULTIPLE <element name> it was failing. This code works...
4
4337
plumpnation
by: plumpnation | last post by:
Hello one and all. I have recently been working outside of my field of expertise alot, and it is greatly distressing me. I have learned a small amount of php and actionscript, but now need to move...
0
2077
by: nappingcub | last post by:
This is my first time coding a web service in .NET and ran into a slight snag that I was hoping that anyone could help me out on. I'm using the generic Hello World web service that is stubbed out on...
0
7201
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
7278
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7328
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
7456
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
4672
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3166
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3153
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1510
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
734
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.