Returning Bare Type

Discussion in 'ASP .Net Web Services' started by R. K. Wijayaratne, Jul 17, 2007.

  1. 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.Encoded,
    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/
     
    R. K. Wijayaratne, Jul 17, 2007
    #1
    1. Advertising

  2. "R. K. Wijayaratne" <> wrote in message
    news:...
    > 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.Encoded,
    > 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]
     
    John Saunders [MVP], Jul 17, 2007
    #2
    1. Advertising

  3. Hi John,

    Thank you very much, that did the trick!

    RKW.

    "John Saunders [MVP]" wrote:

    > "R. K. Wijayaratne" <> wrote in message
    > news:...
    > > 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.Encoded,
    > > 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]
    >
    >
     
    R. K. Wijayaratne, Jul 18, 2007
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark Fox

    Bare LF

    Mark Fox, Jul 29, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    1,893
    Mark Fox
    Aug 10, 2003
  2. parley
    Replies:
    13
    Views:
    748
    jim corey
    Feb 11, 2004
  3. Richard

    bare bones <div> demo online

    Richard, Nov 3, 2003, in forum: HTML
    Replies:
    20
    Views:
    888
    informant
    Nov 4, 2003
  4. John J. Lee

    When is bare except: justified?

    John J. Lee, Dec 5, 2003, in forum: Python
    Replies:
    4
    Views:
    375
    John J. Lee
    Dec 5, 2003
  5. makobu
    Replies:
    18
    Views:
    963
    David Thompson
    Feb 10, 2008
Loading...

Share This Page