getting the response message from web service call

  • Thread starter Thread starter plork
  • Start date Start date
P

plork

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 .name;
string display = results .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
 
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 .name;
string display = results .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.
 
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 .name;
string display = results .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
 
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
 
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
 
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_mcca...0/09/Examine-XML-of-Web-Service-Response.aspx

Maybe this is exactly what you are looking for
 
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 .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 <ref> id 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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top