By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,382 Members | 2,071 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,382 IT Pros & Developers. It's quick & easy.

getting the response message from web service call

P: n/a
hi all i'm calling a web service method and can get it's results just
fine however i want to grab the repsonse message from the call

is anyone able to tell me how i do this?

results = service.getMethod(a, b, c, d)

then iterating through

for (int i = 0; i < results .Length; i++)
{
string name = results [i].name;
string display = results [i].name;
}

i want the raw xml response. I know i can use TCPTrace to get this
BUT i need it in code

In java i can do this, how do i do this in c#?

Service service = new Service();
Call call = (Call) service.createCall();
........
Message message = call.getResponseMessage();

thanks for any help
Nov 22 '07 #1
Share this Question
Share on Google+
6 Replies


P: n/a
On Nov 22, 11:21 am, plork <plork...@hotmail.comwrote:
hi all i'm calling a web service method and can get it's results just
fine however i want to grab the repsonse message from the call

is anyone able to tell me how i do this?

results = service.getMethod(a, b, c, d)

then iterating through

for (int i = 0; i < results .Length; i++)
{
string name = results [i].name;
string display = results [i].name;

}

i want the raw xml response. I know i can use TCPTrace to get this
BUT i need it in code

In java i can do this, how do i do this in c#?

Service service = new Service();
Call call = (Call) service.createCall();
.......
Message message = call.getResponseMessage();

thanks for any help
You can call a web service using SOAP, create a HttpWebRequest to GET
http://server/service.asmx?getMethod and read the response.
Nov 22 '07 #2

P: n/a
On Nov 22, 11:17 am, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Nov 22, 11:21 am, plork <plork...@hotmail.comwrote:


hi all i'm calling a web service method and can get it's results just
fine however i want to grab the repsonse message from the call
is anyone able to tell me how i do this?
results = service.getMethod(a, b, c, d)
then iterating through
for (int i = 0; i < results .Length; i++)
{
string name = results [i].name;
string display = results [i].name;
}
i want the raw xml response. I know i can use TCPTrace to get this
BUT i need it in code
In java i can do this, how do i do this in c#?
Service service = new Service();
Call call = (Call) service.createCall();
.......
Message message = call.getResponseMessage();
thanks for any help

You can call a web service using SOAP, create a HttpWebRequest to GEThttp://server/service.asmx?getMethodand read the response.- Hide quoted text -

- Show quoted text -


Hi there

I can already call the webservice method and get the correct results
but i need to get the full raw soap response

i'm writing a windows application so i can't use HttpWebRequest

thanks for your help
Nov 22 '07 #3

P: n/a
so i can't use HttpWebRequest

You may be confusing System.Net.HttpWebRequest and
System.Web.HttpRequest; the latter is the inbound request for ASP.NET,
but the former is a generic outbound request over http - i.e. exactly
what you want.

You could also look at WebClient - but in both cases you'd need to
form your own outbound request, which may not be what you had in mind.

Another option might be to look into writing a SOAP extension to watch
the stream. If this was WCF I could advise on how to do this, but I
have never tried it with the older SOAP code.

Marc
Nov 22 '07 #4

P: n/a
On Nov 22, 11:51 am, Marc Gravell <marc.grav...@gmail.comwrote:
so i can't use HttpWebRequest

You may be confusing System.Net.HttpWebRequest and
System.Web.HttpRequest; the latter is the inbound request for ASP.NET,
but the former is a generic outbound request over http - i.e. exactly
what you want.

You could also look at WebClient - but in both cases you'd need to
form your own outbound request, which may not be what you had in mind.

Another option might be to look into writing a SOAP extension to watch
the stream. If this was WCF I could advise on how to do this, but I
have never tried it with the older SOAP code.

Marc


Could you show me howi use System.Net.HttpWebRequest

i'm doing this but it errors with use of unassigned local variable
System.Net.HttpWebRequest httpWebRequest;
httpWebRequest.GetResponse();

many thanks
Nov 22 '07 #5

P: n/a
On Nov 22, 12:51 pm, Marc Gravell <marc.grav...@gmail.comwrote:
so i can't use HttpWebRequest

You may be confusing System.Net.HttpWebRequest and
System.Web.HttpRequest; the latter is the inbound request for ASP.NET,
but the former is a generic outbound request over http - i.e. exactly
what you want.

You could also look at WebClient - but in both cases you'd need to
form your own outbound request, which may not be what you had in mind.

Another option might be to look into writing a SOAP extension to watch
the stream. If this was WCF I could advise on how to do this, but I
have never tried it with the older SOAP code.

Marc
Marc is right, but listen, I found that you can use
proxy.ResponseSoapContext
http://devlicio.us/blogs/billy_mccaf...-Response.aspx

Maybe this is exactly what you are looking for
Nov 22 '07 #6

P: n/a
On Nov 22, 12:11 pm, Alexey Smirnov <alexey.smir...@gmail.comwrote:
On Nov 22, 12:51 pm, Marc Gravell <marc.grav...@gmail.comwrote:
so i can't use HttpWebRequest
You may be confusing System.Net.HttpWebRequest and
System.Web.HttpRequest; the latter is the inbound request for ASP.NET,
but the former is a generic outbound request over http - i.e. exactly
what you want.
You could also look at WebClient - but in both cases you'd need to
form your own outbound request, which may not be what you had in mind.
Another option might be to look into writing a SOAP extension to watch
the stream. If this was WCF I could advise on how to do this, but I
have never tried it with the older SOAP code.
Marc

Marc is right, but listen, I found that you can use
proxy.ResponseSoapContexthttp://devlicio.us/blogs/billy_mccafferty/archive/2006/10/09/Examine-...

Maybe this is exactly what you are looking for


Thanks but that's not what i want
I've added a web reference to my windows application project
then i've got using webservice.WebService; in the declarations bit at
the top

i can then call the webservice

webservice service = new webservice();

ComplexType [] results = null;

results = service.webServiceMethod(apramA, paramB);

for (int i = 0; i < results .Length; i++)
{
messagebox.show( results [i].name);
}

I can call the webservice and get the results - all that is ok

I've done a TCPTrace on the raw soap and the soap is returns like this

<ref id="id0" soapenc:root="0" soapenv:encodingStyle="http://
schemas.xmlsoap.org/soap/encoding/" xsi:type="ns3:ComplexType"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ns3="http://......">
<id href="#id1"/>
<display xsi:type="soapenc:string">display value</display>
<name xsi:type="soapenc:string">name value</name>
</ref>

<ref id="id1" soapenc:root="0" soapenv:encodingStyle="http://
schemas.xmlsoap.org/soap/encoding/" xsi:type="soapenc:long"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/">123</ref>
so i need to 'grap' the second <refid value of '123''

This is where i'm stuck, so thought if i grab the raw xml soap
repsonse usng c# i can parse the xml to get the id value of '123' but
i'm finding it extremly difficult just to get the raw xml using c#
code

using .net2 andcs 2005

thanks for any help
Nov 22 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.