Proxy class not reading data returned in SOAP response

Ask a Question related to ASP.NET Web Services, Design and Development.

  1. #1

    Default Proxy class not reading data returned in SOAP response

    I'm trying to create a .NET client to consume a Java web service. The
    company that owns the web service does not publish a WSDL, but they do
    publish an API document with examples of each supported request and
    its corresponding response.

    I've manually created a WSDL file based on their examples, and
    generated a proxy class using WSDL.EXE. The proxy class appears to
    send a valid request because I can see a valid response coming back
    using a network sniffer. However, when the proxy class calls
    Invoke(), it returns an object[] of the correct length, but with each
    element null.

    ------------------------------------------------------
    Here's the SOAP response I'm getting from the server (some data
    changed to protect the innocent):

    <?xml version="1.0" encoding="UTF-8"?>
    <?Some_Company_API version="1.0"?>
    <SOAP-ENV:Envelope SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    <SOAP-ENV:Body>
    <m:TheResponse xmlns:m="Some API">
    <element1 xsi:type="xsd:string">some data</element1>
    <element2 xsi:type="xsd:string">some more data</element2>
    </m:TheResponse>
    </SOAP-ENV:Body>
    </SOAP-ENV:Envelope>
    ------------------------------------------------------

    ------------------------------------------------------
    Here's the method of the proxy class I'm calling:

    [System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/Login",
    RequestNamespace="http://tempuri.org/",
    ResponseNamespace="http://tempuri.org/",
    Use=System.Web.Services.Description.SoapBindingUse .Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
    public string Login(string param1, string param2, string param3, out
    string element2) {
    object[] results = this.Invoke("Login", new object[] {
    param1,
    param2,
    param3});
    element2 = ((string)(results[1]));
    return ((string)(results[0]));
    }
    ------------------------------------------------------

    If I analyze results[] in breakmode, it has a length of 2, but each
    element is null.

    Is there something special I need to do to the proxy class to get it
    to read the returned data?

    TIA

    Jared
    Jared Guest

  2. Similar Questions and Discussions

    1. How to log raw SOAP response msg?
      The .NET web service proxy class is great for transparent app process via SOAP calls. I have a need to log the raw SOAP response messages. Is...
    2. extract the soap message from the proxy class
      Hi Is there a way to extract the soap message from the proxy class before its being sent to the web service? Thanks
    3. SOAP Response
      I cannot get the Trace to work for my Web Service application or client. I need to be able to see the entire SOAP message (for documentation and...
    4. Typed dataset returned from webservice incorrectly defined in proxy - null value problem
      I have a web service that has a xsd defined for a dataset. The xsd has all of the proper tables/elements, constraints, relations, etc. and works...
    5. How to write c# proxy class to get at this data?
      Hi, I'm trying to use a wdsl generated proxy class to Invoke a web services method which outputs a soap envelope shown below. The response...
  3. #2

    Default Re: Proxy class not reading data returned in SOAP response

    yes, I think you need to set your RequestNamespace and ResponseNamespace to
    "Some API"
    not [url]http://tempuri.org[/url].

    -Dino


    "Jared" <jaredljensen@hotmail.com> wrote in message
    news:3264d672.0404271944.1e39ec79@posting.google.c om...
    > I'm trying to create a .NET client to consume a Java web service. The
    > company that owns the web service does not publish a WSDL, but they do
    > publish an API document with examples of each supported request and
    > its corresponding response.
    >
    > I've manually created a WSDL file based on their examples, and
    > generated a proxy class using WSDL.EXE. The proxy class appears to
    > send a valid request because I can see a valid response coming back
    > using a network sniffer. However, when the proxy class calls
    > Invoke(), it returns an object[] of the correct length, but with each
    > element null.
    >
    > ------------------------------------------------------
    > Here's the SOAP response I'm getting from the server (some data
    > changed to protect the innocent):
    >
    > <?xml version="1.0" encoding="UTF-8"?>
    > <?Some_Company_API version="1.0"?>
    > <SOAP-ENV:Envelope
    SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
    > xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
    > xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
    > xmlns:xsi="http://www.w3.org/1999/XMLSchema-instance"
    > xmlns:xsd="http://www.w3.org/1999/XMLSchema">
    > <SOAP-ENV:Body>
    > <m:TheResponse xmlns:m="Some API">
    > <element1 xsi:type="xsd:string">some data</element1>
    > <element2 xsi:type="xsd:string">some more data</element2>
    > </m:TheResponse>
    > </SOAP-ENV:Body>
    > </SOAP-ENV:Envelope>
    > ------------------------------------------------------
    >
    > ------------------------------------------------------
    > Here's the method of the proxy class I'm calling:
    >
    >
    [System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.o
    rg/Login",
    > RequestNamespace="http://tempuri.org/",
    > ResponseNamespace="http://tempuri.org/",
    > Use=System.Web.Services.Description.SoapBindingUse .Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
    > [return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
    > public string Login(string param1, string param2, string param3, out
    > string element2) {
    > object[] results = this.Invoke("Login", new object[] {
    > param1,
    > param2,
    > param3});
    > element2 = ((string)(results[1]));
    > return ((string)(results[0]));
    > }
    > ------------------------------------------------------
    >
    > If I analyze results[] in breakmode, it has a length of 2, but each
    > element is null.
    >
    > Is there something special I need to do to the proxy class to get it
    > to read the returned data?
    >
    > TIA
    >
    > Jared

    Dino Chiesa [Microsoft] Guest

  4. #3

    Default Re: Proxy class not reading data returned in SOAP response

    "Dino Chiesa [Microsoft]" <dinoch@online.microsoft.com> wrote in message news:<#ApeU7OLEHA.1120@TK2MSFTNGP11.phx.gbl>...
    > yes, I think you need to set your RequestNamespace and ResponseNamespace to
    > "Some API"
    > not [url]http://tempuri.org[/url].
    >
    > -Dino
    >
    Dino,

    I've updated the method attributes as shown below. I tried it with
    and without setting the "ResponseElementName" param. It still fails
    to populate results[], even though I'm still seeing a valid response
    with my network sniffer.

    ----------------------------------------------------
    [System.Web.Services.Protocols.SoapDocumentMethodAt tribute("http://tempuri.org/Login",
    ResponseElementName="LoginResponse",
    RequestNamespace="Some API",
    ResponseNamespace="Some API",
    Use=System.Web.Services.Description.SoapBindingUse .Literal,
    ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)]
    [return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
    public string Login(string param1, string param2, string param3, out
    string element2) {
    object[] results = this.Invoke("Login", new object[] {
    param1,
    param2,
    param3});
    element2 = ((string)(results[1]));
    return ((string)(results[0]));
    }
    ----------------------------------------------------


    ----------------------------------------------------
    Is there anything wrong with my class attributes?

    [System.Diagnostics.DebuggerStepThroughAttribute()]
    [System.ComponentModel.DesignerCategoryAttribute("c ode")]
    [System.Web.Services.WebServiceBindingAttribute(Nam e="SomeApiSoap",
    Namespace="http://tempuri.org/")]
    public class SomeApi :
    System.Web.Services.Protocols.SoapHttpClientProtoc ol {
    ...
    }
    ----------------------------------------------------


    Thanks again,

    Jared
    Jared Guest

  5. #4

    Default Re: Proxy class not reading data returned in SOAP response

    [email]jaredljensen@hotmail.com[/email] (Jared) wrote in
    news:3264d672.0404281117.2936771b@posting.google.c om:
    > "Dino Chiesa [Microsoft]" <dinoch@online.microsoft.com> wrote in
    > message news:<#ApeU7OLEHA.1120@TK2MSFTNGP11.phx.gbl>...
    >> yes, I think you need to set your RequestNamespace and
    >> ResponseNamespace to "Some API"
    >> not [url]http://tempuri.org[/url].
    >>
    >> -Dino
    >>
    >
    > Dino,
    >
    > I've updated the method attributes as shown below. I tried it with
    > and without setting the "ResponseElementName" param. It still fails
    > to populate results[], even though I'm still seeing a valid response
    > with my network sniffer.
    >
    > ----------------------------------------------------
    > [System.Web.Services.Protocols.SoapDocumentMethodAt tribute
    ("http://temp
    > uri.org/Login",
    > ResponseElementName="LoginResponse",
    > RequestNamespace="Some API",
    > ResponseNamespace="Some API",
    > Use=System.Web.Services.Description.SoapBindingUse .Literal,
    > ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrap
    p
    > ed)]
    > [return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
    > public string Login(string param1, string param2, string param3, out
    > string element2) {
    > object[] results = this.Invoke("Login", new object[] {
    > param1,
    > param2,
    > param3});
    > element2 = ((string)(results[1]));
    > return ((string)(results[0]));
    > }
    > ----------------------------------------------------
    >
    >
    > ----------------------------------------------------
    > Is there anything wrong with my class attributes?
    >
    > [System.Diagnostics.DebuggerStepThroughAttribute()]
    > [System.ComponentModel.DesignerCategoryAttribute("c ode")]
    > [System.Web.Services.WebServiceBindingAttribute(Nam e="SomeApiSoap",
    > Namespace="http://tempuri.org/")]
    > public class SomeApi :
    > System.Web.Services.Protocols.SoapHttpClientProtoc ol {
    > ...
    > }
    > ----------------------------------------------------
    >
    >
    > Thanks again,
    >
    > Jared
    Here's my own answer based on the following post:

    [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8[/url]
    &safe=off&threadm=avmXa.5874%24Ye.5664%40fed1read0 2&rnum=4&prev=/groups%
    3Fq%3Dnull%2520%2522SOAP%253A%253ALite%2522%26num% 3D30%26hl%3Den%26lr%
    3D%26ie%3DUTF-8%26oe%3DUTF-8%26safe%3Doff%26sa%3DN%26tab%3Dwg

    (Note that the web service is Perl SOAP::Lite)

    -----------------------------------------------------------------
    [System.Web.Services.Protocols.SoapDocumentMethodAt tribute
    ("http://tempuri.org/Login",
    ResponseElementName="LoginResponse",
    RequestNamespace="Some API",
    ResponseNamespace="Some API",
    Use=System.Web.Services.Description.SoapBindingUse .Encoded,
    ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)
    ]
    [return: System.Xml.Serialization.SoapElementAttribute("ele ment1")]
    public string Login(string param1, string param2, string param3, out
    string element2) {
    ....
    }

    The fixes were:

    1) Use SoapBindingUse.Encoded instead of Literal
    2) Use Serialization.SoapElementAttribute("element1") instead of
    XmlElementAttribute("element1")
    -----------------------------------------------------------------
    Jared Jensen Guest

  6. #5

    Default Re: Proxy class not reading data returned in SOAP response

    Great, glad you were able to solve it. sorry I couldn't be more helpful.
    SOAP::Lite is nice but I think its lack of WSDL support means that
    development is trickier.

    ps: that URL was:
    [url]http://tinyurl.com/3ao5b[/url]

    -Dino


    "Jared Jensen" <jaredljensen@hotmail.com> wrote in message
    news:Xns94D98EAA821AEjaredljensenhotmailc@207.46.2 48.16...
    > [email]jaredljensen@hotmail.com[/email] (Jared) wrote in
    > news:3264d672.0404281117.2936771b@posting.google.c om:
    >
    > > "Dino Chiesa [Microsoft]" <dinoch@online.microsoft.com> wrote in
    > > message news:<#ApeU7OLEHA.1120@TK2MSFTNGP11.phx.gbl>...
    > >> yes, I think you need to set your RequestNamespace and
    > >> ResponseNamespace to "Some API"
    > >> not [url]http://tempuri.org[/url].
    > >>
    > >> -Dino
    > >>
    > >
    > > Dino,
    > >
    > > I've updated the method attributes as shown below. I tried it with
    > > and without setting the "ResponseElementName" param. It still fails
    > > to populate results[], even though I'm still seeing a valid response
    > > with my network sniffer.
    > >
    > > ----------------------------------------------------
    > > [System.Web.Services.Protocols.SoapDocumentMethodAt tribute
    > ("http://temp
    > > uri.org/Login",
    > > ResponseElementName="LoginResponse",
    > > RequestNamespace="Some API",
    > > ResponseNamespace="Some API",
    > > Use=System.Web.Services.Description.SoapBindingUse .Literal,
    > > ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrap
    > p
    > > ed)]
    > > [return: System.Xml.Serialization.XmlElementAttribute("elem ent1")]
    > > public string Login(string param1, string param2, string param3, out
    > > string element2) {
    > > object[] results = this.Invoke("Login", new object[] {
    > > param1,
    > > param2,
    > > param3});
    > > element2 = ((string)(results[1]));
    > > return ((string)(results[0]));
    > > }
    > > ----------------------------------------------------
    > >
    > >
    > > ----------------------------------------------------
    > > Is there anything wrong with my class attributes?
    > >
    > > [System.Diagnostics.DebuggerStepThroughAttribute()]
    > > [System.ComponentModel.DesignerCategoryAttribute("c ode")]
    > > [System.Web.Services.WebServiceBindingAttribute(Nam e="SomeApiSoap",
    > > Namespace="http://tempuri.org/")]
    > > public class SomeApi :
    > > System.Web.Services.Protocols.SoapHttpClientProtoc ol {
    > > ...
    > > }
    > > ----------------------------------------------------
    > >
    > >
    > > Thanks again,
    > >
    > > Jared
    >
    > Here's my own answer based on the following post:
    >
    > [url]http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8[/url]
    > &safe=off&threadm=avmXa.5874%24Ye.5664%40fed1read0 2&rnum=4&prev=/groups%
    > 3Fq%3Dnull%2520%2522SOAP%253A%253ALite%2522%26num% 3D30%26hl%3Den%26lr%
    > 3D%26ie%3DUTF-8%26oe%3DUTF-8%26safe%3Doff%26sa%3DN%26tab%3Dwg
    >
    > (Note that the web service is Perl SOAP::Lite)
    >
    > -----------------------------------------------------------------
    > [System.Web.Services.Protocols.SoapDocumentMethodAt tribute
    > ("http://tempuri.org/Login",
    > ResponseElementName="LoginResponse",
    > RequestNamespace="Some API",
    > ResponseNamespace="Some API",
    > Use=System.Web.Services.Description.SoapBindingUse .Encoded,
    > ParameterStyle=System.Web.Services.Protocols.SoapP arameterStyle.Wrapped)
    > ]
    > [return: System.Xml.Serialization.SoapElementAttribute("ele ment1")]
    > public string Login(string param1, string param2, string param3, out
    > string element2) {
    > ...
    > }
    >
    > The fixes were:
    >
    > 1) Use SoapBindingUse.Encoded instead of Literal
    > 2) Use Serialization.SoapElementAttribute("element1") instead of
    > XmlElementAttribute("element1")
    > -----------------------------------------------------------------

    Dino Chiesa [Microsoft] Guest

  7. #6

    Default Re: Proxy class not reading data returned in SOAP response

    It works for me.

    Thanks
    Ashu
    Unregistered Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139