Problem sending XML over SSL

S

Sam

Hi All,

I have to send XML string to a remote site app, say,
https://blah.blah.com/xmlproc.cgi. I am using the following code:

private string SendRequest(string sRequest)
{
WebClient oWc = new WebClient();
oWc.Headers.Add("Content-Type","application/x-www-form-urlencoded");
byte[] bReq = Encoding.ASCII.GetBytes(sRequest);
byte[] bRsp = oWc.UploadData("https://blah.blah.com/xmlproc.cgi", "POST",
bReq);
return Encoding.ASCII.GetString(bRsp);
}

But the site always responds with "No XML Passed" in it's response. The site
works for sure as I have a test app (no source) that can send the same XML
and get a valid response. What am I missing?

Thanks in advance
Sam
 
D

Dan Rogers

Hi,

In the debugger, are you sure there is a valid XML payload in the byte
array you are passing in your FORM post? Is the web service on the other
end expecting a FORM post? Most web services don't expect data in a form
field. Is the remote application a SOAP based web service?

Regards

Dan Rogers
Microsoft Corporation
--------------------
 
S

Sam

I did try with "text/xml" with the same result. I know that the test
application in which the xml works is a delphi app using the Indy HTTP
control to do a post of the data. Assuming it is SOAP based and I cannot
send data in a form field, what are the options I have?

Thanks
Sam

Dan Rogers said:
Hi,

In the debugger, are you sure there is a valid XML payload in the byte
array you are passing in your FORM post? Is the web service on the other
end expecting a FORM post? Most web services don't expect data in a form
field. Is the remote application a SOAP based web service?

Regards

Dan Rogers
Microsoft Corporation
--------------------
From: "Sam" <$@M>
Subject: Problem sending XML over SSL
Date: Tue, 30 Nov 2004 15:47:06 -0500
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: flounder.telecom.idt.net 169.132.9.129
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP12
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:26894
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Hi All,

I have to send XML string to a remote site app, say,
https://blah.blah.com/xmlproc.cgi. I am using the following code:

private string SendRequest(string sRequest)
{
WebClient oWc = new WebClient();
oWc.Headers.Add("Content-Type","application/x-www-form-urlencoded");
byte[] bReq = Encoding.ASCII.GetBytes(sRequest);
byte[] bRsp = oWc.UploadData("https://blah.blah.com/xmlproc.cgi", "POST",
bReq);
return Encoding.ASCII.GetString(bRsp);
}

But the site always responds with "No XML Passed" in it's response. The site
works for sure as I have a test app (no source) that can send the same XML
and get a valid response. What am I missing?

Thanks in advance
Sam
 
D

Dan Rogers

Hi Sam,

I think if it were me, I'd ask the owners of the remote web service for
their WSDL file, and then generate a proxy as my first step in calling
their service. If what they have is a hand-coded, non-standard XML
reader/writer, the problem gets a lot harder. You really are delving at
this point into understanding the wire format and protocol requirements for
invoking a remote call. If you can get specifics on what is required, it
will save a lot of time spent guessing what it could be. If it is a web
service, it should have a WSDL file available.

I hope this helps,

Dan Rogers
Microsoft Corporation
--------------------
From: "Sam" <$@M>
References: <#[email protected]>
Subject: Re: Problem sending XML over SSL
Date: Wed, 1 Dec 2004 10:01:00 -0500
Lines: 70
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <OF#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: flounder.telecom.idt.net 169.132.9.129
Path: cpmsftngxa10.phx.gbl!TK2MSFTFEED02.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP14
..phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:26935
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

I did try with "text/xml" with the same result. I know that the test
application in which the xml works is a delphi app using the Indy HTTP
control to do a post of the data. Assuming it is SOAP based and I cannot
send data in a form field, what are the options I have?

Thanks
Sam

Dan Rogers said:
Hi,

In the debugger, are you sure there is a valid XML payload in the byte
array you are passing in your FORM post? Is the web service on the other
end expecting a FORM post? Most web services don't expect data in a form
field. Is the remote application a SOAP based web service?

Regards

Dan Rogers
Microsoft Corporation
--------------------
From: "Sam" <$@M>
Subject: Problem sending XML over SSL
Date: Tue, 30 Nov 2004 15:47:06 -0500
Lines: 23
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1437
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1441
Message-ID: <#[email protected]>
Newsgroups: microsoft.public.dotnet.framework.aspnet.webservices
NNTP-Posting-Host: flounder.telecom.idt.net 169.132.9.129
Path:
cpmsftngxa10.phx.gbl!TK2MSFTFEED01.phx.gbl!TK2MSFTNGP08.phx.gbl!TK2MSFTNGP1 2
phx.gbl
Xref: cpmsftngxa10.phx.gbl microsoft.public.dotnet.framework.aspnet.webservices:26894
X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet.webservices

Hi All,

I have to send XML string to a remote site app, say,
https://blah.blah.com/xmlproc.cgi. I am using the following code:

private string SendRequest(string sRequest)
{
WebClient oWc = new WebClient();
oWc.Headers.Add("Content-Type","application/x-www-form-urlencoded");
byte[] bReq = Encoding.ASCII.GetBytes(sRequest);
byte[] bRsp = oWc.UploadData("https://blah.blah.com/xmlproc.cgi", "POST",
bReq);
return Encoding.ASCII.GetString(bRsp);
}

But the site always responds with "No XML Passed" in it's response. The site
works for sure as I have a test app (no source) that can send the same XML
and get a valid response. What am I missing?

Thanks in advance
Sam
 

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

Members online

No members online now.

Forum statistics

Threads
473,997
Messages
2,570,239
Members
46,827
Latest member
DMUK_Beginner

Latest Threads

Top