HighTechTalks DotNet Forums  

Returning Bare Type

ASP.net Web Services microsoft.public.dotnet.framework.aspnet.webservices


Discuss Returning Bare Type in the ASP.net Web Services forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
R. K. Wijayaratne
 
Posts: n/a

Default Returning Bare Type - 07-16-2007 , 09:29 PM






Hi everyone,

We have a web method which returns the following type:


public class methodNameResult
{
public string responseCode = null;
public string details = null;
}


Here is the web-method that returns the above:


[SoapDocumentMethod("",
Use = System.Web.Services.Description.SoapBindingUse.Enc oded,
ParameterStyle = SoapParameterStyle.Bare)]
public methodNameResult OurWebMethod(...)
{
...
}


Here is what the actual returned XML from the above web-method looks
like:


<soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/">
<types:methodNameResult id="id1">
<responseCode xsi:type="xsd:string">...</responseCode>
<details xsi:type="xsd:string">...</details>
</types:methodNameResult>
</soap:Body>


How can we ensure that the returned XML doesn't have
'<types:methodNameResult id="id1">' and '</types:methodNameResult>' in
it? We would rather specify it directly at the web-service rather than
removing / modifying the XML using a SoapFilter for example.

We are using .NET FW 2.0 and WSE 3.0.

Thank you,

RKW.
http://www.codinghelper.org/


Reply With Quote
  #2  
Old   
John Saunders [MVP]
 
Posts: n/a

Default Re: Returning Bare Type - 07-17-2007 , 10:16 AM






"R. K. Wijayaratne" <rasikaw (AT) gmail (DOT) com> wrote

Quote:
Hi everyone,

We have a web method which returns the following type:


public class methodNameResult
{
public string responseCode = null;
public string details = null;
}


Here is the web-method that returns the above:


[SoapDocumentMethod("",
Use = System.Web.Services.Description.SoapBindingUse.Enc oded,
ParameterStyle = SoapParameterStyle.Bare)]
public methodNameResult OurWebMethod(...)
{
...
}


Here is what the actual returned XML from the above web-method looks
like:


soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/"
types:methodNameResult id="id1"
responseCode xsi:type="xsd:string">...</responseCode
details xsi:type="xsd:string">...</details
/types:methodNameResult
/soap:Body


How can we ensure that the returned XML doesn't have
'<types:methodNameResult id="id1">' and '</types:methodNameResult>' in
it? We would rather specify it directly at the web-service rather than
removing / modifying the XML using a SoapFilter for example.
Are you trying to get just the responseCode and details returned? If that's
the case, then you shouldn't try to return a methodNameResult. Instead, try
returning the two values as "out" parameters:

[WebMethod]
public void OurWebMethod(..., out string responseCode, out string details)
{
}
--
John Saunders [MVP]



Reply With Quote
  #3  
Old   
=?Utf-8?B?Ui4gSy4gV2lqYXlhcmF0bmU=?=
 
Posts: n/a

Default Re: Returning Bare Type - 07-18-2007 , 02:46 AM



Hi John,

Thank you very much, that did the trick!

RKW.

"John Saunders [MVP]" wrote:

Quote:
"R. K. Wijayaratne" <rasikaw (AT) gmail (DOT) com> wrote in message
news:1184635788.918278.214410 (AT) i38g2000prf (DOT) googlegroups.com...
Hi everyone,

We have a web method which returns the following type:


public class methodNameResult
{
public string responseCode = null;
public string details = null;
}


Here is the web-method that returns the above:


[SoapDocumentMethod("",
Use = System.Web.Services.Description.SoapBindingUse.Enc oded,
ParameterStyle = SoapParameterStyle.Bare)]
public methodNameResult OurWebMethod(...)
{
...
}


Here is what the actual returned XML from the above web-method looks
like:


soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/
encoding/"
types:methodNameResult id="id1"
responseCode xsi:type="xsd:string">...</responseCode
details xsi:type="xsd:string">...</details
/types:methodNameResult
/soap:Body


How can we ensure that the returned XML doesn't have
'<types:methodNameResult id="id1">' and '</types:methodNameResult>' in
it? We would rather specify it directly at the web-service rather than
removing / modifying the XML using a SoapFilter for example.

Are you trying to get just the responseCode and details returned? If that's
the case, then you shouldn't try to return a methodNameResult. Instead, try
returning the two values as "out" parameters:

[WebMethod]
public void OurWebMethod(..., out string responseCode, out string details)
{
}
--
John Saunders [MVP]



Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.